β¬’ DragonFlyBSD Kernel Audit
← triage Β· dashboard
DF-0963

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)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-0963 Β· 1 files
FileTypeDescriptionSize
fix.diff suggested-fix Unvalidated keyBits/Nr in production kernels causes infinite loop walking rk off 441 B view raw

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

fix.diff applied + combined nativekernel build rc=0 (-Werror)

fix.diff applied + combined nativekernel build rc=0 (-Werror)
↓ fix.diffcombined build rc=0

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)