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

Unbounded idx extension loops in CISTPL_CFTABLE_ENTRY read past the declared tuple body

Summary

CISTPL_CFTABLE_ENTRY parser advances body index idx through several extension/subfield loops without comparing idx against tuple->length inside the loop. Power-parameter extension loop (:995-1003) and misc extension loop (:1243-1246) iterate solely on attacker-supplied byte contents. If bytes carry 0x80 extension bit idx walks past declared tuple body. pccard_tuple_read_* macros do no inherent bounds checking. If attribute memory past tuple body is all 0xFF (erased state) every read returns 0xFF 0x80 bit stays set idx advances until out-of-window access. Either kernel hang/spin (bridge wraps) or panic (leaves mapping). [VERIFIED pass2: reproduced - both CFTABLE_ENTRY extension loops walk past the tuple body and with erased attribute memory the scan never terminates, 4M-read budget exhausted; length-guard fix-validated]

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-2321 Β· 12 files
FileTypeDescriptionSize
build.log β€” 1.9 KB view raw
build.sh β€” 113 B view raw
env.txt β€” 412 B view raw
extract.sh β€” 4.2 KB view raw
fix.diff β€” 318 B view raw
rig_main.c β€” 22.2 KB view raw
rig_shims.h β€” 7.6 KB view raw
run.log β€” 4.6 KB view raw
run.sh β€” 176 B view raw
run_fixed.log β€” 3.5 KB view raw
verdict.json β€” 2.2 KB view raw
fix.diff β€” 318 B view raw

Fix verification

not_testable
↓ fix.diffper-fix-DF-2321

Confirmed kernel references

Detail

Evidence (decisive lines)

run.log (baseline: power_ext/misc_ext READ BUDGET EXHAUSTED exit 90; power_stops/misc_stops MARK lines prove read at idx==length), run_fixed.log (power_end/misc_end return normally, OOB: 0), extract_manifest.txt (PATCHED gate), fix.diff

PoC changes

reused the DF-2319/2320 rig; added scenarios power_ext/misc_ext (0xFF tail), _stops (planted terminator + MARK offset accounting), _end (chained CISTPL_END for the fix A/B), ring-tail dump

Verified recommended fix

bound both CFTABLE_ENTRY extension loops with tuple->length checks (goto abort_cfe)

Verdict

Unbounded CFTABLE_ENTRY extension loops confirmed by the verbatim pccard_cis.c parser rig (5-pack extractor, sha-gated): the power-parameter loop (pccard_cis.c:995-1003) and the misc-extension loop (:1243-1246) walk past the declared tuple body with no bound; with erased attribute memory (0xFF everywhere, bit 7 set) the walk never terminates - the scan exhausts a 4,000,000-read budget the kernel does not have, and the minimal-overwalk controls prove the bus read at idx == tuple->length happens before any check. With the two-line guard (abort_cfe when idx reaches tuple->length) the same shapes return normally with zero out-of-window reads. Hardware-gated (crafted PCMCIA CIS image at card insertion).