Has it been Pwned
Side channelLimited impactMedium confidence

Clangover: Clang optimisations reintroduce a secret branch into ML-KEM reference code

Antoon Purnal (PQShield) found that Clang versions 15-18 on x86, at common optimisation levels (-Os, -O1, and -O2/-O3 without vectorisation), recognised the masking idiom in Kyber's poly_frommsg function and compiled it into a secret-dependent branch. A local timing attack on decapsulation then recovered an ML-KEM-512 secret key in under ten minutes in his demo.

A separate source-review date has not been recorded for this historical entry. Corrections.

Broken implementation. The underlying math is not broken by this. The failure is in code, hardware, or how the primitive is used.

Background

The source code was written to be constant-time; the compiler, legitimately optimising, broke the property. The reference implementation was patched by moving the conditional-move into a separate compilation unit so Clang cannot see through it. Clangover joins KyberSlash as evidence that constant-time must be verified on the generated binary, not the source, and that 'cmov' idioms need compiler support or barriers (a motivation for formally verified toolchains like Jasmin and libcrux).

ML-KEM's math is untouched.

Sources

  1. codeantoonpurnal/clangover (proof-of-concept)GitHub, github.com
  2. blogPQShield plugs timing leaks in Kyber / ML-KEM to improve PQC implementation maturityPQShield, pqshield.com