DEV Community

Cover image for I built a small open-source white-box CTF puzzle (134 KB native binary) in Pa, a Python-syntax LLVM language
cyyier
cyyier

Posted on

I built a small open-source white-box CTF puzzle (134 KB native binary) in Pa, a Python-syntax LLVM language

I have been working on Pa, a statically compiled language that uses a standard Python-compatible AST (ast.parse passes) and compiles via LLVM -O2 to standalone native binaries.

To stress-test the standalone binary pipeline (libpa.hash, zeroize, ct_eq, parallel()), I built a small self-contained white-box CTF / CrackMe (~134 KB stripped Linux ELF / ~189 KB macOS arm64 Mach-O, linking only system libs).

Full source (challenge.pa) is public from minute zero — you can audit it, build it locally, or ignore the source and try a blind binary RE run:

  • 4 independent offline puzzles (--p1..--p4): 2,880 telemetry samples (--diag), a 200M-domain non-invertible 12-round ARX digest search, a 24-round 64-bit state machine, and a 36-weight modular sum mod 2^64.
  • Vault: All 4 answers derive a seed into a 6-layer × 16 MB DRAM-bound serial maze (~6s/try) with BLAKE3-CTR, a 256-bit keyed BLAKE3 MAC (ct_eq), and a 15s/layer timeout fuse (zeroize).
  • Decoy path: Wrong inputs still run ~6s and output a deterministic decoy code (exit 2), while an authentic MAC-verified unlock exits 0.

Starter nudges for the first two:

  • --p2: 200M iterations is slow in pure Python, ~3s in a 15-line parallel native solver (Pa / C / Rust).
  • --p3: Every step in p3_forward(x) is invertible mod 2^64.

Source, build steps, and discussion thread are in the repo:
https://github.com/palang-dev/pa/tree/main/challenges/coffee_maze

Top comments (0)