CSCTF 2026Cryptography
Operation Dawn: The Courier's Keys
Every radio builds its RSA key from a Mersenne Twister seeded with (power_up_epoch_seconds << 16) | serial.
- Competition
CSCTF 2026- Category
- CryptographyMedium
- Source status
- Source-documented · not platform-verified
- Document
- PDF edition3 min read
Brief
The challenge
- Category
- Crypto
- Difficulty
- Medium
- Points
- 298
- File
fleet-provisioning.pcap
Operation Dawn, annex entry 01. Coalition signals intercepted the Ash Army field-radio fleet during a simultaneous cold start and captured the encrypted order sent to one unit. Recover the message from the supplied packet capture.
TL;DR
Every radio builds its RSA key from a Mersenne Twister seeded with (power_up_epoch_seconds << 16) | serial. The serial is sent in clear text, and the boot time is only a few seconds before the radio's registration packet. Brute-forcing that timestamp regenerates p and q for the target radio, which decrypts the order:
REG timestamp → brute-force boot epoch → MT19937 → p, q → RSA decrypt → flag01
Recon
The capture holds 86 packets. Most are background noise (ARP, DNS, HTTP to terminal43.ro, pings). The interesting traffic is UDP port 7000:
Packet 1: a broadcast from the key unit
10.23.0.2that documents the key generation:
ASH ARMY KEY UNIT :: provisioning profileon power-up each set derives its key from the boot clock and its set serial: seed = (power_up_epoch_seconds << 16) | serial generator = MT19937 seeded with that value draw two 512-bit primes in turn: take a 512-bit candidate with top and bottom bits set, keep the first that is prime; these are p then q modulus N = p * q, public exponent 655379 ×
REG serial=<s> e=65537 N=<hex>: each radio registers its public key, and the key unit repliesACK.Packet 83:
ORDER serial=6631 C=<hex>, the encrypted order, sent to radio10.23.7.11.
02
The weakness
All of the key's entropy comes from the seed. The serial is in the packet, so the only unknown is the boot time in seconds. MT19937 is deterministic, so the right timestamp regenerates exactly the same p and q.
The nine moduli share no common factors, so a batch GCD attack doesn't work here. The timestamp has to be brute-forced.
03
Finding the boot clock
The capture has two clocks, and one of them is a decoy:
The ICMP payload timestamp (
0x6acf983f) and the HTTPDate:header both say 14 Oct 2026 14:57:03. That value never changes between packets that are hours apart, so it's a decoy.The pcap timestamps (around
1699990000) are the radios' real clock.
A radio generates its key at power-up and registers right after, so the boot epoch falls just before its REG packet. Radio 6631 registered at 1699994070. Searching backwards from there:
Python's
random.Random(seed)is MT19937, andgetrandbits(512) | (1 << 511) | 1gives each candidate.Primality tests are slow, so the script skips them and checks whether the candidate divides N. The first prime is
p, and it shows up within a few hundred draws.
The hit comes at epoch 1699994067, 3 seconds before the REG packet.
04
Decrypt
q = N // pd = 65537^-1 mod (p-1)(q-1)m = C^d mod Nwhich gives CSCTF{01_advance_on_the_mill_a7c3f1}.
Solve script
solve.py parses the pcap, finds the ORDER target and its REG packet, brute-forces the boot epoch over the 2 hours before registration in parallel, and decrypts:
$ python solve.pyserial : 6631epoch : 1699994067 (3s before REG)flag : CSCTF{01_advance_on_the_mill_a7c3f1}Flag
Flag
CSCTF{01_advance_on_the_mill_a7c3f1}
Source-documented · not platform-verified
Takeaways
Never seed key generation from a predictable source such as a clock or a serial number. A non-cryptographic PRNG like MT19937 only makes it worse.
An RSA key has no more entropy than its seed. Here that was about 12 bits of timing uncertainty.
When a capture contains more than one clock, work out which one the device actually used. Constant timestamps across packets hours apart are fake.