d4rk{quantum_echo_reuse_breaks_the_pad}
Summary
challenge.json bundles three artifacts: a BB84-style quantum_transcript, a
register dump with a documented controller model, and a sealed_flag plus
seal_record compatibility vectors. The task brief hints at "a 32-byte block size and a
counter that starts at zero", which reads like AES-256-CTR — that is a decoy.
The compatibility vectors prove the seal is a SHA-256 keystream: 32-byte blocks are
SHA256(material_ascii || counter_u32_be), with the counter starting at 0. No AES key
is ever needed. The real secret is the material string "s:t:e0:q", and it is exactly
the four register controller-model parameters, recovered from the register dump with a
linear solve over GF(2):
- Calibration probes give the rotation distances:
fold_word = x ^ (rotl(x,5) & rotl(x,11)),walk_word = rotl(x,7). - A GF(2) linear solve over 160 observations recovers
fold_mask,walk_mask, the echo seed, and 16 calibration-pad bits (contacts A..P):z_i = parity(fold_mask & fold_word_i) ^ echo_i ^ pad[contact_i], withecho_i = echo_{i-1} ^ parity(walk_mask & walk_word_i). - The solution is determined only up to a global XOR of
(e0, pads); the transcript'saudit_taponregister_seed_contact_A(=1) picks the unique branch. The recovered model reproduces all 160zbits. material = "1d0cc456:ccc78639:0:1010010010100001"; XOR the 39-bytesealed_flagwith the SHA-256 keystream to get the flag.
The BB84 transcript contributes only the basis convention (sifted = samples 0..23) and
the contact_A = 1 audit bit. The "quantum key" is really the register-derived material,
and its reuse is what "breaks the pad".
Solution / Exploit
1. Controller model parameters from the calibration probes
The register.controller_calibration.probes give (input, fold_word, walk_word)
triples. Brute-forcing the rotation distances against the documented model
fold_word = input ^ (rotl(input,r1) & rotl(input,r2)) and walk_word = rotl(input,r)
pins them uniquely:
fold rot = (5, 11) walk rot = 7
From qe_solve_model.py:
1probes = d['register']['controller_calibration']['probes']
2for p in probes:
3 x = int(p['input'], 16)
4 fw = x ^ (rotl(x, 5) & rotl(x, 11))
5 ww = rotl(x, 7)
6 assert fw == int(p['fold_word'], 16), p
7 assert ww == int(p['walk_word'], 16), p
8print("calibration OK: fold r=(5,11) walk r=7")
2. Recover fold_mask / walk_mask / echo seed / pad bits (GF(2))
Model (from controller_model):
z_i = parity(fold_mask & fold_word_i) XOR echo_i XOR pad[contact_i]
echo_i = echo_{i-1} XOR parity(walk_mask & walk_word_i) (echo_0 = e0, updated before recording)
Every term is GF(2)-linear in the 81 unknowns (fold_mask 32b, walk_mask 32b, e0
1b, 16 pad bits for contacts A..P). 160 equations go into Gaussian elimination. The
contact schedule is A..P repeating (the trace only covers the first 32 rows):
1contacts = [chr(ord('A') + i % 16) for i in range(len(obs))]
2
3NU = 32 + 32 + 1 + 16
4rows = []
5for i in range(len(obs)):
6 v = [0] * (NU + 1)
7 for b in range(32):
8 if (fold_words[i] >> b) & 1: v[b] ^= 1
9 for j in range(i + 1):
10 for b in range(32):
11 if (walk_words[j] >> b) & 1: v[32 + b] ^= 1
12 v[64] ^= 1
13 v[65 + ord(contacts[i]) - 65] ^= 1
14 v[NU] = zs[i]
15 rows.append(v)
16# ... Gaussian elimination over GF(2) ...
Result:
rank = 80/81 -> fold_mask = 1d0cc456 walk_mask = ccc78639 e0 = 1 pads = 0101101101011110
One free variable: (e0, pads) are determined only up to a global XOR with 1.
3. Resolve the ambiguity with the audit tap
The transcript's audit_tap at sample 0 has source = register_seed_contact_A,
reported_bit = 1. Flipping the free variable so that pad_A = 1 gives the unique
correct solution, which then reproduces all 160 z values:
1audit0 = next(e for e in d['quantum_transcript']['event_log']
2 if e['event'] == 'audit_tap' and e.get('source') == 'register_seed_contact_A')
3if pads[0] != str(audit0['reported_bit']):
4 e0, pads = 1 - e0, ''.join(str(1 - int(c)) for c in pads)
e0 = 0 pads = 1010010010100001
model reproduces all 160 z bits: True
4. Material string and keystream
material = "1d0cc456:ccc78639:0:1010010010100001" # s:t:e0:q
The seal_record compatibility vectors are confirmed to be keystream blocks of
SHA256(material_ascii || counter_u32_big_endian) (e.g. all-zero material, counter 0 →
3edde0bf…3227). Decrypt the 39-byte sealed_flag (2 blocks):
1def keystream_block(material, ctr):
2 return hashlib.sha256(material.encode() + ctr.to_bytes(4, 'big')).digest()
3
4material = f"{F:08x}:{W:08x}:{e0}:{pads}"
5sealed = bytes.fromhex(d['sealed_flag'])
6ks = b''.join(keystream_block(material, i) for i in range((len(sealed) + 31) // 32))
7flag = bytes(a ^ b for a, b in zip(sealed, ks)).decode()
5. Proof (actual output)
$ python3 qe_solve.py
[1] calibration -> fold rot=(5, 11) walk rot=7
[2] GF(2) rank=80/81 -> fold_mask=1d0cc456 walk_mask=ccc78639 e0=1 pads=0101101101011110
[3] ambiguity resolved by audit_tap (contact A=1) -> e0=0 pads=1010010010100001
[4] model reproduces all 160 z bits: True
[5] compat vectors confirmed: keystream = SHA256(material_ascii || counter_u32_be), 32B blocks
[6] material = 1d0cc456:ccc78639:0:1010010010100001
[6] sealed_flag = 4ab01e45d207a22253b43be9ba5710de791fb9c4be0934273338adede41fc83931c3d42af2d174
FLAG: d4rk{quantum_echo_reuse_breaks_the_pad}
Flag(s)
d4rk{quantum_echo_reuse_breaks_the_pad}
Notes / Pitfalls
- "AES-256-CTR" is the decoy. The task brief's "32-byte block size and a counter
that starts at zero" tempts an AES reading. The
seal_recordcompatibility vectors settle it immediately: the digests are literallySHA256(material_ascii || counter_u32_be), so no AES key exists or is needed. A wide key-derivation sweep (qe_sweep.py) was run before this insight and found nothing. - The transcript is mostly a red herring. The BB84
quantum_transcriptsupplies only the sifted basis convention (samples 0..23) and the singlecontact_A = 1audit bit. It does not carry the key material. - The GF(2) system is rank-deficient.
rank = 80/81, so(e0, pads)come out as one branch of a 2-fold ambiguity. Without the audit tap you cannot tell which; the tap is what makes the recovery unique. - Order matters in the echo.
echois updated beforez_iis recorded (echo_i = echo_{i-1} ^ parity(walk_mask & walk_word_i)), so the accumulatedXOR_{j<=i}term — notj<i— is what goes into the linear system. Off-by-one here gives an inconsistent system. - Reuse is the theme. The "quantum key" is a static register-derived material string reused across blocks; that reuse (rather than any quantum weakness) is what "breaks the pad".