DL·SYS
Contact ↗

CSCTF 2026 · Crypto · 131 pts

The Key Wheel.

A keystream needs eight MT19937 outputs from before the observed window even starts — recoverable by running the generator's own twist step in reverse.

MT19937Mersenne Twister untwist
EventCSCTF 2026, Operation Dawn (online jeopardy)
CategoryCrypto
Points131
StatusSolved during the event
TargetCBOR journal, offline

TL;DR. A journal stores 1248 raw MT19937 outputs in a CBOR register, but the dispatch that needs decrypting requires 8 outputs from just before that recorded window starts. Standard MT19937 untempering and the documented untwist operation recover the prior 624-word generator state directly, from which the missing 8 outputs are generated.

Challenge

Decrypt a sealed dispatch whose keystream needs MT19937 outputs that were never directly recorded.

Solution

The journal's CBOR register holds 1248 raw (untempered-before-recording, i.e. straight generator outputs) MT19937 words, confirmed by checking that the standard MT19937 twist recurrence is satisfied across the whole sequence. A field window_opens_tx=156 establishes that register[0] corresponds to global output index 1248 — conveniently exactly one 624-word block boundary.

The dispatch that needs decrypting, tx=155, requires outputs [1240, 1248) — the last 8 outputs of the previous 624-word block, which were never recorded directly. Recovering them requires reversing MT19937's own internal twist step: first untempering the recorded first block's outputs back to raw generator-state words, then applying the standard, publicly documented MT19937 untwist operation to recover the entire previous 624-word internal state.

Self-check: re-twisting the recovered previous state reproduces the recorded first block exactly, and un-twisting the recorded first block reproduces the recovered previous state exactly — a clean round trip in both directions. Tempering words 616 through 623 of that recovered state gives exactly the 8 missing outputs.

Building the keystream as SHA256(output_word || i) blocks from the full output sequence (now including the recovered outputs) and XORing it against the sealed ciphertext decrypts cleanly — and the decrypted dispatches in the already-recorded window read as plain English, with tx=156 literally saying "turn the key wheel back to read it", confirming the whole approach.

Flag

FlagCSCTF{15_jam_the_enemy_net_at_dawn_7e2c04}

What I took from it