
As quantum computing advances, the cryptographic community is proactively developing algorithms believed to resist quantum attacks—post-quantum cryptography (PQC). Among these, lattice-based cryptosystems stand out due to their strong security foundations and efficient performance.
However, even the most sophisticated mathematical hard problems are vulnerable if the implementation leaks side-channel information. Side-channel analysis and attacks (SCA) are a class of implementation attacks that bypass mathematical theory, exploiting physical phenomena such as power consumption, electromagnetic leaks, and timing variances to extract secret keys.
This blog post provides an in-depth analysis of how side-channel attacks threaten lattice-based post-quantum schemes. We cover foundational SCA concepts, how PQC is exposed, recent research highlights, and hands-on examples—bridging beginner concepts with advanced practitioner know-how.
Side-channel attacks are a category of security attacks where attackers gain information about cryptographic operations by measuring physical parameters of a device during computation.
Example: If a cryptographic device spends less time when a secret bit is '0' than when it is '1', an attacker may repeatedly measure computation times on known inputs to reconstruct the secret.
Quantum computers, once realized, can break traditional public-key schemes (e.g., RSA, ECC) with algorithms like Shor’s. Post-quantum cryptography is an effort to devise encryption/signature schemes immune to quantum attacks.
A lattice is a grid of points in n-dimensional space with a regular pattern. Cryptosystems use hard lattice problems:
NIST PQC Project chooses lattice-based schemes due to their efficiency and scalability.
Despite their mathematical robustness, lattice-based schemes are implemented on physical hardware—subject to SCA. Unlike traditional schemes, lattice cryptography uses operations like polynomial multiplication, discrete Gaussian sampling, and modular arithmetic, all of which can leak information if not carefully implemented.
Kyber-Key Encapsulation Mechanism relies on polynomial arithmetic and modular reductions. Research (ACM, 2022) has demonstrated:
In the Dilithium signature, rejection sampling leaks can be observed if the sampler’s decision logic depends on secret data and is not constant-time.
Conventional SCA analysis requires significant expertise. With machine learning (ML), attackers can automate the feature extraction and classification process—potentially breaking more complex or noisy implementations.
Suppose you have a dataset of power traces during a sampling step of a PQC KEM:
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
# Assume `traces` is a NxT array (N=samples, T=time points)
# Assume `labels` is a N-array of secret bits (0 or 1)
traces, labels = np.load('power_traces.npy'), np.load('labels.npy')
X_train, X_test, y_train, y_test = train_test_split(traces, labels, test_size=0.2)
clf = RandomForestClassifier(n_estimators=100)
clf.fit(X_train, y_train)
print("Test accuracy:", clf.score(X_test, y_test))
This approach can reveal secret coefficient bits (e.g., binary secret vector segments) from polynomial or LWE secret values.
Getting hands-on with side-channel analysis illustrates the real risk. Let's overview typical SCA toolchains and code.
# Install ChipWhisperer software toolkit
pip install chipwhisperer
Python script to acquire traces from a microcontroller running Kyber decryption:
import chipwhisperer as cw
scope = cw.scope()
target = cw.target(scope, cw.targets.SimpleSerial)
traces = []
for i in range(100):
scope.arm()
target.simpleserial_write('d', b'\x00' * 32) # send dummy ciphertext
ret = scope.capture()
if ret:
traces.append(scope.get_last_trace())
Save to disk for later ML analysis.
Suppose you have exported raw trace data.
Bash: Extract mean current draw from traces
grep -oP 'Trace: \K[0-9 .]+' traces.log | awk '{total += $1; count += 1} END {print total/count}'
Python: Parse CSV traces for plotting/analysis
import matplotlib.pyplot as plt
import pandas as pd
df = pd.read_csv('traces.csv')
plt.plot(df['time'], df['power'])
plt.title('Power Trace - Lattice-Based PQC Decrypt')
plt.xlabel('Time (ns)')
plt.ylabel('Power (mA)')
plt.show()
In the real world, attackers may obtain thousands of traces and use statistical tools or ML to extract key bits.
CPA Example (Python):
import numpy as np
from scipy.stats import pearsonr
# traces: NxT array; hypotheses: possible key guesses, input_data: plaintext/ciphertexts
def cpa(traces, input_data, key_guesses):
max_corr = -1
best_guess = None
for k in key_guesses:
hyp = hamming_weight(pqc_operation(input_data, k)) # model power for guess
corrs = [pearsonr(traces[:, t], hyp)[0] for t in range(traces.shape[1])]
if max(abs(corrs)) > max_corr:
max_corr = max(abs(corrs))
best_guess = k
return best_guess, max_corr
Given the demonstrated risk, how can implementers protect lattice-based PQC from SCA?
For Kyber, prefer AVX2-based constant-time polynomial arithmetic routines (see official PQClean repo). For random sampling, use hardened constant-time samplers, not naive table-based ones.
As PQC sees wider adoption:
While lattice-based post-quantum cryptography promises theoretical safety against quantum adversaries, side-channel analysis exposes profound practical risks. Implementation-specific physical leakage—power, EM, timing—can allow attackers to recover secrets with careful analysis. New machine learning methods automate and improve these attacks. Robust, side-channel safe implementations require diligence, constant-time code, hardware/firmware design, and rigorous testing.
As post-quantum schemes are deployed in smartcards, mobile chips, and the cloud, side-channel resilience must be as central as the cryptographic strength of core algorithms.
Side-channel Analysis of Lattice-based Post-quantum Primitives
https://dl.acm.org/doi/10.1145/3569420
The Risk of Side-Channel Attacks on Post-Quantum Cryptography
https://www.ledger.com/blog-risk-side-channel-attacks-post-quantum-cryptography
Machine Learning and Side-Channel Attacks on Post-Quantum Cryptography
https://eprint.iacr.org/2025/1754
NIST PQC Project
https://csrc.nist.gov/Projects/post-quantum-cryptography
PQClean: Clean and side-channel secure reference implementations
https://github.com/PQClean/PQClean
ChipWhisperer: Open-source SCA/FI tools
https://chipwhisperer.io/
If you found this content valuable, imagine what you could achieve with our comprehensive 47-week elite training program. Join 1,200+ students who've transformed their careers with Unit 8200 techniques.