Interpreting Emergent Features in Deep Learning-based Side-channel Analysis

Sengim Karayalçin, Marina Krček, Stjepan Picek

TL;DR

Deep learning-based side-channel analysis (DLSCA) is highly effective at breaking cryptographic hardware but operates as an uninterpretable black box. This paper applies mechanistic interpretability to reverse-engineer how these neural networks bypass cryptographic masking countermeasures. By analyzing sudden jumps in model performance during training, the authors successfully extract hidden cryptographic masks directly from network activations, turning black-box evaluations into informative white-box insights.

What Problem Does This Paper Address?

Side-channel analysis (SCA) exploits physical leakages—such as power consumption or electromagnetic (EM) emissions—to steal cryptographic keys from secure devices. To defend against this, hardware developers use "masking," a countermeasure that splits a sensitive secret variable into multiple random shares (e.g., $s = s_1 \oplus s_2$). To break the security, an attacker must combine the leakage from all shares.

In recent years, deep learning has become the gold standard for SCA because neural networks can automatically locate and combine these shares without manual feature engineering. However, these models act as black boxes. Security evaluation labs can see that a model broke a device, but they cannot tell how it did so or what specific vulnerability it exploited. This limits their feedback to a simple "pass/fail." Standard interpretability methods fail here because side-channel data is incredibly noisy, and the random masks are completely hidden from the evaluator.

Methods

The authors propose a three-step analysis framework rooted in mechanistic interpretability to reverse-engineer the learned representations of DLSCA models:

  1. Logit Analysis: The authors track model training using Perceived Information (PI) to identify sudden performance jumps (phase transitions), which indicate that the network has just learned a key circuit. They analyze the distribution of output logits immediately after these jumps to see which classes the model distinguishes or confuses.
  2. Activations Analysis: They apply Principal Component Analysis (PCA) to the activations of the network's intermediate layers. This reveals low-dimensional geometric structures (like grids) that map directly to the physical leakages of the hidden secret shares.
  3. Activation Patching: To establish a causal link between these geometric structures and the model's predictions, they perform activation patching. By fixing specific principal components to extreme values, they isolate individual shares and successfully reverse-engineer the secret masks without needing any prior knowledge of the device's internal randomness.

The overall pipeline of this approach is illustrated below:

Figure 1: The analysis approach used in this study broadly consists of three major steps. After the performance increases are located using the PI metric, we plot logits to extract relevant features. Using these features, we plot the PCs of the activations and find the structure related to the leakage. Finally, we apply activation patching to reverse-engineer the masks.

Datasets

The framework was evaluated on three widely used public side-channel benchmarks, all implementing AES-128 with Boolean masking:

  • CHES CTF 2018: Power consumption measurements from a masked AES implementation running on a 32-bit ARM Cortex-M4 microcontroller.
  • ESHARD-AES128: Electromagnetic (EM) measurements from a software-masked AES implementation on an ARM Cortex-M4.
  • ASCAD: The standard benchmark for DLSCA, consisting of EM emissions from an 8-bit AVR RISC microcontroller.

Key Insights and Ideas

  • "Grokking" Side Channels: The way neural networks learn to defeat cryptographic masking strongly resembles "grokking" (sudden generalization) observed in toy mathematical models. The network spends many epochs showing no improvement before suddenly discovering the underlying algebraic structure of the masked shares.
  • Hierarchical Feature Learning: In the CHES_CTF dataset, the model learns in two distinct steps. First, it undergoes a phase transition to distinguish high vs. low Hamming Weights (a coarse representation). Only later does it undergo a second phase transition to separate even vs. odd weights, which creates a highly structured latent grid.
Figure 3: Logit analysis (first column) and activation analysis (remaining columns) from models at epoch 50 (top) and epoch 100 (bottom) for CHES_CTF. Legends for activation analysis are shared within columns. The difference in the number of points between the last two columns is due to not plotting the points for classes (HWs) 3, 4, and 5.
  • Weak Universality: Identical geometric structures emerge during sudden generalization across entirely different physical domains (power vs. EM) and hardware implementations. This provides real-world evidence for the "weak universality hypothesis," suggesting that networks naturally converge on similar algorithmic solutions for share recombination.

Key Results

  • Successful Mask Extraction: The authors successfully reverse-engineered the secret mask values directly from the activations of models trained on the CHES_CTF and ESHARD datasets, effectively moving the evaluation from a black-box to a white-box paradigm.
  • Pinpointing Leakage: By calculating the Signal-to-Noise Ratio (SNR) of the recovered shares, they generated graphs that pinpoint exactly where and when in the physical trace the individual secret shares were leaking.
  • Bit-Level Interpretability: For the ASCAD dataset, which uses an identity leakage model rather than Hamming Weight, linear probes revealed that the network specifically targets and exploits the two least significant bits (LSBs) of the S-box input and output to bypass the masking scheme.

Limitations and Future Work

  • Requires a Successful Model: This framework is strictly a post-hoc analysis tool. It requires a neural network that has already successfully learned to break the target device; if the model fails to generalize, interpretability offers limited insight.
  • Complexity with Multi-Bit Models: While mask extraction was highly successful for Hamming Weight models, extracting exact mask values for multi-bit identity models (like ASCAD) is more complex and requires further post-processing refinement.
  • Architecture Scope: The study focused primarily on Multilayer Perceptrons (MLPs) and standard CNNs. Extending these mechanistic interpretability techniques to newer, Transformer-based side-channel architectures remains an open challenge for future work.

Summary updated

BibTeX
@inproceedings{karayalcin2025interpreting,
  author = {Sengim Karayalçin and Marina Krček and Stjepan Picek},
  title = {{Interpreting Emergent Features in Deep Learning-based Side-channel Analysis}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=GjkuXI7hX7},
}
Figure