CSCTF 2026 · Reverse engineering · 540 pts
HELIOS-RTU.
A grid RTU's emulated AVR firmware exposes a raw AES-ECB oracle that refuses one byte value — and that one refusal isn't enough to stop a forged MAC.
| Event | CSCTF 2026, Operation Dawn (online jeopardy) |
|---|---|
| Category | Reverse engineering |
| Points | 540 |
| Status | Solved during the event |
| Target | Live emulated ATmega328P console |
TL;DR. The RTU's console gives a hidden svc client with a sign command that is a raw AES-128-ECB encryption oracle, refusing only inputs whose first byte is 0xCC. svc exec checks a CBC-MAC built from exactly two AES calls over a frame containing a live nonce. By XOR-chaining two oracle calls, you can forge a valid tag for a frame you never had the key to sign directly.
Challenge
A HELIOS grid RTU exposes a web console over an emulated ATmega328P. The goal is a service token for a correctly authenticated control directive carrying the unit's live nonce.
First look
The console is an xterm over WebSocket with commands help, bench, wire, avrdude, apt. bench lists programming adapters (avrisp, usbserial, jtagice, dwprobe); EEPROM notes say JTAG is absent and debugWIRE is fused off, so ISP gives the signature and fuses while the serial bootloader handles flash and EEPROM.
wire usbserial USB:USB then avrdude -c arduino -p m328p -P /dev/ttyUSB0 -U signature:r:-:hex confirms signature 0x1e950f = ATmega328P. The bootloader dumps the 32KB flash (2KB used) and EEPROM, including the operator notes. apt install svc installs a hidden service client exposing svc nonce|sign|exec.
Reversing the firmware
The 2KB application implements an xorshift32 nonce generator, an AES-128 key schedule, and an AES encrypt routine keyed from 16 bytes copied out of masked boot flash (physically unreadable even via the bootloader). svc sign is a raw AES-ECB encryption oracle over any 16-byte block — except it refuses any block whose first byte is 0xCC. svc exec checks a frame against:
tag == AES_K( AES_K(frame[0:16]) XOR frame[16:32] )with frame[16]=0xCC, frame[17]=0x0A, and frame[18:26] required to equal the device's current live nonce — i.e. a two-block CBC-MAC over a frame you can't just construct and sign, because block two always starts with the forbidden byte.
Forging the tag
Get the live nonce. Pick any P1 and sign it: C1 = sign(P1). Build P2 = 0xCC 0x0A || nonce || zero padding (the block the MAC check requires) and compute Q = C1 XOR P2. Because Q is just an XOR of attacker-chosen bytes with an oracle output, it almost never starts with 0xCC — and if it does by chance, re-roll P1 and retry. Sign Q: tag = sign(Q). Now exec(P1 || P2, tag) verifies, because:
AES_K(P1) XOR P2 = C1 XOR P2 = Q
AES_K(Q) = tagwhich is exactly the two-block CBC-MAC the device computes — forged without ever learning the key, using only two oracle calls chosen to dodge its single filtered byte. The device returns the service token.
Flag
CSCTF{ef1zkbBI2Gp9XaiPqaQNGSkF}What I took from it
- A signing oracle that filters on one input byte only blocks the literal blocked value, not every message that would ever need it — if you can reach that value through an XOR of two legitimate oracle calls instead of typing it directly, the filter does nothing.