Daniel Bae
Menu

Cereal Killer 02: reversing time to un-tamper the key

Start reading

The flavour text is the hint. Read it literally, find the corrupted lookup table, and the flag has been sitting in the grid all along.

The Cereal Killer series dresses simple reversing puzzles in alien-cereal flavour text. Episode 01 was a SHA1/RC4 password check. Episode 02 trades cryptography for a self-referential trick: the program tells you how it was sabotaged, in-universe, and the fix is to read the hint literally. It is a satisfying 150-point puzzle because the flag is hidden in plain sight the whole time — the only obstacle is one deliberately corrupted lookup table.

The package

The challenge ships as a password-protected 7-zip (password KlippyAI). It bundles two challenge binaries and one “bonus” program:

$ 7z x -pKlippyAI -oextracted cereal02.7z
$ file extracted/*
KlippyAI-trained-on-CK02.exe: PE32 executable ... Intel i386 Mono/.Net assembly
re03-lin-x86.bin:             ELF 32-bit LSB pie executable, Intel i386, ... not stripped
re03-win-x86.exe:             PE32 executable ... Intel i386

The prompt plays up the “surprise” KlippyAI-trained-on-CK02.exe and warns about antivirus — a bit of theatre. That .NET file is not needed to solve the challenge; it is a distraction (and a decoy “intellectual property” prop in the storyline). Analyse the Linux ELF re03-lin-x86.bin; it is the smallest and un-stripped.

“Packed”? Not really

The prompt claims the binaries are “packed … to keep degenerate miscreants from stealing Lytton Labs’ intellectual property.” Testing that claim takes one command:

$ upx -t re03-lin-x86.bin
upx: re03-lin-x86.bin: NotPackedException: not packed by UPX

Not packed. This is the challenge’s second piece of misdirection (after the bonus .exe). Static analysis works straight away. The ELF is a 32-bit i386 PIE, un-stripped, with the usual main, and a short .text (0x778 bytes).

The flavour text is the hint

The strings tell the whole story if you read them as instructions rather than decoration:

The second of our new alien... guests... are the 'Nordics'. ...
they also have a hidden talent that lets them... tamper ... with
um... FEATURES... of our universe.
Okay, let's try to decrypt the flag to find out the Nordic's favourite
spooky cereal, shall we?
[!] ERROR! The key has been tampered with.  It does not correctly decipher the flag!
[!] ERROR! TIME is REVERSIBLE, but the KEY is NOT... Go Back!

Two claims matter: the key has been tampered with, and TIME is REVERSIBLE. Together they say: the decryption key is stored in the wrong order, and reversing it (“going back in time”) restores it. Keep that in mind while reading the code.

Locating the tables

List the sections to confirm addresses map simply (for this PIE, .rodata file offset equals virtual address):

$ rizin -q -c 'iS' re03-lin-x86.bin
...
0x00002000 0xc24 0x00002000 0xc24 -r-- .rodata PROGBITS alloc
0x00003000 0x8  0x00004000 0x8   -rw- .data   PROGBITS write,alloc

Disassembling main shows it referencing two 256-byte byte arrays in .rodata, which it combines to produce the output grid. They sit at 0x2a20 and 0x2b24. Dump both:

$ rizin -q -c 'p8 256 @ 0x2a20' re03-lin-x86.bin    # key1
9cae21e764e57d31...c70bb1c...
$ rizin -q -c 'p8 256 @ 0x2b24' re03-lin-x86.bin    # key2
7959709a6f0b303d...b84b6...

main XORs these two tables element-by-element and prints the result as a 16×16 character grid (with ASCII-art borders). Done naively — key1[i] ^ key2[i] — the result is noise:

Python
r = bytes(a ^ b for a, b in zip(key1, key2))
# b'\xe5\xf7Q}\x0b\xeeM\x0c...'  -> garbage, no "deadface"

That is the “tampered key” the program complains about.

Reversing the key

Apply the hint. “TIME is REVERSIBLE” → reverse the second key before XORing:

Python
k1 = open('re03-lin-x86.bin','rb').read()[0x2a20:0x2a20+256]
k2 = open('re03-lin-x86.bin','rb').read()[0x2b24:0x2b24+256]
r  = bytes(a ^ b for a, b in zip(k1, k2[::-1]))     # note k2[::-1]
print(r.decode('latin1'))

This produces a clean 16×16 grid:

****************
* f e e d . . .*
* f a c e . . .*
* d e a d b eef*
* d e a d . . .*
* f a c e { . .*
* N 0 r d i c s*
* -R3ally-like-*
* Frank3nb3rry-*
* cuz-bro-is- .*
* tall-like-. .*
* they-are!}. .*
* badf00d......*
* d a 7e4107 . *
****************

Only reversing the second key works; reversing the first, or reversing both, gives noise again. The direction matters because XOR against a reversed operand is not symmetric with respect to position.

Reading the grid — and spotting the decoys

The grid is laid out one “word” per row, surrounded by * borders and padded with . and spaces. Concatenate the non-decoration characters:

Python
s = r.decode('latin1')
print(s.replace('*','').replace('\n','').replace(' ','').replace('.',''))
feedfacedeadbeefdeadface{N0rdics-R3ally-like-Frank3nb3rry-cuz-bro-is-tall-like-they-are!}badf00dda7e4107

The real flag is embedded in the middle. The surrounding tokens are decoy hex-word garnish:

  • feedface, deadbeef, badf00d, da7e4107 are classic “magic” debug constants. They look flag-ish (they even contain dead/face), which is exactly why they are placed flanking the real deadface{...} — a careless reader might grab feedfacedeadbeef or stop at the wrong brace.
  • The flag proper is delimited by deadface{ and the closing }. Everything before deadface{ and after } is noise.

The prompt’s format rule is the tie-breaker: no spaces, periods, or asterisks in the flag. After stripping the grid’s spacing, the only deadface{...} span that obeys that rule is the real one. The content also reads as an intentional joke — Nordics (tall, Nordic aliens) liking Frankenberry “cuz bro is tall like they are.”

Final flag

deadface{N0rdics-R3ally-like-Frank3nb3rry-cuz-bro-is-tall-like-they-are!}

Takeaways

  • Read the error strings as a spec. “The key has been tampered with” + “TIME is REVERSIBLE” is a complete, if cute, description of the transform: reverse the second lookup table, then XOR.
  • Verify packer claims; don’t assume. The prompt insists the binary is packed; upx -t disproves it in one line. Prompts in RE challenges are often in-character misdirection.
  • Recognise magic-number decoys. feedface, deadbeef, badf00d, da7e4107 are placed to blur the flag boundary. The format rules (“no spaces/periods/asterisks”) exist precisely so you can filter them out after reconstructing the grid.

Share

Written by Daniel Bae

Computer science student at UCLA. I build desktop, web and command-line software in Rust, Go and Python, and write here about how it is made. About this site