Security › kem-15 · Constant-time review · Performance: x86_1 · arm_1
FLIT (kem-15)
| Candidate | FLIT |
|---|---|
| Family | Lattice (NTRU-like KEM) |
| Archive | FLIT.zip (SHA-256: 6c560f434b347fbac8334f55b9ba2838cb1cf885d5aa25e95acb66ed6c6de0fe) |
| Specification | kem-15-spec.pdf PDF |
| Performance | x86_1 · arm_1 |
kem-15-1: FLIT512 reference and optimized implementations silently derive different keys
| Severity | Low |
|---|---|
| Scope | implementation |
| Status | Confirmed |
| Affected | Submitted FLIT512 reference and AVX2 implementations |
| Discovery | Trivial |
| Exploitation | Mixing the two official implementations causes silent session-key mismatch |
| Credit | Sun Shuzhou, with GLM-5.3 assistance |
| Date | 2026-09-29 |
Original source: Sun's PKC Forum post
The FLIT512 AVX2 poly_compress_and_pack omits the reference implementation's & 0x1FF reduction in its nine-bit compression branch (poly.c:299–331). For coefficients 3326–3328 the reciprocal quotient is 512; the reference maps it to zero, while the optimized packer lets bit 9 spill into the next field.
Both implementations self-verify. With the same seed they also generate identical public and secret keys, but their ciphertext and shared secret differ. Each cross-decapsulation returns 0 while deriving a key different from the sender's; the API uses 0 for both its acceptance and implicit-rejection paths, so this value does not show which path ran. Across the ten submitted KAT seeds, ciphertext and shared secret differ in eight records; the local fresh-seed witness below produces a one-byte ciphertext difference and silent mismatch in both directions.
This is a limited interoperability and correctness failure, not a confidentiality break, hence Low.
Follow-up response: the FLIT team's 2026-09-29 post confirms the archived package's interoperability behavior and the missing mask as its cause. The team says it had independently identified the defect before the public report.
Proposed fixes
The FLIT team's response proposes adding & 0x1FF in the optimized nine-bit compression branch and points to its updated implementation. This section records the proposal without evaluating it.
Reproducing
Commands below run in a checkout of the ngcc-harness repository with the candidate built (see its README).
python3 kem-15/reproduce_interop.py
The script builds both archived implementations in a temporary directory, exercises their submitted APIs with one common seed, checks self-decapsulation controls, and prints CONFIRMED kem-15-1 only when both cross-decapsulations silently derive the wrong key.
kem-15-2: Optimized equality check accepts invalid ciphertexts and exposes a plaintext-checking oracle
| Severity | High |
|---|---|
| Scope | implementation |
| Status | Confirmed |
| Affected | All five AVX2 trees: FLIT128/256/512 and FIPS202 OPT128/256 |
| Discovery | Moderate |
| Exploitation | Near-total bypass of re-encryption rejection on unrelated ciphertexts and a plaintext-checking oracle; full key recovery not executed |
| Credit | Zhenyu Xiong and Mingsheng Wang, with AI assistance |
| Date | 2026-10-05 |
Original source: Xiong and Wang's PKC Forum post and pinned verification package Follow-up source: FLIT team's response
The optimized equality check folds ciphertext differences into a 64-bit word and returns (-(int64_t)r)>>63 (verify.c:18–38). This is not a nonzero test and also invokes signed-overflow undefined behavior at r=2^63. In our GCC 15.2 build it reported equality for about 3.8% of ciphertexts with one to four random bit changes; reference and patched controls rejected all of them. Bit 63 of the OR-folded difference is set for essentially every ciphertext that decrypts to a different message, so rejection fails far more broadly than the low-bit edit rate suggests. A direct 2,000-pair comparison of unrelated 1 KiB inputs found 2,000 false equalities, while the reference rejected all 2,000. The exact frequency and edge behavior depend on the compiler.
The result feeds the Fujisaki–Okamoto conditional move (kem.c:107–126 in the FLIT128/256/512 optimized trees; 106–125 in FIPS202 OPT128/256). When an invalid ciphertext is misclassified, decapsulation returns the accept-path KDF value. For five such ciphertexts the witness recomputed that value from the public key, ciphertext, and correct plaintext guess, while a wrong guess failed. The mismatch return is -1 rather than 1, so the AVX2 conditional move's byte mask becomes 0x01; even correctly rejected ciphertexts replace only bit 0 of each pre-key byte with the rejection secret. The witness establishes a plaintext-checking oracle, but no FLIT key-recovery or IND-CCA distinguisher has been completed, so the finding is High.
Proposed fixes
The original post proposes replacing the return expression with a constant-time 64-bit nonzero fold whose result is exactly 0 or 1. The FLIT team reports applying return (int)((r | (UINT64_C(0) - r)) >> 63); in all five affected trees, states that this also restores the conditional move, and reports that the corrected trees pass its rejection-path regression tests with unchanged KATs. The change is committed to the team's GitHub repository; the frozen submission is unchanged. This records the fix without evaluating it.
Reproducing
Commands below run in a checkout of the ngcc-harness repository with the candidate built (see its README).
./kem-15/reproduce_fo_bypass.sh
python3 kem-15/reproduce_random_compare.py
kem-15-3: The FIPS202 variants generate predictable keys because their RNG is never seeded
| Severity | Critical |
|---|---|
| Scope | implementation |
| Status | Confirmed |
| Affected | All four submitted additional FIPS202 REF/OPT128 and REF/OPT256 implementations; the primary SM3 variants are not affected by this RNG path |
| Discovery | Trivial |
| Exploitation | A fresh process's first key pair and encapsulation are reproducible from public source, permitting private-key reconstruction and decapsulation |
| Credit | Markku-Juhani O. Saarinen markku-juhani.saarinen@tuni.fi, with AI assistance |
| Date | 2026-10-06 |
All four FIPS202 trees link their own rng.c in their normal Makefile builds (Implementations/README.md:83). It initializes rng_seed to 32 zero bytes and rng_ctr to zero; randombytes draws SHAKE256 from that fixed seed and counter (rng.c:16–40). Their PKE key generation, KEM fallback-key generation and encapsulation call this randombytes (indcpa.c:33, kem.c:32,59). Nothing in the submitted KEM API calls randombytes_init. The KAT driver seeds a different object, drng_algorithm (KAT_KEM.c:103–108), so even its varying test seeds do not seed the RNG that key generation uses.
Consequently an attacker can start a fresh copy of the submitted FIPS202 implementation, regenerate a victim's first public/secret key pair, and decapsulate ciphertexts addressed to that public key. This violates the 128- and 256-bit KEM security targets, without relying on a weak entropy source or on KAT-only behavior. The finding is limited to these additional implementations: explicitly calling the separate randombytes_init function before use changes their output, but that call is not part of the submitted KEM API.
Reproducing
Commands below run in a checkout of the ngcc-harness repository with the candidate built (see its README).
python3 kem-15/reproduce_fips202_unseeded_rng.py
The witness builds each of the four frozen trees and runs its KEM API in separate processes after two different external-DRBG seeds. It requires identical key pairs, ciphertexts and shared secrets in those runs. As a negative control, explicit initialization of the internal RNG with different seeds must change the outputs.
kem-15-4: The FLIT512 AVX2 inverse NTT overflows and breaks its own round trips
| Severity | Low |
|---|---|
| Scope | implementation |
| Status | Confirmed |
| Affected | Submitted FLIT512 AVX2 implementation; the FLIT512 reference and FLIT128/256 AVX2 trees did not fail |
| Discovery | Moderate |
| Exploitation | About 1.6×10⁻⁴ of honest encapsulations give a ciphertext that silently decapsulates to a different key; no secret-dependent decapsulation failure demonstrated |
| Credit | Kr0emer and Chen Peng (陈鹏), Hangzhou Institute of Technology, Xidian University |
| Date | 2026-11-12 |
Original source: GitHub issue #29 follow-up
The FLIT512 branch of invntt_avx adds each butterfly pair in 16-bit lanes and subtracts Q once from lanes above Q−1 (ntt_avx.c:250–252). Its comment assumes that the sum stays below 2Q (:120). However, the input from the AVX2 base multiplication is a signed Barrett representative. Negative sums are never reduced and can wrap around int16 over the seven layers, leaving one coefficient wrong modulo Q. The reference inverse NTT freezes every sum (ntt.c:235).
We ran the archived API over the archived KAT seed stream. In 8 of 50,000 round trips the AVX2 build's encapsulated and decapsulated shared secrets differed, first at iteration 11058, and every call returned 0. The reference build failed none. So did the AVX2 build with only poly_invntt_tomont switched to the scalar invntt_tomont (poly.c:92). An instrumented build attributed every failure to a wrap in encapsulation's h·r product (indcpa.c:94–95). Wraps in decryption's f·c product occurred in 12 other round trips and changed no shared secret.
The failure rate is far from negligible, but the demonstrated effect is an honest session that silently derives mismatched keys. No decapsulation oracle on the secret key is shown, hence Low.
Reproducing
Commands below run in a checkout of the ngcc-harness repository with the candidate built (see its README).
sh kem-15/reproduce_avx2_invntt.sh
NGCC_LONG=1 sh kem-15/reproduce_avx2_invntt.sh
The script builds the archived reference and AVX2 FLIT512 trees with their Makefile flags, outside the source tree, and requires an AVX2 CPU. The AVX2 build must fail first at iteration 11058, while the reference and scalar-inverse controls must not fail. A copy that counts int16 wraparounds in the sum must attribute each failure to encapsulation and none to decapsulation. The long run uses 50,000 iterations and adds FLIT128 and FLIT256 AVX2 controls.
kem-15-5: FLIT512 AVX2 base multiplication writes past stack arrays
| Severity | Low |
|---|---|
| Scope | implementation |
| Status | Confirmed |
| Affected | Submitted FLIT512 AVX2 implementation, in key generation, encapsulation and decapsulation |
| Discovery | Trivial |
| Exploitation | Fixed 8- and 16-byte stack writes on every operation; a clang build fails every round trip, but no useful attacker control over the overwritten values, memory disclosure, or control-flow effect is demonstrated |
| Credit | Kr0emer and Chen Peng (陈鹏), Hangzhou Institute of Technology, Xidian University, for the clang failure; stack-overflow localization by Markku-Juhani O. Saarinen markku-juhani.saarinen@tuni.fi, with AI assistance |
| Date | 2026-11-12 |
Original source: GitHub issue #29 follow-up
basemul_avx_16x declares six 8-element int16_t arrays (basemul_avx.c:704), but its two reduction loops load and store eight lanes at offsets 0 and 4 (:727–746). The second pass reads four elements past ea, oa, eb and ob, and writes four past sa and sb. baseinv_avx_32x stores 32-byte vectors into the 16-byte rows esq[k] and osq[k] (:771, :789–790), so its second row writes 16 bytes past both arrays. AddressSanitizer reports all eight accesses in the first key generation. The base multiplication also runs on h·r in encapsulation and on f·c in decapsulation.
The writes land on whatever the compiler places next to those arrays. In our gcc 15.2 build the layout happens to be harmless. With clang 21 the same source failed all 200 tested round trips, and enlarging the arrays removed every failure. The written values depend on secret and ciphertext coefficients, but they go to fixed offsets in the same frame, and no further control is shown, hence Low.
Reproducing
Commands below run in a checkout of the ngcc-harness repository with the candidate built (see its README).
sh kem-15/reproduce_avx2_stack_overflow.sh
The script builds the archived FLIT512 AVX2 tree with AddressSanitizer and requires out-of-bounds stack writes in both functions, while a copy with enlarged arrays runs cleanly. If an x86 clang is available, the unmodified tree must fail all 200 round trips and the enlarged copy none.