chain

Misc • 500 points (Dynamic Decay) • Hard

DYNAMIC SCORING Current: 500 pts Range: 500 pts → 350 pts • Solves: 0 Nine links, four characters each, each one depending on the last. Guessing is not an option. Challenge Artifacts: chain Submit Flag* CTF{...}

Dr.Binary
run_sandbox

A statically linked, stripped x86-64 ELF. Let me get more info and try running it.

run_sandbox
run_sandbox

It prompts seal> and reads input. Let me dig into strings and find the entry point.

run_sandbox
run_sandbox

Standard glibc static binary. The user code is small — let me locate the prompt strings and find the code around them.

run_sandbox
run_sandbox

There's a custom .acgseal section with exactly 0x24 = 36 bytes = nine links × 4 chars. Let me look at it.

run_sandbox

Nine 32-bit words. Let me find the code that references .acgseal (0x497da0) and the main routine.

run_sandbox
run_sandbox
run_sandbox

The check is fully visible: input must be 36 chars, split into nine 4-byte links, each CRC-32'd (table at 0x4aa2e0) with the state chained across links, compared against the nine words in .acgseal. Let me verify the table and the small strings.

run_sandbox

The table at 0x4aa2e0 is actually in .bss — it's built at runtime. Let me find the code that fills it.

run_sandbox
run_sandbox

main builds a CRC table at runtime (vectorized bit-by-bit construction). Let me read the constants: poly, masks, initial values.

run_sandbox

Standard CRC-32 table (poly 0xEDB88320). The scheme is now fully known:

  • input: exactly 36 chars = nine 4-byte links
  • link_0: crc32(0x5c5, link_0) == words[0]
  • link_i: crc32(words[i-1], link_i) == words[i]

CRC-32 over exactly 4 bytes is a GF(2)-affine bijection, so each link has a unique 4-byte preimage — solvable directly, no guessing. Let me solve the linear system:

run_sandbox

Bit-mapping bug in my elimination. Let me redo it properly with the RHS as an augmented bit per row:

run_sandbox

The unique preimage is fully printable: CACTF{l1n34r_ch3cksums_f0rg3_b4ck!!}. Let me verify against the binary:

run_sandbox

accepted — the binary verifies it.

Solution

Flag: CACTF{l1n34r_ch3cksums_f0rg3_b4ck!!}

(If your grader wants the literal CTF{...} wrapper, drop the leading CA: CTF{l1n34r_ch3cksums_f0rg3_b4ck!!})

How it works

chain is a stripped static ELF, but the user code is tiny (main at 0x401660, verifier at 0x4015xx–0x4017d5):

  1. main builds a standard CRC-32 table (poly 0xEDB88320) at runtime into .bss at 0x4aa2e0 (vectorized c = (c>>1) ^ (c&1 ? 0xEDB88320 : 0) loop), so no table exists statically.
  2. The verifier reads a line, requires strlen == 0x24 (36 chars), and processes it as nine 4-byte links with state chained between them:
    • raw state starts at 0x5c5, inverted (not) before each link's byte loop and after it
    • ~state_after_link_i must equal word i of the custom .acgseal section (0x497da0, 36 bytes = nine little-endian words)
    • the un-inverted state carries into the next link

In zlib terms: crc32(0x5c5, link_0) == words[0], then crc32(words[i-1], link_i) == words[i] — the "each one depending on the last" chain.

Why "guessing is not an option" — and why none was needed

CRC-32 over exactly 4 bytes of input is a GF(2)-affine bijection of the 32 input bits (the linear part is invertible). So for each fixed previous state and each target word there is exactly one 4-byte preimage. I built the 32×32 linear system from the images of the unit-bit inputs, solved it by Gaussian elimination per link, and each solution came out printable ASCII — nine links chained into the seal:

CACT | F{l1 | n34r | _ch3 | cksu | ms_f | 0rg3 | _b4c | k!!}

Confirmed by running the binary: seal> accepted (exit 0).