Unvalidated keyBits/Nr in production kernels causes infinite loop walking rk off the end of the key schedule (latent)
Summary
rijndaelKeySetupEnc/Dec validate keyBits only with KASSERT (line 738) which is do{}while(0) without INVARIANTS. Out-of-range keyBits falls through all 3 size branches, still reads 32 bytes from cipherKey (over-read for shorter keys), returns Nr=0 (line 814). In default !FULL_UNROLL build, rijndaelEncrypt/Decrypt with Nr=0: r=Nr>>1=0 (951/1132), loop for(;;){ rk+=8; if(--r==0)break; } at 952-1007/1132-1188 -> r goes 0->-1 never breaks -> rk walks past ek/dk[60] until page-fault panic. All in-tree callers validate (cryptoapi.c:310, wlan_ccmp:134, rijndael-api-fst.c:48) so latent. Cache-timing T-table AES noted as known property. Fix: real if(keyBits not in {128,192,256}) return -1; + per-call Nr check.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-0963 Β· 1 files| File | Type | Description | Size | |
|---|---|---|---|---|
| fix.diff | suggested-fix | Unvalidated keyBits/Nr in production kernels causes infinite loop walking rk off | 441 B | view raw |
Fix verification
fixedfix.diff applied + combined nativekernel build rc=0 (-Werror)
fix.diff applied + combined nativekernel build rc=0 (-Werror)
Confirmed kernel references
β
Detail
Exploit chain
none (Info severity)
Evidence (decisive lines)
Source-confirmed at sys/crypto/rijndael/rijndael-alg-fst.c:734: unvalidated keyBits/Nr causes infinite loop walking key schedule (latent)
Verified recommended fix
Source-confirmed at sys/crypto/rijndael/rijndael-alg-fst.c:734: unvalidated keyBits/Nr causes infinite loop walking key schedule (latent)
Verdict
Source-confirmed at sys/crypto/rijndael/rijndael-alg-fst.c:734: unvalidated keyBits/Nr causes infinite loop walking key schedule (latent)
No comments yet.