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

Sengim Karayalçın, Marina Krček, Stjepan Picek · DOI

Abstract

Side-channel analysis (SCA) poses a real-world threat by exploiting unintentional physical signals to extract secret information from secure devices. Evaluation labs also use the same techniques to certify device security. In recent years, deep learning has emerged as a prominent method for SCA, achieving state-of-the-art attack performance at the cost of interpretability. Understanding how neural networks extract secrets is crucial for security evaluators aiming to defend against such attacks, as only by understanding the attack can one propose better countermeasures. In this work, we apply mechanistic interpretability to neural networks trained for SCA, revealing how models exploit what leakage in side-channel traces. We focus on sudden jumps in performance to reverse engineer learned representations, ultimately recovering secret masks and moving the evaluation process from black-box to white-box. Our results show that mechanistic interpretability can scale to realistic SCA settings, even when relevant inputs are sparse, model accuracies are low, and side-channel protections prevent standard input interventions.

Introduction

Side-channel analysis (SCA) exploits unintentional physical signals—like power consumption or electromagnetic (EM) emissions—to steal secret keys from devices during computation. To defend against this, engineers use countermeasures like masking, which splits a secret variable into multiple random "shares" (e.g., $Secret = Share_1 \oplus Share_2$). To find the secret, an attacker must capture the leakage of all shares simultaneously.

Deep learning-based SCA (DLSCA) has become the state-of-the-art for defeating these countermeasures because neural networks can automatically learn to recombine these shares. However, they do so as black boxes. When a security evaluator tests a device and the neural network successfully extracts the key, the evaluator knows the device failed, but they don't know how the network bypassed the masking or what specific physical leakage it exploited. Standard interpretability methods fall short because they require knowing the random mask values, which are hidden by design.

Methodology

The authors apply Mechanistic Interpretability (MI) to reverse-engineer the neural networks. Because the random masks are hidden, standard MI techniques that rely on altering input features won't work. Instead, the authors use a novel pipeline to move from black-box observations to white-box understanding:

  1. Phase Transition Tracking: Monitoring the network during training to identify sudden jumps in performance (generalization spikes), hypothesizing that the network learns specific algorithmic steps at these discrete points.
  2. Logit & Activation Analysis: At these transition points, analyzing output logits and performing Principal Component Analysis (PCA) on internal layer activations to identify emerging geometric structures.
  3. Activation Patching: Forcing one principal component to a specific extreme value during a forward pass. By observing how the model's output changes, researchers can causally verify what the feature represents and extract hidden mask values directly from the network.
Figure 1: Overview of the proposed interpretability pipeline, including logit analysis, activation analysis via PCA, and activation patching for mask recovery.

Key Insights and Results

Emergent Geometric Structures

A central finding is that networks learn in discrete "Aha!" moments, similar to the phenomenon of "grokking." During these phase transitions, the network internally represents hidden secret shares as distinct geometric shapes. When plotting the first few Principal Components of the activations, the two secret shares naturally form a grid-like structure (e.g., the x-axis represents the mask, the y-axis represents the masked value).

Figure 4: PCA of internal activations at Epoch 50, showing the emergence of clusters corresponding to different Hamming Weight (HW) values.

Mask Recovery and Feature Isolation

The authors successfully reverse-engineered hidden mask values directly from activations using activation patching, without prior knowledge of the masking randomness. For the CHES_CTF and ESHARD datasets, patching one principal component to an extreme value (e.g., forcing it to represent a Hamming Weight of 0) caused the model's output to perfectly reflect the value of the other secret share.

Weak Universality

The same internal structures (like diagonal splits for high/low Hamming weights) emerged across different datasets, physical domains (power vs. EM), and hardware implementations. This suggests neural networks learn fundamental, universal algorithms to solve the masking problem regardless of the specific physical implementation.

Discussion and Future Work

While effective, the approach is currently post-hoc and requires significant manual effort to identify structures in PCA plots. Future work aims to automate feature discovery using metrics like KL-Divergence and extend the framework to Transformer-based architectures. These insights could lead to better countermeasures, such as moving away from Boolean masking if it creates easily exploitable internal structures in neural representations.

Summary updated

BibTeX
@inproceedings{karayalcn2025interpreting,
  author = {Sengim Karayalçın 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