NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Towards Automated Detection of Single-Trace Side-Channel Vulnerabilities in Constant-Time Cryptographic Code

Ferhat Erata, Ruzica Piskac, Victor Mateu, Jakub SzeferarXiv 2023 · DOI

TL;DR

Pascal (Power Analysis Side Channel Attack Locator) is a new automated tool that detects power side-channel leaks in cryptographic binaries, even when the code is written in a "constant-time" style. By combining symbolic execution with optimization solvers, it successfully identified 30 vulnerabilities in post-quantum cryptographic implementations, proving that mathematical security doesn't always translate to physical security.

What Problem Does This Paper Address?

Even if a cryptographic algorithm is mathematically "perfect," its physical implementation can betray it. Modern developers use constant-time programming to prevent timing attacks—ensuring every operation takes the same amount of time regardless of the secret key. However, this doesn't stop power side-channel attacks.

In CMOS circuits, power consumption varies based on the data being processed (specifically the number of bits flipping or the "Hamming weight" of the data). An attacker with an oscilloscope or access to power-related performance counters can "see" the secret data through these power fluctuations. Detecting these leaks manually is a nightmare: it requires auditing assembly code to figure out which specific instructions might be leaking information based on their operands.

Methods

The authors developed Pascal, a tool that automates this audit process at the binary level. Here’s how it works:

  1. Binary Lifting: Pascal takes a compiled binary and "lifts" it into an Intermediate Representation (VEX IR) using the angr framework. This allows it to analyze the code regardless of the target architecture (ARM, x86, etc.).
  2. Relational Symbolic Execution: Instead of analyzing one execution path, Pascal models two traces simultaneously. It introduces symbolic variables for secrets and checks for "data-oriented differences" between the two traces.
  3. Leakage Modeling: It uses two primary models:
  4. Hamming Weight/Distance: It calculates the maximum and minimum possible differences in the number of set bits (1s) for sensitive operands.
  5. $\omega$-class Sampling: It uses Shannon entropy to quantify how much information a single power trace reveals about a secret.
  6. Optimization Queries: Pascal turns the search for vulnerabilities into a math problem. It uses SMT solvers (like Z3 and CVC5) and optimization solvers (like OptiMathSAT) to find "Points of Interest" (PoIs)—specific instructions where the power difference is maximized.
Figure 5: Pascal’s simplified tooling workflow under differential Hamming weight and 𝝎-class sampling models.

Datasets

The researchers evaluated Pascal on a suite of 30 implementations of cryptographic algorithms, focusing heavily on Post-Quantum Cryptography (PQC) candidates from the NIST standardization process, such as:

  • Lattice-based: Kyber, NTRU, NewHope, FrodoKEM.
  • Elliptic Curve: SIKE.
  • Lightweight Crypto: SPECK, SPARX, Sparkle.
  • Libraries: mbedTLS.

They tested these across various architectures, including ARM Cortex-M4, M0, AVR XMEGA, and MSP430.

Key Insights and Ideas

  • The Compiler is a Wildcard: The paper demonstrates that compiler optimizations (e.g., -O0 vs -O3) can drastically change the side-channel profile of a program. An instruction that looks safe in C code might be transformed into a highly leaky assembly instruction like sbfx (Signed Bit Field Extract).
  • Leakage Continuity: A vulnerability at one instruction often "bleeds" into the next. If an instruction reduces the possible values of a secret to just two classes (like 0 and -1), subsequent instructions operating on that data will also exhibit highly distinguishable power signatures.
  • Determiners: The authors define a "determiner" as an intermediate value where the domain is significantly shrunk based on a secret bit. These are the "smoking guns" of single-trace attacks.
  • White-Box vs. Black-Box: Unlike existing "leakage simulators" that require profiling a specific physical device, Pascal is a white-box tool. It finds vulnerabilities based on the logic of the instructions, making it architecture-agnostic.

Key Results

  • High Recall: Pascal successfully identified all 16 previously known single-trace vulnerabilities in the tested PQC algorithms.
  • New Discoveries: It found 14 new or variant vulnerabilities in libraries like mbedTLS and PQC implementations that had not been formally reported before.
  • Efficiency: The tool analyzed 24 complex functions in approximately 2.5 hours.
  • Empirical Validation: The authors used a ChipWhisperer (a hardware security evaluation board) to confirm that the PoIs Pascal flagged actually produced distinguishable power spikes in real hardware.
Figure 4: A single-trace template-based attack. The trace in green exposes the differences between the mask value being either 0 or -1. The reference trace in gray is a template having the max. Hamming weight difference.

Limitations and Future Work

  • Scalability: Because symbolic optimization is computationally expensive, Pascal currently analyzes functions or code regions individually rather than whole programs at once.
  • Function Summaries: The tool sometimes uses "function summaries" to skip known-safe code. If these summaries are incorrect, it could lead to false negatives.
  • Single-Trace Focus: While powerful, the current version focuses primarily on single-trace attacks. The authors note that multi-trace vulnerabilities (which require statistical analysis over many executions) are a potential area for expansion.
  • Future Directions: The team plans to implement concurrent optimization queries to speed up analysis and explore more complex masking countermeasures.

Summary updated

BibTeX
@misc{erata2023towards,
  author = {Ferhat Erata and Ruzica Piskac and Victor Mateu and Jakub Szefer},
  title = {{Towards Automated Detection of Single-Trace Side-Channel Vulnerabilities in Constant-Time Cryptographic Code}},
  year = {2023},
  eprint = {2304.02102},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2304.02102},
}
Figure