Gradient Ghost federated-learning gradients hiding an AES key in their signs

AI
flag RxR{gr4d13nts_r3m3mb3r_0cd53a9ba7e8}

The handout is gradients.npz, training_metadata.json, and encrypted_flag.bin. The gradients are a federated-learning run: 8 clients, 4 rounds, a 2-layer MLP, 128 tensors total. The metadata says the flag blob is nonce[12] || ciphertext || tag[16], AES-128-GCM, no AAD - so the whole challenge reduces to finding a 16-byte key.

Two details in the metadata do all the work: an integrity block logging the L2 norm of each update before upload, and two ops notes - client_04's upload was retried during rounds 1 and 2 (network flap), and a debug build left a key-exchange side channel enabled.

The anomaly

The integrity manifest is a free : every tensor's shipped norm should match its logged norm. 126 of 128 do, to six decimals. The two that don't are both client_04's fc1.weight, on exactly the retried rounds:

output
client_04__round_01__fc1.weight   reported 0.898626   stored 1.010588   (+12.46%)
client_04__round_02__fc1.weight   reported 0.895678   stored 1.003184   (+12.00%)

Something wrote into those two tensors after the client logged them.

Bar chart of stored versus reported L2 norm for all 128 tensors, flat except two client_04 fc1.weight bars at about +12 percent

Where the write landed

The metadata names the sampler - numpy.random.default_rng(1979290018), 64 coordinates per update. Not hidden, and not a secret: regenerating the first 64 coordinates of a permutation of the 2048-element tensor (np.random.default_rng(1979290018).permutation(2048)[:64]) lands exactly on the corrupted entries. Their magnitudes sit in a tight |v| band from 0.0501 to 0.0698, with random signs - the untouched 1984 coordinates look like the advertised Gaussian DP noise (sigma ~0.02); the sampled 64 are crammed together near the optimizer's learning rate, drawn to look plausible rather than like noise.

Pitfall

I spent most of the clock assuming these 64 values were a secure-agg mask I could regenerate from the known seed, since that's what a coordinate sampler is supposed to be. Sliding windows of uniform(0.05, 0.07) over 400k draws of the post-permutation stream, element-wise and sorted, plus normal and integer-quantised variants - best element-wise match was 0.0115 across a range of 0.02, i.e. noise. Gradient inversion was the other time sink, and there's genuinely nothing to invert: the clean tensors are iid Gaussian (std 0.0198 against a metadata sigma of 0.02, kurtosis 2.87, full rank, round-to-round correlation under 0.05) - synthetic noise, not gradients of real client data.

The values are a carrier

The magnitudes don't reproduce from the seed. The signs do. Every one of the 64 leaked values hands over one bit per coordinate: 64 bits per retried round, two retried rounds, 128 bits total - exactly one AES-128 key.

output
round 1  1000101111101111000010011100000101000010001100010010111010001011
round 2  1001101101001111101100101001111100100110111011000001101000010100
key      8bef09c142312e8b9b4fb29f26ec1a14

GCM is authenticated, so the tag is a clean yes/no test - a wrong key throws InvalidToken rather than returning garbage:

output
RxR{gr4d13nts_r3m3mb3r_0cd53a9ba7e8}

Insight

The handout's "key-exchange side channel" note explains why the bits sit in the signs: if a debug build leaks key material into an update it's supposed to be masking, the sign is the one channel a secure-agg mask can't hide. That reading is inference from the challenge text; what's not inference is that these 128 bits are the only thing in the bundle that authenticates the tag, and the "network flap" retry is exactly why there are two contaminated updates - and therefore exactly enough bits for one key.

solve.py runs the whole chain off the shipped files: metadata seed, sampled coordinates, sign bits, key, decrypt.

Flag

output
RxR{gr4d13nts_r3m3mb3r_0cd53a9ba7e8}