· 3 min read · by Eav Puthcambo
Don't reverse the VM, just run it
A reversing challenge hides its password check inside a bytecode VM dispatched through a SIGTRAP handler. Instead of decoding it by hand, emulate it and watch which bytes each constraint touches.
control freak 3, LYKN CTF 2026 (reversing)
The checker in this one is deliberately horrible to read: a control-flow-flattened bytecode VM, dispatched through a SIGTRAP signal handler and an 8-entry jump table. It runs 5 rounds of bytecode (itself decrypted with SplitMix64) through 8 different hash-mixer opcodes, each built from xxHash, SHA and FNV constants, and folds everything into one accumulator.
You pass if, after all of that, the accumulator is zero.
Why the usual tricks fail
Normally you'd attack a password check by watching where it gives up early, byte by byte. Not here:
- There's no early exit. Every byte gets hashed and OR'd into one accumulator, and the only comparison is a single
cmp ... , 0at the very end. So a wrong byte looks exactly like a right one until the final check. - There's anti-debug: a timing loop and a
/proc/self/statusTracerPid check. If either trips, it corrupts a register that's supposed to be 0 in a clean run, quietly poisoning the result.
So neither a native brute force nor a timing side-channel gets you anywhere.
The move: emulate, don't decode
Statically unpacking 8 hash opcodes, plus the SplitMix64 bytecode decryption, plus the signal-handler dispatch, is a lot of surface area to get wrong. So I didn't. I ran the real validator inside Unicorn, the CPU emulator, and treated it as ground truth.
The harness:
- Maps the binary, stubs out the anti-debug calls (
ptracereturns 0,clock_gettimeis fixed,/procreads hit EOF, the SIGTRAP clean-flag is pre-set), and patches the 0x50000-iteration timing loop down to a single iteration. Each run then takes about 0.01 seconds. - Traces every
or qword[rsp], reg(the accumulation sites) and every read from the input buffer, so I learn which input bytes each constraint actually touches.
I don't need to understand a single one of those hashes. I only need to know which bytes each one reads and whether it comes out zero.
The structure falls out
Tracing the byte reads showed the constraints form a perfect triangle: every position p has a single-byte constraint on itself, plus multi-byte groups that all "close" at p (their highest byte index is p). That means I can solve left to right:
For each position
p, try every printable byte (32–126) and keep the one that makes every group closing atpevaluate to zero.
Each position has exactly one solution, so the flag just falls out one character at a time:
$ ./chall-4 'LYKNCTF{0UT_0F_C0NTR0L_VM2026}'
Correct!
One wrinkle worth noting: in the emulator the final accumulator keeps a small 0xff residual (an anti-debug value that would be exactly 0 on real hardware), so emu.run(flag) prints Nope. That doesn't matter, because the solver keys on the 77 individual per-instruction group constraints all being zero, which they are, and the recovered flag then verifies on the real binary.
When a VM is this nasty to read, the fastest path is often to stop reading and start running it.
📂 Full writeup with the Unicorn harness and the triangular solver: ctf-writeups/reverse/…/control freak 3
Read more 
Skipping a 6-day puzzle by emulating the last 3 numbers
An ARM64 Mach-O crackme gates its flag behind a dozen conditions across six in-game days. The flag builder only reads three small integers, so you can emulate it and ignore the puzzle entirely.
When the provided solver is a trap
A Windows crackme ships two "reference" scripts that reimplement its VM. Both are wrong, because they hardcode a seed that real startup code computes. The fix is to stop reimplementing and emulate the real thing.
A Python program hidden inside itself, many times over
An obfuscated Python challenge decrypts a layer, runs it, and repeats, with anti-debug that silently corrupts the key if it sees you. The weak spot is the one library it forgot to protect.