Part IV Chapter 16
CHES_CTF: two jumps, no masks
CHES_CTF is the network this guide started from. Chapter 10 measured its perceived information at every epoch and found the curve that set off Part 3: a slow rise to about 0.08 bits, almost 40 epochs of nothing, then a climb to 0.7 bits between epochs 77 and 85. The traces, from Chapter 5, record the current drawn by an ARM Cortex-M4 running a masked AES, 15,000 samples each. The network is the one ESHARD used in Chapter 15, four layers of 40 neurons with ReLU bends, trained for 200 epochs on the Hamming weight of the S-box output.
There is one thing CHES_CTF doesn’t have: masks. The dataset stores none, so every reading below has to be checked some other way. This chapter finds one, tests it on the toy chip, and uses it.
Two steps
As in Chapter 15, the information splits into what the network knows about high versus low weights and about even versus odd:
The two increases learn different things. The first, slow one is all high or low: by epoch 50 the network has 0.08 bits about it and nothing about parity. Through the plateau that doesn’t change. Then, from epoch 77, the information about parity goes from nothing to 0.58 bits at epoch 85 and 0.70 at epoch 100, while high or low barely moves, from 0.08 to 0.12. The second jump is the network learning even from odd.
That is the order the toy chip followed in Chapter 12, with the steps much further apart: there the plateau lasted a few epochs, here almost 40. The dips after the jump are the ones Chapter 10 discussed. At epoch 166 the network really loses what it had, and gets it back within about ten epochs.
The logits show the same two steps:
At epoch 50 the rows only shade from high to low. At epoch 100 a checkerboard covers the whole table: averaged over true weights 1 to 7, the network scores labels of the trace’s own parity 4.0 higher than the others, against 0.01 at epoch 50. On the toy chip the same difference reached 1.0.
The plane
Before the bend, the first layer of the network at epoch 100 is almost flat: its first two principal components hold 96% of the variation, 60% and 36%. The search from Chapter 15, which tries every pair among the first six components and every angle, picks those two at every epoch from the sixth on. Here are the attack traces on that plane:
The dots gather in a lattice of separate clusters. That is what the share-weight table predicts if the network holds both weights sharply: one cluster for each pair of weights, the rare pairs near the edges barely visible. On the left, the high-or-low pattern of the table: low labels in two opposite corners, high in the other two. On the right, the parity rule from Chapter 12, that HW(m) + HW(s) always has the parity of the label, made visible: moving one cluster along either axis changes one weight by one and flips the parity, so even and odd alternate like a chessboard. The paper shows the same grid and counts about nine changes of parity across it, one for each weight.
Reading the masks
Pinning each axis in turn, exactly as in Chapter 14, gives two weights per trace. Their correlation with each other is +0.06. That is what a mask and a masked share should look like: the mask is drawn at random, so knowing one tells nothing about the other.
On ESHARD the published masks told us how good the readings were. Here nothing does, unless the rule above can.
A check that needs no masks
If both readings are exact, their sum has the parity of the label on every trace. A reading off by one flips the parity, and two readings off by one flip it back. So suppose every wrong reading is off by exactly one, and that each of the two is exact on a fraction q of the traces, independently. The sum then has the right parity when both are right or both are wrong, so the fraction of traces where it does, the agreement a, is
a = q² + (1 − q)²
q = (1 + √(2a − 1)) / 2
Agreement can be counted from the labels alone. Before trusting the formula on CHES_CTF, we can test it on the toy chip of Part 3, where the masks are known. The measured column gives the mask’s reading first, then the masked share’s:
| epoch | agreement | exact, by the formula | exact, measured |
|---|---|---|---|
| 5 | 0.660 | 0.78 | 0.78 and 0.79 |
| 15 | 0.773 | 0.87 | 0.87 and 0.87 |
| 40 | 0.788 | 0.88 | 0.88 and 0.88 |
From epoch 2 to 40, the formula is within 0.01 of the measured average of the two at every epoch. Its assumption holds there: at most three traces in a thousand have a reading off by more than one. After the first epoch, when 2% do, it overestimates by 0.03, the way it should fail.
On CHES_CTF at epoch 100 the two readings agree with the label’s parity on 85.0% of the attack traces. By the formula, each is exact on about 92% of them, better than on the toy chip.
Three limits. The check is blind to orientation: flipping a reading to 8 − w changes the sum by an even number, so the parity doesn’t change, and the global flip of Chapter 15 stays open here. It assumes the errors are small: a reading off by two keeps the parity, so if that were common the formula would overestimate, as it does on the toy’s first epoch. And it can’t tell a poor reading from a useless one. Agreement can’t fall below one half, and near one half the formula has nothing to work with. On ESHARD agreement is 51%, a coin toss, as Chapter 15 found with the masks.
Epoch by epoch
The check can be run at every epoch:
Before epoch 10 the readings are no better than chance. Through the first increase and the long plateau, agreement creeps up to about 0.6, roughly 70% exact by the formula, while the network’s information about parity stays at zero. At the second jump it rises to about 0.85 and stays there.
So the two weights are in the first layer, and readable, long before the network uses their parity, and they get sharper over the plateau. The readings at epoch 50 and at epoch 100 pick out nearly the same weights: they correlate 0.95 and 0.90. This is what the paper argues: the second jump builds on the first, refining the high-or-low features into clean weights until parity can be read from them. The check adds a number to it. One caution: patching reads through the whole network, so part of the jump in agreement may come from the later layers getting better at using the weights, not from the first layer alone.
After the collapse at epoch 166, perceived information recovers fully, to 0.95 bits by epoch 199, but agreement only to about 0.77. We haven’t looked into why.
Where they leak
The two readings leak in separate parts of the trace. The first is strongest at sample 4,566, with a signal-to-noise ratio of 2.9, and above 1 in five other stretches of the trace between samples 566 and 5,311. The second leaks only near the end: at sample 13,456, with a ratio of 6.4, and at 12,365 and 13,582, with 2.7 and 3.3. Across most of the trace both stay around 0.001. Every peak of the first comes before every peak of the second.
So the first reading is the mask. The paper finds the same order from its own readings: spikes for the mask first, which it attributes to loading the mask and some pre-processing before the encryption, then, later, for the masked share Sbox[p ⊕ k] ⊕ m. A value that leaks in fifteen places is a value the chip handles many times, which fits that description.
What this adds to Chapter 15: on a chip that stores no masks, a network trained only on labels holds the weights of mask and masked share in two directions of its first layer; reading them back out gives weights whose parity agrees with the label, so they are about 92% exact; and the readings leak where a mask and a masked share would. Chapter 17 turns to ASCADr, where the labels are whole bytes and none of this works as cleanly.