The Best of Two Worlds: Deep Learning-assisted Template Attack

Lichao Wu, Guilherme Perin, Stjepan Picek

Introduction

Side-Channel Analysis (SCA) is a powerful technique used to extract cryptographic keys by observing physical leakages such as power consumption or electromagnetic emissions. Traditionally, the Template Attack (TA) has been the preferred method due to its mathematical rigor and minimal hyperparameter requirements. However, TA often struggles with high-dimensional data and noise, necessitating manual feature engineering by experts.

In recent years, Deep Learning (DL) has emerged as a dominant force in SCA because of its ability to automatically extract features from raw, noisy data. Despite its performance, DL introduces significant complexity, requiring extensive hyperparameter tuning, specific architectures for every dataset, and long training times. This paper proposes a hybrid approach that combines the feature-extraction capabilities of DL with the simplicity of TA, aiming for a "best of both worlds" solution.

Proposed Methodology

The authors introduce a two-stage attack framework designed to be both efficient and easy to deploy, as illustrated in the workflow below.

Overview of the two-stage profiling and attack framework.

1. Similarity Learning via Triplet Networks

Instead of direct classification, the method employs a triplet network to learn data embeddings. The network is trained using three inputs: an anchor, a positive sample (same label as anchor), and a negative sample (different label). It learns to map traces into a low-dimensional space where traces with similar leakage characteristics are clustered together, while dissimilar ones are pushed apart.

Architecture of the triplet network used for similarity learning.

A key innovation is the Hybrid Distance metric. Unlike standard Euclidean distance, this metric incorporates the physical relationship between labels (e.g., Hamming weights). By penalizing the model more heavily when it confuses physically distant labels, the network learns more semantically meaningful features for SCA.

2. Template Attack on Embeddings

Once the triplet network is trained—which surprisingly requires only a single epoch—it serves as an automated feature extractor. High-dimensional raw traces (often thousands of points) are compressed into compact 32-element vectors. These vectors are then processed using a standard pooled Template Attack to recover the secret key.

Experimental Evaluation

The method was tested on three standard benchmarks:

  • ASCAD_F: Masked AES on an 8-bit AVR (fixed key).
  • ASCAD_R: Masked AES with random keys, representing a higher difficulty level.
  • AES_HD: Unprotected hardware AES on an FPGA, characterized by Hamming Distance leakage.

Key Insights and Results

The hybrid approach demonstrates several advantages over standalone DL models:

  • Extreme Efficiency: On the ASCAD_F dataset, the attack required only 64 traces to recover the key, significantly outperforming state-of-the-art (SOTA) CNN and MLP models which required between 160 and 191 traces.
  • Rapid Training: The triplet network achieves high performance in just one training epoch (approximately 20 seconds on a GPU). This eliminates the need for hours of architecture search and hyperparameter tuning common in traditional DL-SCA.
  • Robustness to Countermeasures: The learned embeddings are naturally resilient to desynchronization (jitter). While traditional dimensionality reduction techniques like PCA or LDA fail under these conditions, the triplet-based TA remains effective.

Conclusion

The Deep Learning-assisted Template Attack bridges the gap between traditional statistical methods and modern neural networks. By utilizing triplet networks for rapid, automated feature engineering, the authors provide a tool that is as powerful as complex DL models but as simple to apply as a Template Attack. Future work will explore the scalability of this method to even larger trace windows and its compatibility with other machine learning classifiers.

Summary updated

BibTeX
@article{wu2022best,
  author = {Lichao Wu and Guilherme Perin and Stjepan Picek},
  title = {{The Best of Two Worlds: Deep Learning-assisted Template Attack}},
  journal = {IACR Trans. Cryptogr. Hardw. Embed. Syst.},
  year = {2022},
  doi = {10.46586/tches.v2022.i3.413-437},
}
Figure