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

ar2425: flat pd-gain curve (all EEPROM deltas 0 β€” legal) makes sizeCurrVpdTable==0 β†’ VpdTable_I[ii][sizeCurrVpdTable-1/-2] uint32-wrap wild reads at row+0x1FFFFFFFE (twin of DF-4622/4650/4662/4682)

Summary

A flat curve (legal 4-bit deltas, stock-decoder constructible) gives span 0, so the [-1]/[-2] subscripts wrap - reads at row+0x1FFFFFFFE from the .bss table; garbage Vpd_step feeds extrapolated PDADC values programmed to the PHY. Harness SIGSEGV si_addr exact-match asserted; guard>=2 fix validated. Not necessarily malicious - a flat-calibrated legit card hits it.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-4689 Β· 16 files
FileTypeDescriptionSize
ar2425_harness.c β€” 19.2 KB view raw
build.sh β€” 85 B view raw
run.sh β€” 109 B view raw
fixA.diff β€” 1.2 KB view raw
fixB.diff β€” 921 B view raw
fixC.diff β€” 1.2 KB view raw
fixD.diff β€” 1009 B view raw
fix_validate.sh β€” 3.3 KB view raw
build.log β€” 773 B view raw
run.log β€” 3.8 KB view raw
fix_run.log β€” 10.2 KB view raw
env.txt β€” 435 B view raw
fix.diff β€” 1.2 KB view raw
VERDICT.md β€” 2.7 KB ↓ raw
manifest.json β€” 862 B view raw
verdict.json β€” 3.7 KB view raw
VERDICT.md
↓ download raw

DF-4689 -- verdict narrative

What was claimed

Flat pd-gain curve makes sizeCurrVpdTable==0 -> VpdTable_I[ii][sizeCurrVpdTable-1/-2] uint32-wrap wild reads at row+0x1FFFFFFFE (twin of DF-4622/4650/4662/4682)

Reproduced?

YES (mode 3 of the shared verbatim-extraction harness, run on the DragonFly guest).

REPRODUCED on the DragonFly guest (verbatim-extraction harness, mode 3): with an EEPROM-shaped dataset of flat pd-gain curves (all deltas 0 -- legal 4-bit EEPROM values, constructible by the stock decoder), sizeCurrVpdTable = Pmax_t2[ii]-Pmin_t2[ii] == 0 makes ar2425.c:465-466 index VpdTable_I[ii][(uint32)0-1] -> element 0xFFFFFFFF -> read at row+0x1FFFFFFFE bytes (+8.59 GB). The SIGSEGV handler asserts si_addr == &VpdTable_I[0][0] + 0x1FFFFFFFE exactly (0xa00478dee) -- the fault is pinned to this line. In-kernel: the wild read lands in the direct map (garbage Vpd_step) or a KVA hole (panic) on every channel set with such a curve (crafted EEPROM, or a flat-calibrated legit card). ar2425 keeps VpdTable_I in kernel static storage (:373), so the wild read is relative to .bss. Exploitation gated on crafted/flat-calibrated EEPROM AR2425 hardware; ceiling is DoS. Twin of DF-4622 (ar5413) / DF-4650 (ar2316) / DF-4662 (ar2413) / DF-4682 (ar2317). Fix validated: clamping the [-1]/[-2] accesses behind sizeCurrVpdTable>=2 removes the fault; patched mode 3 runs to completion.

Fix validation

Harness-level validation (fix_validate.sh): baseline mode 3 dies with SIGSEGV si_addr exactly &VpdTable_I[0][0]+0x1FFFFFFFE (asserted MATCH); with fixC the mode completes ('no SIGSEGV', minPower computed from real data). No kernel rebuild: no AR2425 hardware on the guest; validated against verbatim-extracted bodies per family methodology.

Decisive evidence: run.log: 'mode 3 ... REPRODUCED: SIGSEGV si_addr=0xa00478dee ... expected wild READ address 0xa00478dee ... MATCH'; fix_run.log: 'PATCHED mode 3 ... no SIGSEGV: function completed on this build'.

