arrow_backUS Cyber Games 2026
Reverse Engineeringmedium

ARM_Obfuscated

by Pavel Knespl (capyplivl)

A 67 KB stripped aarch64 PIE password checker wrapped in anti-debug. The check is a Blowfish-CTR style stream cipher whose keystream is tied to the buffer address, so it is solved by emulating the check function with Unicorn instead of running the binary.

Solve

  1. Triage in radare2. main (0xac0) is if (argc==2 && check(argv[1])==1) puts("You solved the ARM64 Medium+ binary!");. check (0x1208) does anti-debug (signal(SIGTRAP)+raise, clock_gettime timing > 500 fail, ptrace(PTRACE_TRACEME), an internal fcn.00000f00), then builds a 52-byte expected blob in a loop at 0x1240 and calls transform(buf, 52, key=0x123456789abcdef0) at 0xc8c, then compares 52 bytes.
  2. Read the blob construction. Each byte is sbox[idx_table[i]] ^ rolling_key ^ 0x3a, rolling_key starts 0x54 and increments by 0x17 per byte, tables at 0x1490/0x14d0. No string literals.
  3. Identify transform (0xc8c) as 16-round Blowfish (F=((S0[a]+S1[b])^S2[c])+S3[d]) used in CTR/OFB mode: it encrypts the block index and XORs the result into the data. So it is a stream cipher and flag = blob XOR keystream.
  4. Emulate check with Unicorn. Map both PT_LOAD segments at their vaddrs, allocate a stack, enable NEON. Add a code hook that stubs every BL (return 0) except the real bl 0xc8c, and captures the transformed buffer (x21) and expected buffer (x20) just before the compare loop at 0x1364.
  5. Force the NEON cipher path. transform reads a CPU-dispatch flag at 0x200b0 (file holds 1, which routes to a scalar decoy that memsets the output). Zero it: mu.mem_write(0x200b0, b'\x00\x00\x00\x00').
  6. The keystream is address-dependent, so generate it in the exact calling context (input at sp+0x90). Run the whole check on a zero input to get keystream + blob, XOR, then self-verify.
_, c  = run_check(b'\x00'*52)
flag  = xor(c['expected'], c['keystream'])
r, c2 = run_check(flag)
assert r == 1 and c2['transformed'] == c2['expected']
print(flag)

Flag: SVIUSCG{Even_an_0bFusC4T3D_ARM64_bin_is_No_Match_4U}