ML-KEM Side-Channel Risk: KyberSlash and Implementation Security Checks
Standardised ML-KEM and ML-DSA can still leak keys through timing and fault flaws; here is how to test implementations before deployment.
Part of the guide: Post-Quantum Algorithms and Standards: ML-KEM, ML-DSA, HQC and Validation
Most post-quantum planning concentrates on which algorithm to adopt and when. NIST published FIPS 203 (ML-KEM), FIPS 204 (ML-DSA) and FIPS 205 (SLH-DSA) in August 2024, and NIST IR 8547 sets the retirement dates for the classical algorithms they replace. Far less attention goes to a quieter question: is the code that implements these algorithms safe to run on your hardware, against your adversaries?
This article covers implementation security for lattice-based schemes: the attack classes, what the standards ask for, what validation does and does not prove, and how to build a review into procurement and engineering. It does not repeat the material on library support, HSM readiness or FIPS 140-3 validation covered elsewhere on this blog. It addresses a narrower point: a correct, standardised, even validated implementation can still leak secrets.
Why a standardised algorithm is not the same as a safe implementation
A standard defines a mathematical function. An implementation is a specific piece of software or hardware running on a specific processor, built by a specific compiler. Side-channel attacks exploit the gap between the two: how long an operation takes, which memory addresses it touches, how much power it draws, or how it behaves when a fault is injected.
RSA and elliptic-curve cryptography went through the same experience. Timing attacks on RSA were published in the 1990s, and constant-time handling of elliptic-curve scalar multiplication became a standard engineering requirement over the following decades. Post-quantum schemes are younger and their implementations have had less scrutiny. Their arithmetic (polynomial operations, compression, rejection sampling) is different enough that old habits do not transfer automatically.
Adopting ML-KEM is therefore a necessary step, not a sufficient one. Teams should treat implementation assurance as a distinct workstream.
The threat classes that matter
Timing and microarchitectural leakage
If the execution time of an operation depends on secret data, an attacker who can measure it, locally or sometimes remotely, can learn something about that data. The best-known post-quantum example is KyberSlash, disclosed in late 2023. It concerned divisions involving secret-dependent values in several Kyber implementations, including widely reused reference code. On some processors those divisions take a variable number of cycles, which created a timing signal. Affected projects patched, typically by replacing the division with a fixed multiplication-and-shift sequence.
A separate reported issue showed that source code written to be constant-time can still be compiled into code that is not. Certain compiler versions and optimisation settings were reported to introduce secret-dependent branches into a reference ML-KEM build. A review must therefore cover the compiled artefact and the build configuration, not only the source.
Fault injection
Fault attacks deliberately disturb a computation, by voltage glitching, clock manipulation or laser injection, and use the faulty output to recover keys. They matter mainly where an adversary has physical access: smart cards, embedded devices, field-deployed gateways and signing devices in uncontrolled locations. For signatures, deterministic signing can make some fault analyses easier because the same message produces the same internal values on repeat. FIPS 204 specifies hedged signing, which mixes fresh randomness into each signature, as the default and permits a deterministic variant. Hedged signing is generally the safer choice where physical attack is realistic.
Power and electromagnetic analysis
Devices that can be probed during operation may leak through power consumption or emissions. Defences include masking, which splits secret values into randomised shares, and shuffling. Masked ML-KEM and ML-DSA implementations exist and are an active research area, but they add cost and complexity, and maturity varies considerably between vendors. This class is relevant to hardware tokens, secure elements and OT devices more than to cloud servers.
Randomness and memory handling
Key generation and encapsulation depend on a sound random number generator, and a weak source undermines everything else. Separately, secret values left in memory, swap files or core dumps can be recovered by software-only attackers. FIPS 203 expects implementations to destroy intermediate values that could reveal information, which is an engineering obligation as much as a design one.
What the standards require, and what validation does not cover
Protections built into FIPS 203 and FIPS 204
FIPS 203 builds in several protective measures. ML-KEM uses a Fujisaki-Okamoto style transform with implicit rejection: if a ciphertext fails the re-encryption check during decapsulation, the function returns a pseudorandom value derived from a secret rather than an error, so an attacker learns nothing from the failure. The standard also specifies input checks. An encapsulation key must pass a modulus check before use, and a decapsulation key must pass a consistency check. Skipping these checks, which some implementations may do for speed, weakens the guarantees. FIPS 204 similarly specifies its signing modes and the handling of the random seed.
Neither standard gives you a constant-time guarantee for your particular binary. They describe the algorithm and some protective measures; the engineering is left to the implementer.
What CAVP and CMVP tell you
CAVP testing confirms that an implementation produces correct outputs for known-answer and related tests. It does not measure timing leakage. CMVP validation under FIPS 140-3 assesses the module as a whole. FIPS 140-3 is aligned with ISO/IEC 19790 and tested under ISO/IEC 24759, and its non-invasive attack mitigation requirements apply at the higher security levels, with test metrics for such attacks in ISO/IEC 17825. What that means for ML-KEM or ML-DSA in a particular module depends on the security level claimed and on which mitigations the security policy lists.
Read the security policy rather than the certificate headline, and ask the supplier directly which side-channel mitigations apply to the post-quantum algorithms specifically. Validation is evidence, but it is not a substitute for that conversation. The separate post on buying validated ML-KEM covers how to verify the certificate itself.
Which deployments are most exposed
Exposure depends on how the key is used and who can interact with it. A timing attack on decapsulation usually needs many measurements of operations performed under the same secret key, with attacker-influenced inputs. Usage pattern is therefore the first triage question.
| Deployment | Key lifetime | Attacker access | Relative exposure | Priority checks |
|---|---|---|---|---|
| Hybrid key exchange in TLS 1.3 | Ephemeral, typically one use | Network only | Lower | Library version, compiler flags, input checks |
| Static KEM key in an application or HSM for key transport | Long-lived, many decapsulations | Network, possibly co-tenant | Higher | Constant-time evidence, rate limiting, key rotation |
| Signing in a cloud service | Long-lived | Network, co-tenant on shared hosts | Moderate | Hedged signing, constant-time review, tenant isolation |
| Firmware or token signing on a field device | Long-lived | Physical | Higher for fault and power attacks | Masking, fault countermeasures, hedged signing |
| Smart card or secure element | Long-lived | Physical, lab equipment | Highest | Hardware certification evidence, vendor test reports |
The table is a triage aid, not a measurement. Real exposure also depends on your threat model, such as whether co-tenants share your hardware and whether devices leave your premises.
Worked example: a TLS terminator and a key-transport service
A fictional payments organisation plans two post-quantum deployments. The first is a TLS terminator that will offer a hybrid X25519 and ML-KEM-768 exchange. The second is an internal key-transport service that holds a long-lived ML-KEM decapsulation key and receives wrapped keys from partner systems.
The security team applies the triage question from the table. The TLS terminator uses ephemeral keys, so an attacker cannot collect many decapsulations under one secret. The team records the risk as lower and asks for three things: the library version including all KyberSlash fixes, confirmation that encapsulation key checks are enabled, and the compiler and flags used to build the vendor binary.
The key-transport service is different. The key is long-lived, partners can submit ciphertexts at will, and the service may share hosts with other workloads. Here the team asks for more:
- Evidence that decapsulation is constant-time on the deployed CPU family and compiler, such as the output of a statistical timing test or a binary-level analysis.
- A library whose ML-KEM implementation has had formal or independent review. Projects such as libcrux and mlkem-native have published verification work, which gives a useful reference point when comparing candidates.
- Rate limiting and anomaly detection on decapsulation requests, so that the volume of probing an attacker would need becomes visible.
- A key-rotation schedule short enough to cap how many decapsulations occur under one key.
- A decision on whether an HSM will hold the key and, if so, a review of the module security policy and its listed mitigations.
The outcome is a differentiated plan: a lighter check for the first deployment and a documented, evidence-backed review for the second. The organisation avoids over-investing in the low-risk path and under-protecting the high-risk one.
A practical review checklist
These steps fit into existing change and procurement processes. They sit alongside the cryptographic inventory work in a CBOM rather than replacing it.
- Record the implementation, not just the algorithm. Capture library name, version, build flags and compiler in the inventory. An entry that says only ML-KEM-768 cannot answer whether the KyberSlash fixes are present.
- Track advisories. Subscribe to security notices for each library you ship, and treat a post-quantum library advisory with the same urgency as one for TLS or OpenSSL.
- Prefer maintained, reviewed code. Check the project's stated maturity. Some research libraries say plainly that they are for prototyping and evaluation, and they should not reach production without further review.
- Test for timing leakage. Tools such as dudect apply statistical tests to measured execution times, and memory-analysis approaches that mark secrets as uninitialised data can reveal secret-dependent branches and lookups. Run them on the compiled build, on the target architecture.
- Confirm the standard's input checks are on. Verify that the key checks from FIPS 203 have not been disabled for performance.
- Choose hedged signing where physical attack is plausible, and confirm the library default.
- Ask suppliers for mitigations in writing. Add questions on constant-time implementation, fault countermeasures and test evidence to the supplier questionnaire, and keep the answers with the contract file.
- Plan for patching. Make sure you can update a cryptographic library quickly. This is the same agility requirement that applies to algorithm replacement, and it is tested the first time an advisory lands.
Where IQCDL fits
Implementation assurance sits between engineering and governance, and teams often discover that nobody owns it. The IQCDL assessment helps you establish where your organisation stands on skills such as reading a security policy, reviewing a supplier's side-channel claims and recording implementation details in an inventory. The programmes cover the engineering and leadership responsibilities that follow, and the standards page maps the relevant NIST, ISO/IEC and ETSI documents to the competencies we examine.
Frequently asked questions
Does KyberSlash mean ML-KEM is broken?
No. KyberSlash concerned timing behaviour in particular implementations, where secret-dependent operations took variable time. The mathematical design in FIPS 203 was not broken. The lesson is that algorithm selection and implementation assurance are separate questions.
Does FIPS 140-3 validation guarantee side-channel resistance?
Not by itself. CAVP confirms that an algorithm implementation produces correct outputs. CMVP module validation covers a wider set of requirements, but the non-invasive attack mitigations that apply depend on the security level claimed. Read the security policy to see what is covered for the post-quantum algorithms.
Are ephemeral keys in hybrid TLS affected by timing attacks?
The exposure is lower. Timing attacks on decapsulation generally benefit from many attacker-chosen ciphertexts processed under one long-lived key, and ephemeral TLS keys are typically used once. Static KEM keys in key-transport or HSM-backed designs deserve closer scrutiny.
Should ML-DSA signing be deterministic or hedged?
FIPS 204 specifies hedged (randomised) signing as the default and permits a deterministic variant. Hedged signing is generally preferred where fault injection is a realistic threat, because it makes repeated-fault analysis harder. Check which mode your library uses by default.