CSCTF 2026Misc
Operation Dawn: The Cipher Lock
This is a textbook Correlation Power Analysis (CPA). The lock computes sbox[passcode ^ stored_code] byte by byte, and the power draw leaks the Hamming weight of that value.
- Competition
CSCTF 2026- Category
- MiscHard
- Source status
- Source-documented · not platform-verified
- Document
- PDF edition3 min read
Brief
The challenge
- Category
- MISC
- Difficulty
- Hard
- Points
- 540
- Author
- Terminal43
- File
traces.npz
Operation Dawn, annex entry 12. An Ash field strongbox uses an electronic cipher lock. Investigators recorded its constructed power-trace corpus while known pass-codes were checked against the stored code. Recover that code; no physical hardware is required.

TL;DR
This is a textbook Correlation Power Analysis (CPA). The lock computes sbox[passcode ^ stored_code] byte by byte, and the power draw leaks the Hamming weight of that value. Correlating the Hamming-weight model against the traces for each of the 256 possible key bytes reveals the stored code one byte at a time. The stored code is the flag.
01
Recon
The archive holds three arrays:
| Key | Shape | Meaning |
|---|---|---|
traces | (1500, 87) float32 | 1500 power traces, 87 samples each |
plaintexts | (1500, 47) uint8 | the known pass-code tried in each trace |
sbox | (256,) uint8 | starts 63 7c 77 7b f2 ..., the AES S-box |
A 47-byte secret, known random inputs, and the AES S-box handed over explicitly all point to the classic first-round leakage model:
leak = HW( sbox[ plaintext[b] ^ key[b] ] )02
CPA
For each byte position b and each guess k in 0..255:
Compute the hypothetical leakage
HW(sbox[p[:, b] ^ k])for all 1500 traces.Compute the Pearson correlation between that vector and every one of the 87 trace samples.
Keep the peak absolute correlation.
The right guess stands out sharply. For byte 0 the correct guess reaches |r| ≈ 0.34 at sample 58, while every wrong guess stays below about 0.12:

Each byte leaks at a different, shuffled sample index (byte 0 at sample 58, byte 1 at 23, byte 2 at 59, and so on). That's a hiding countermeasure meant to stop you from reading a fixed time window, but it doesn't matter because the attack searches every sample for every byte.
03
Results
All 47 bytes were recovered with a wide margin. The correct guess scored |r| between 0.29 and 0.38, and the best wrong guess never went above 0.15:
0 0x43 'C' corr 0.336 2nd 0.119 sample 581 0x53 'S' corr 0.376 2nd 0.132 sample 232 0x43 'C' corr 0.330 2nd 0.108 sample 593 0x54 'T' corr 0.337 2nd 0.112 sample 32...46 0x7d '}' corr 0.342 2nd 0.130 sample 62b'CSCTF{12_the_depot_is_unguarded_at_noon_7d3e90}'Solve script
The script is in cpa.py:
import numpy as npd = np.load("traces.npz")T = d["traces"].astype(np.float64)P = d["plaintexts"]S = d["sbox"]HW = np.array([bin(i).count("1") for i in range(256)])Tc = (T - T.mean(0)) / T.std(0)n = len(T)key = []for b in range(P.shape[1]): k = np.arange(256) H = HW[S[P[:, b, None] ^ k[None, :]]].astype(np.float64) Hc = (H - H.mean(0)) / H.std(0) A = np.abs(Hc.T @ Tc / n) key.append(A.max(1).argmax())print(bytes(key))The figure is generated by render_images.py.
Flag
Flag
CSCTF{12_the_depot_is_unguarded_at_noon_7d3e90}
Source-documented · not platform-verified
Takeaways
Known inputs, a power-trace matrix, and an S-box mean CPA with a Hamming-weight model on
sbox[p ^ k].Shuffling where each byte leaks in time doesn't stop CPA if you correlate against every sample.
With 1500 traces and roughly 0.3 correlation, every byte separates cleanly, so you don't need key ranking or enumeration.