How a Neural Network Learns to Break AES

A network trained on a masked chip can sit at chance for many epochs, then suddenly start recovering the AES key. This guide explains what it learned at that moment.

Based on Interpreting Emergent Features in Deep Learning-based Side-channel Analysis (opens in a new tab) by Sengim Karayalçin, Marina Krček & Stjepan Picek (NeurIPS 2025). Written independently of the authors. Their code (opens in a new tab)

Start reading See all chapters

A chip running AES leaks its key through its power consumption. Masking is the standard defence, and deep learning is the attack that breaks it best, and the one least understood. Karayalçin, Krček and Picek looked inside networks at the moment they jump and found the mask shares the defence was supposed to hide.

This guide builds everything needed to follow that result, one chapter at a time, with interactive figures along the way. It assumes no background in side-channel analysis or machine learning.

Contents

Part I · Chapters 1–6 Side-channel basics How a chip leaks its key, and how statistics turn that leak into key bytes.
  • 1 Keys, bytes, and AES

    What a cipher and a key are, how bytes are written in hex, what XOR does, and the one step inside AES that every attack in this guide targets.

  • 2 How a chip leaks its key

    Why a chip draws more current when its bits change, how that turns into a measurable trace, and why the trace depends on the secret key.

  • 3 Attacking one key byte

    Guess the key byte, predict the leakage for each guess, and keep the guess that matches the traces: correlation power analysis on a simulated chip.

  • 4 Hiding and masking

    Hiding makes the leak harder to measure; masking removes the secret from every value the chip handles. How each works, what it costs an attacker, and how attacks get past both.

  • 5 Three masked datasets: ASCADr, ESHARD and CHES_CTF

    Where each dataset comes from, what its file contains, how the profiling and attack sets are split, and what the traces look like.

  • 6 Where the key leaks: signal-to-noise ratio

    How the SNR finds the few samples that depend on the key, what the number means for an attack, and how masking moves the leak from the S-box output into the two shares.

Part II · Chapters 7–10 Neural networks for side-channel How a network learns to attack a chip, and how to tell when it has.
  • 7 The neural network

    What one neuron computes, what it can find on the simulated chip, how the ASCADr network stacks 276,456 numbers into a function from a trace to 256 probabilities, and where in the trace the trained network looks.

  • 8 Training and generalization

    How a network's weights get set, one batch of traces at a time, and how to tell a network that learned the chip from one that memorized its training traces.

  • 9 From probabilities to the key

    How weak, per-trace probabilities over intermediate values add up to a key byte, how to measure the attack with guessing entropy, and why an attack can work while the loss looks bad.

  • 10 Perceived information

    How many bits one trace gives a network about the secret value, how that amount changes over training, and why it can turn negative while the attack still works.

Part III · Chapters 11–14 Opening the network On a simulated masked chip, the tools to read what a network learned at each jump.
  • 11 Learning in jumps

    Why a network trained on a masked chip sits nearly still for several epochs and then learns all at once, shown on a simulated chip where every answer is known.

  • 12 Reading the outputs: logits

    What the network on the masked chip learned to tell apart before and after its jump, read from its scores before the softmax, and why high-versus-low weights come before even-versus-odd.

  • 13 Inside the network: activations, PCA and probes

    Where the network on the masked chip keeps the weights of the two shares, seen with principal components and measured with linear probes, epoch by epoch.

  • 14 Proving it: activation patching

    Pinning one share inside the network on the masked chip, checking that its output then follows the other share alone, and reading the weights of both shares out of it without knowing the masks.

Part IV · Chapters 15–18 What the authors found The same tools on real chips, with the authors' code and checkpoints.
  • 15 ESHARD: one jump, masks we can check

    The steps of chapters 12 to 14 on the paper's ESHARD network: what it learns at its one jump, where it keeps the two shares, and the mask weights read out of it, checked against the published masks.

  • 16 CHES_CTF: two jumps, no masks

    The paper's CHES_CTF network learns high or low first and even or odd at a second jump. Its masks read out with only the labels, and a way to check them when the dataset doesn't store any.

  • 17 ASCADr: the hard case

    The most used benchmark, where the label is the whole byte and the chip leaks bit by bit. What the paper finds, what its published checkpoints reproduce, and what they don't.

  • 18 What it means

    What the three chips have in common, what an evaluator, a designer and an attacker gain from it, and what all of it still depends on.

Part V · Chapters 19–22 Our experiments Analyses the authors didn't run, on data you can generate yourself.
  • 19 Detecting jumps automatically

    A program that finds the jumps in a training curve without anyone looking at it, tested on curves where the answer is known, on the toy chip and on the three real ones.

  • 20 A chip you can generate

    A simulated masked chip whose noise, masking and leakage are chosen in advance, saved in the same files as a real dataset, and what the network does on eight versions of it.

  • 21 The automatic pipeline

    A program that goes from a training curve to the weights of the masks with no one choosing a layer, a plane or a rule, tested on generated chips where the masks are known.

  • 22 Experiments on generated chips

    When does a network learn a masked chip in a jump, when at once, and when not at all? A map over noise, number of shares and leakage, and an answer to the paper's question about masking in a prime field.

How to cite

Cite the original paper:

@inproceedings{karayalcin2025interpreting,
  title     = {Interpreting Emergent Features in Deep Learning-based Side-channel Analysis},
  author    = {Karayal{\c{c}}in, Sengim and Kr{\v{c}}ek, Marina and Picek, Stjepan},
  booktitle = {Advances in Neural Information Processing Systems},
  year      = {2025},
  note      = {arXiv:2502.00384}
}