- 01
Find the check
From the strings to the function that decides.
- 02
Extract the rules
A length, a XOR per byte, a weighted sum.
- 03
Solve and run
Compute the flag, type it into the program.
We wrote this checker for the showcase and compiled it with gcc 14.2 (-O1, x86-64). The listings below are the program's real disassembly. Download it (binary, source, checksum) and try it with your own agent.
Ask your agent
›Use REP on ./checker. Find the checking function, turn every check into an equation, solve it, and prove the answer by running the program.
Find the checking code
main prints Flag: , reads a line, and prints Correct! or Wrong. depending on check. Inside check: the length must be 0x14 (20), then check_char(input, i) runs for i = 0…19, then check_sum(input) decides.
11a0: movsxd rsi,esi
11a3: movzx eax,BYTE PTR [rdi+rsi*1]
11a7: lea rdx,[rip+0xe92] # 2040 <MASK>
11ae: xor al,BYTE PTR [rdx+rsi*1]
11b1: lea rdx,[rip+0xe68] # 2020 <WANT>
11b8: cmp al,BYTE PTR [rdx+rsi*1]
11bb: sete al
11be: movzx eax,al
11c1: retOne check reveals one character
(input[i] ^ MASK[i]) == WANT[i]. XOR undoes itself, so input[i] = WANT[i] ^ MASK[i]. The two tables, read from the program's data section:
| i | WANT | MASK | XOR | char |
|---|---|---|---|---|
| 0 | 3c | 5a | 66 | f |
| 1 | 0d | 61 | 6c | l |
| 2 | 09 | 68 | 61 | a |
| 3 | 08 | 6f | 67 | g |
| 4 | 0d | 76 | 7b | { |
| … | … | … | … | … |
| 19 | a2 | df | 7d | } |
The masks step by 7 (0x5a, 0x61, 0x68 …): a pattern, not random bytes, which is a hint the agent can use to check it read the table right.
The last check
11e0: movzx edx,BYTE PTR [rdi+rax*1-0x1]
11e5: imul edx,eax
11e8: add ecx,edx
11ea: add rax,0x1
11ee: cmp rax,0x15
11f2: jne 11e0
11f4: cmp ecx,0x58adEach character times its position (1 to 20), added up, must be 0x58ad = 22701. The XOR answer already fixes every character, so this sum is a check on the solution, not a second puzzle.
Try the rules
The real program agrees:
$ ./checker
Flag: flag{read_the_bytes}
Correct!