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

rijndael_padDecrypt MODE_ECB accepts invalid padLen==0 and rejects valid padLen==16 (asymmetric with CBC path, padding-oracle-prone)

Summary

rijndael-api-fst.c:390-393 MODE_ECB: padLen=block[15]; if(padLen>=16) return BAD_DATA. Accepts padLen=0 (invalid; for(i=16-0=16;...) never iterates; memcpy(outBuffer,block,16-0=16) copies full block; returns 16*numBlocks-0) and rejects padLen=16 (legitimate full-block padding per padEncrypt at :221 which yields padLen in [1,16]). CBC path at :423 correctly uses if(padLen<=0||padLen>16). ECB round-trip fails on whole-block inputs. Padding oracle: attacker flips last-block bytes -> BAD_DATA vs success -> decrypt one byte at a time (Vaudenay). padLen=0 acceptance -> non-error return with attacker-influenced plaintext -> parsing confusion. Fix: if(padLen<=0||padLen>16).

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-0969 Β· 2 files
FileTypeDescriptionSize
fix.diff suggested-fix git-apply-able fix for the cited path 424 B view raw
VERDICT.md verdict source-confirmation narrative 996 B ↓ raw
VERDICT.md verdict source-confirmation narrative
↓ download raw

DF-0969 source-confirmation

Verdict: REPRODUCED (source-confirmed)
Impact: none Confidence: likely

Kernel ref: sys/crypto/rijndael/rijndael-api-fst.c:391

Mechanism

padDecrypt ECB accepts padLen==0 (invalid) -> padding-oracle / parsing confusion

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.

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_testable
baseline reproduced→ patch + rebuild →patched clean

not_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).
↓ fix.diffDragonFly 6.5-DEVELOPMENT single-fix combined kernel (nativekernel rc=0 -Werror, 2026-07-23 09:17:55 UTC)

Confirmed kernel references

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: padDecrypt ECB accepts padLen==0 (invalid) -> padding-oracle / parsing confusion @ sys/crypto/rijndael/rijndael-api-fst.c:391. 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-0969/.

Verified recommended fix

reject padLen==0 and padLen>16 (was padLen>=16). matches finding proposal. Full diff in findings/poc/DF-0969/fix.diff.

Verdict

REPRODUCED (source-confirmed). Source-trace confirmed padDecrypt ECB accepts padLen==0 (invalid) -> padding-oracle / parsing confusion at sys/crypto/rijndael/rijndael-api-fst.c:391 against the audited sys/ tree; exact line/condition verified.