Pwn • 100 points (Static) • Easy
A courier crossed the city once and left only the map. Retrace the route exactly. Target: https://cyber-arena-2026.s3.ap-south-1.amazonaws.com/scs/binary/chall4/walk Launch Target Submit Flag*
Only two challenge strings exist: route> and you walked into a wall. Time to disassemble and find what route is accepted.
main is at 0x401660. Let me decompile it with Ghidra.
main is small and clear. Let me decode it: it reads a route string, walks a 3D map with per-cell direction bitmasks, requires landing at (6,6,6) in exactly 56 chars, then FNV-1a-hashes the route and XOR-decrypts a 40-byte flag. Let me extract the data tables.
Messages confirmed: route> , \r\n, you walked into a wall, you are not there yet, you got there, but not the way the courier did. Now the jump table and data tables:
Direction table decoded — chars d,e,n,s,u,w map to the 6 handlers (compass: n/s/e/w + up/down), start cell hardcodes mask 0x10 (must step up first), goal is (6,6,6), route must be exactly 56 chars, then FNV-1a hash XOR-decrypts 41 bytes at 0x497fb9. Now a solver:
DFS exploded — the maze likely has many open paths. Switch to DP over (cell, remaining steps) to count and prune, then enumerate only viable routes:
One unique 56-step route, and its hash decrypts cleanly. Verify against the real binary:
Solved. Flag: CACTF{bfs_thr0ugh_th3_s3v3n_cub3d_c1ty}
How it works
The stripped static binary (main @ 0x401660) is a 3D maze walk:
- Read a route with
fgetsinto0x4aa2e0, strip\r\n. - Walk a 7×7×7 cube — map of direction bitmasks at
0x497e60(343 bytes), indexedx + 7y + 49z. A jump table at0x47c070maps charsd,e,n,s,u,wto handlers (compass + up/down):e→x+1 (bit 0x04),w→x−1 (0x08),s→y+1 (0x02),n→y−1 (0x01),u→z+1 (0x10),d→z−1 (0x20). Any other char → "you walked into a wall".- The start mask is hardcoded to 0x10, so the first step must be
u(up).
- Landing check: must end at exactly
(6,6,6)(else "you are not there yet") and the route must be exactly 56 chars (else "you got there, but not the way the courier did"). - Flag decrypt: FNV-1a over the route — with a quirk: it hashes
route[55]first, thenroute[1..55](byte 0 never hashed, byte 55 twice). The resulting 64-bit hash seedsh = h*prime ^ i, taking the top byte each round, XORed against the 41-byte table at0x497fb9, thenputs.
Solution
A DP over (cell, remaining-steps) showed exactly one 56-step route from (0,0,0)→(6,6,6), so enumeration was trivial once pruned:
ueswuesdwuseseuunussusdddwneuenneunuswsedwseuwsedendesuu
$ echo 'ueswuesdwuseseuunussusdddwneuenneunuswsedwseuwsedendesuu' | ./walk
route> CACTF{bfs_thr0ugh_th3_s3v3n_cub3d_c1ty}
Solver script is in solve.py (workspace).
