rijndael_blockEncrypt CBC mode reads/writes full 16-byte block even when numBlocks==0 (non-block-aligned inputLen)
Summary
rijndael-api-fst.c:93-95 only rejects inputLen<=0; :97 numBlocks=inputLen/128 (in BITS). CBC case at :108-142: first-block setup at :110-122 runs UNCONDITIONALLY before for(i=numBlocks-1;...) loop. For inputLen=64 (8 bytes): :111 memcpy(iv,input,16) reads 16 bytes from 8-byte input (8-byte over-read); :122 rijndaelEncrypt writes 16 bytes to 8-byte outBuffer (8-16 byte over-write); :124 loop does not run (i=-1); :186 returns 0 hiding corruption. ECB/CFB1 paths correctly gate on for(i=numBlocks;...) so safe when numBlocks==0. CBC decrypt at :286-313 correctly nests body in for loop. No in-tree kernel caller. Fix: reject inputLen%128!=0 at top.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-0968 Β· 2 files| File | Type | Description | Size | |
|---|---|---|---|---|
| fix.diff | suggested-fix | git-apply-able fix for the cited path | 373 B | view raw |
| VERDICT.md | verdict | source-confirmation narrative | 997 B | β raw |
DF-0968 source-confirmation
Verdict: REPRODUCED (source-confirmed)
Impact: leak Confidence: likely
Kernel ref: sys/crypto/rijndael/rijndael-api-fst.c:110
Mechanism
CBC encrypt runs first-block setup before numBlocks check -> over-read/over-write
Confirmation method
Source-trace confirmed the cited code path matches the finding (exact line/condition
verified against sys/). Runtime PoC not exercised for this source-only Low-severity
item; confirmation is by code inspection.
Recommended fix
See fix.diff in this folder (git-apply-able unified diff).
Phase 8 (combined build)
All 64 fixes were batched into one combined patch
(../_batch/combined_64.patch) and applied to in-guest /usr/src. A single
make -j6 nativekernel KERNCONF=X86_64_GENERIC completed rc=0 with 0 errors under
-Werror (../_batch/fix_build.log, 35374 lines). The GENERIC kernel + all modules
(drm, firewire, usb, netgraph, smbfs, fuse, crypto, vm, pmap) compiled clean.
Fix verification
not_testablenot_testable (source-only): no runtime PoC exercised; fix.diff applies cleanly and the combined single nativekernel build of all 64 fixes completed rc=0 with 0 errors under -Werror (findings/poc/_batch/fix_build.log). Bug source-confirmed in baseline tree. Compile-validation of the fix is the requested Phase-8 deliverable for this batch.
combined build: '=== NK_DONE rc=0 ===' and '>>> Kernel build for X86_64_GENERIC completed on Thu Jul 23 09:17:55 UTC 2026' (0 'error:' lines in 35374-line log).
Confirmed kernel references
- s
- y
- s
- /
- c
- r
- y
- p
- t
- o
- /
- r
- i
- j
- n
- d
- a
- e
- l
- /
- r
- i
- j
- n
- d
- a
- e
- l
- -
- a
- p
- i
- -
- f
- s
- t
- .
- c
- :
- 1
- 1
- 0
Detail
Exploit chain
none (non-corruption / source-only confirmation; no memory-corruption escalation chain developed for this Low-severity item)
Evidence (decisive lines)
source-only: CBC encrypt runs first-block setup before numBlocks check -> over-read/over-write @ sys/crypto/rijndael/rijndael-api-fst.c:110. Combined fix build: '=== NK_DONE rc=0 ===' / 'Kernel build for X86_64_GENERIC completed', 0 errors under -Werror (findings/poc/_batch/fix_build.log).
PoC changes
authored git-apply-able fix.diff targeting the cited line; source-trace verified the vulnerable path. Evidence pack (VERDICT.md, manifest.json, env.txt, fix.diff) in findings/poc/DF-0968/.
Verified recommended fix
reject inputLen not a multiple of 128 bits (BAD_BLOCK_LENGTH). matches finding proposal. Full diff in findings/poc/DF-0968/fix.diff.
Verdict
REPRODUCED (source-confirmed). Source-trace confirmed CBC encrypt runs first-block setup before numBlocks check -> over-read/over-write at sys/crypto/rijndael/rijndael-api-fst.c:110 against the audited sys/ tree; exact line/condition verified.
No comments yet.