← Back to section · Security Risk & Assessment
The Implementation-Flaw Landscape of PQC: Sound Algorithms, Fragile Code
From the KyberSlash timing issue to decapsulation failures, fault injection, randomness quality and the constant-time discipline — a defender's map of where post-quantum implementations actually break.
The algorithm passed review; the code has not
ML-KEM and ML-DSA survived years of public cryptanalysis. But once they are deployed, the centre of risk shifts from mathematics to engineering. History repeats the lesson: RSA fell to padding oracles, ECDSA to nonce reuse, AES to cache timing — the algorithm itself is rarely the first thing to break. Post-quantum schemes are structurally more complex (polynomial arithmetic, rejection sampling, hash trees), so the implementation error surface is larger, not smaller. This article maps four risk areas confirmed by published research, from the defender’s side only.
Timing: the KyberSlash lesson
In late 2023, Daniel J. Bernstein disclosed a family of timing issues dubbed KyberSlash: in several ports and wrapped implementations of Kyber (the predecessor of ML-KEM), the decapsulation path contained divisions by secret values. Division timing on common processors depends on the operands, so response times leak secret-dependent information; in settings where an attacker can measure timing repeatedly and remotely, published research showed such leakage can accumulate toward key recovery.
The point is not any single function — it is discipline. Most affected code was third-party ports rather than the reference implementation, which shows that “the algorithm is standardised” does not imply “this code is constant-time.” The countermeasures are old but must actually be applied: no variable-time operations (division, data-dependent branches, early exits) on secret-dependent paths; continuous timing-leak testing with tools such as dudect; and a preference for audited constant-time implementations over home-grown ports.
Decapsulation failures and fault injection
Lattice-based KEMs have a structural feature: decapsulation has a very small but non-zero failure probability (even a legitimate ciphertext can yield a wrong shared secret; for ML-KEM the failure rate is designed at roughly 2^-138 or below). Published research notes that failure events are statistically correlated with the secret, which makes “induce and observe failures” an analytic angle; fault injection — perturbing computation under controlled physical conditions and observing anomalous outputs — is a related research area. It should be stressed that such work generally presumes physical access to a device or mass observation of failures: a high real-world bar, and a topic of research and evaluation, not an operational recipe.
The engineering countermeasures are clear. First, at the protocol layer, treat decapsulation failure as an ordinary error: expose no distinguishable “failure oracle,” and make retry and renegotiation behaviour leak nothing about failures. Second, prefer mature libraries that already incorporate failure-rate analysis and mitigations. Third, for physically exposed high-value devices, apply the standard side-channel evaluation practice — masking, redundant checks — and include it in procurement criteria.
Randomness: an old problem in a new vehicle
PQC consumes more high-quality randomness than the classical schemes it replaces: key generation, encapsulation randomness, and ML-DSA’s signing randomness and rejection sampling all draw on it. History (the Debian OpenSSL incident, ECDSA nonce reuse) shows entropy failures are catastrophic and hard to notice. Defensive points: draw randomness from the operating system’s CSPRNG and confirm it is fully initialised before generating keys; beware snapshot cloning and low-entropy boot in virtualised and embedded environments; and understand the trade-off of deterministic signature variants (such as ML-DSA’s deterministic mode) — they remove the signing-time dependence on randomness, but stake everything on key secrecy and implementation correctness.
Masking, validation, testing: make countermeasures a process
- Masking: splitting secrets into random shares computed on separately is the standard engineering defence against power and electromagnetic analysis. It costs performance and complexity, and belongs in smartcards, secure elements and other physically exposed settings.
- Input validation: check the format and range of public keys and ciphertexts before core operations, so malformed inputs cannot reach undefined paths. FIPS 203 itself mandates checks such as modulus verification of encapsulation keys; implementations must not skip them.
- Known-answer and interoperability testing: validate against official vectors (e.g. NIST ACVP). Sampling distributions and the NTT are the two places implementations most often go wrong.
- Continuous audit: track security advisories for the libraries you ship (the KyberSlash fixes arrived as patches) and put cryptographic libraries under the same patch management as the operating system.
A final institutional backstop is worth noting: validated modules. Procurement regimes such as FIPS 140-3 validation through NIST’s Cryptographic Module Validation Program test implementations against their standards — including, for the new PQC standards, the checks and self-tests the specifications require. Validation is not a guarantee against side channels, and certificates lag the research frontier, but requiring validated modules in procurement is one of the few levers that reliably raises the implementation floor across an entire supply chain rather than team by team.
Procurement and acceptance: write implementation security into the contract
Most organisations do not implement PQC themselves; they buy libraries, modules and devices, which makes procurement and acceptance the last gate for implementation security. Actionable requirements include: asking vendors for a statement on constant-time implementation and any third-party evaluation results (for example, whether side-channel test validation has been passed); requiring cryptographic modules to hold, or be formally in process for, validation such as FIPS 140-3, with the covered algorithms and versions stated explicitly; writing “track upstream security advisories and ship patches within an agreed window” into the contract as an obligation rather than assuming goodwill; and, at acceptance time, independently re-testing with official test vectors and timing-leakage tools instead of checking functional interoperability alone.
Beware version drift: the version evaluated at bid time may not be the version delivered, and later upgrades can silently change implementation properties. Putting cryptographic-library and firmware version changes under change control — with re-confirmation required — is what makes a one-time procurement assessment stay valid. The same checklist applies inward for in-house systems: code-review checklists should add PQC-specific items such as secret-dependent division, data-dependent branches, and distinguishable failure returns.
Summary
Post-quantum migration does not end with swapping an algorithm. KyberSlash is the reminder: the standard provides a mathematical guarantee, but the security level a system actually gets is set by implementation quality. Constant time, failure handling, randomness, validation and testing — the engineering discipline demanded in the classical era applies in the PQC era, only more strictly.
References
- Bernstein, D. J., KyberSlash: timing attacks on Kyber implementations, 2023. https://kyberslash.cr.yp.to/
- NIST, FIPS 203: Module-Lattice-Based Key-Encapsulation Mechanism Standard, 2024. https://csrc.nist.gov/pubs/fips/203/final
- NIST, Post-Quantum Cryptography Standardization project page (side-channel and implementation-security discussions across the PQC process). https://csrc.nist.gov/projects/post-quantum-cryptography
- NIST, ACVP test vector service. https://acvp.nist.gov/
Tags: implementation securityKyberSlashconstant-timeside channelsfault injection