Why no in-kernel run

The guest has no AR2425 NIC and no EEPROM-injection path; the family methodology (DF-4619..DF-4683, all accepted with the same constraint) compiles the real function bodies against faithful struct/static layouts and proves the violation with exact-address faults / canaries / propagation -- equivalent strength for a hardware-gated defect, and it validates the fix the same way.

Fix status (batch validation)

Applied with the 36 sibling fix.diffs of this batch in findings/poc/_batch41/all_fixes.patch; single in-guest make -j6 nativekernel KERNCONF=X86_64_GENERIC completed RC=0 with zero errors under -Werror (full log: findings/poc/_batch41/fix_build8.log). Behavior A/B intentionally skipped for this Info-tier item.

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

Harness-level validation (fix_validate.sh): baseline mode 3 dies with SIGSEGV si_addr exactly &VpdTable_I[0][0]+0x1FFFFFFFE (asserted MATCH); with fixC the mode completes ('no SIGSEGV', minPower computed from real data). No kernel rebuild: no AR2425 hardware on the guest; validated against verbatim-extracted bodies per family methodology.

run.log: 'mode 3 ... REPRODUCED: SIGSEGV si_addr=0xa00478dee ... expected wild READ address 0xa00478dee ... MATCH'; fix_run.log: 'PATCHED mode 3 ... no SIGSEGV: function completed on this build'.
↓ fix.diffper-fix-DF-4689

Confirmed kernel references

Detail

Exploit chain

crafted-EEPROM AR2425 card -> ath attach -> ar2425SetPowerTable (channel set/reset) -> ar2425getGainBoundariesAndPdadcsForPowers -> OOB write/wild read; ceiling radio misprogramming/panic (DoS), not uid0

Evidence (decisive lines)

run.log: 'mode 3 ... REPRODUCED: SIGSEGV si_addr=0xa00478dee ... expected wild READ address 0xa00478dee ... MATCH'; fix_run.log: 'PATCHED mode 3 ... no SIGSEGV: function completed on this build'.

PoC changes

ar2425-specific harness (vs DF-4680 template): the 5 function-scope static declarations (ar2425.c:367-379) are stripped from the verbatim extraction (asserted count) and re-bound to a guarded mmap block emulating kernel static storage -- ar2425 keeps the VpdTable/Pmin/Pmax scratch in .bss, not in ar2425State like the family twins; first build attempt had a macro/field name collision (offsetof) fixed by m_-prefixing the emulation fields; guest tar transfer ordering bug fixed (extract before overwrite)

Verified recommended fix

Guard the Vpd_step reads with sizeCurrVpdTable>=2 (fallback step 1) and clamp vpdLastIdx (fixC).

Verdict

REPRODUCED on the DragonFly guest (verbatim-extraction harness, mode 3): with an EEPROM-shaped dataset of flat pd-gain curves (all deltas 0 -- legal 4-bit EEPROM values, constructible by the stock decoder), sizeCurrVpdTable = Pmax_t2[ii]-Pmin_t2[ii] == 0 makes ar2425.c:465-466 index VpdTable_I[ii][(uint32)0-1] -> element 0xFFFFFFFF -> read at row+0x1FFFFFFFE bytes (+8.59 GB). The SIGSEGV handler asserts si_addr == &VpdTable_I[0][0] + 0x1FFFFFFFE exactly (0xa00478dee) -- the fault is pinned to this line. In-kernel: the wild read lands in the direct map (garbage Vpd_step) or a KVA hole (panic) on every channel set with such a curve (crafted EEPROM, or a flat-calibrated legit card). ar2425 keeps VpdTable_I in kernel static storage (:373), so the wild read is relative to .bss. Exploitation gated on crafted/flat-calibrated EEPROM AR2425 hardware; ceiling is DoS. Twin of DF-4622 (ar5413) / DF-4650 (ar2316) / DF-4662 (ar2413) / DF-4682 (ar2317). Fix validated: clamping the [-1]/[-2] accesses behind sizeCurrVpdTable>=2 removes the fault; patched mode 3 runs to completion.