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

ar2425: numPdGainsUsed==0 (EEPROM xpd_mask==0) β€” uint32-wrapped [ii-1]/[kk-1] wild reads at array+0x1FFFFFFFE (+8.59 GB) + stale-STATIC Pmin_t2[0] read (twin of DF-4620/4649/4661/4681, with the ar2425 static-storage nuance)

Summary

xpd_mask==0 continues past the compiled-out HALASSERT into the backfills whose uint32 counters at zero wrap - wild reads at +8.59 GB propagating into TPCRG5 and the 32 pdadc PHY writes; unlike the stack twins, Pmin_t2 is .bss so the read at :431 is a stale-static residue of the previous channel's calibration. Harness REPRODUCES (wild pages seeded -> propagation; minPower stale-static proven). Early-return + caller-xpd_mask-check fix (validated).

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-4688 Β· 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 β€” 921 B view raw
VERDICT.md β€” 3.0 KB ↓ raw
manifest.json β€” 862 B view raw
verdict.json β€” 4.0 KB view raw
VERDICT.md
↓ download raw

DF-4688 -- verdict narrative

What was claimed

numPdGainsUsed==0 (EEPROM xpd_mask==0): uint32-wrapped wild reads at array+0x1FFFFFFFE (+8.59 GB) in the backfill loops + stale-static Pmin_t2[0] read (twin of DF-4620/4649/4661/4681)

Reproduced?

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

REPRODUCED on the DragonFly guest (verbatim-extraction harness, mode 2): with an EEPROM-shaped zero-gain dataset (xpd_mask=0 -> all numVpd==0, the exact shape ar2413SetupRawDataset produces) the backfill loops index with uint32 counters at 0: pPdGainBoundaries[ii-1] (ar2425.c:485) and pPDADCValues[kk-1] (:489) wrap to element index 0xFFFFFFFF and read at array+0x1FFFFFFFE bytes (+8.59 GB) -- proven by mapping the exact wild pages (kernel direct-map emulation), seeding 0x5A5A and observing both values propagate into gainBoundaries[0] (-> AR_PHY_TPCRG5 via ar2425SetPowerTable:557-562) and pcdacTable[0] (-> 32 PHY reg writes, ar2425.c:548-555). ar2425-specific nuance vs the family twins: Pmin_t2/Pmax_t2 are FUNCTION-SCOPE STATICS (:377-379), so *pMinCalPower = Pmin_t2[0] at :431 is a STALE-STATIC read (residue of the previous channel's calibration; harness 0xAAAA prefill propagates deterministically), not an uninitialized-stack read. In-kernel the +8.6GB read is a wild KVA read -> panic (KVA hole) or garbage radio programming; HALASSERT is compiled out in release. Exploitation gated on crafted-EEPROM AR2425 hardware (physical/supply-chain); ceiling is DoS/radio misprogramming. Twin of DF-4620 (ar5413) / DF-4649 (ar2316) / DF-4661 (ar2413) / DF-4681 (ar2317). Fix validated (early return + caller xpd_mask check): no wild reads, minPower sentinel untouched.

Fix validation

Harness-level validation (fix_validate.sh): baseline mode 2 shows 0x5A5A from both wild pages propagating into gainBoundaries[0]/pcdacTable[0] and minPower=0xAAAA (stale static); with fixB the function returns before any backfill (gb[0]=0, pcdacTable[0]=canary 0xAAAA, minPower=sentinel 0x7c7c untouched). No kernel rebuild: no AR2425 hardware on the guest; validated against verbatim-extracted bodies per family methodology.

Decisive evidence: run.log: 'gainBoundaries[0] = 0x5a5a ... pcdacTable[0] = 0x5a5a ... minPower out = 0xaaaa'; fix_run.log: 'PATCHED mode 2 ... minPower=0x7c7c ... exit=1'.

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 2 shows 0x5A5A from both wild pages propagating into gainBoundaries[0]/pcdacTable[0] and minPower=0xAAAA (stale static); with fixB the function returns before any backfill (gb[0]=0, pcdacTable[0]=canary 0xAAAA, minPower=sentinel 0x7c7c untouched). No kernel rebuild: no AR2425 hardware on the guest; validated against verbatim-extracted bodies per family methodology.

run.log: 'gainBoundaries[0] = 0x5a5a ... pcdacTable[0] = 0x5a5a ... minPower out = 0xaaaa'; fix_run.log: 'PATCHED mode 2 ... minPower=0x7c7c ... exit=1'.
↓ fix.diffper-fix-DF-4688

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: 'gainBoundaries[0] = 0x5a5a ... pcdacTable[0] = 0x5a5a ... minPower out = 0xaaaa'; fix_run.log: 'PATCHED mode 2 ... minPower=0x7c7c ... exit=1'.

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

Early return when numPdGainsUsed==0 plus caller-side xpd_mask==0 -> AH_FALSE check in ar2425SetPowerTable (fixB).

Verdict

REPRODUCED on the DragonFly guest (verbatim-extraction harness, mode 2): with an EEPROM-shaped zero-gain dataset (xpd_mask=0 -> all numVpd==0, the exact shape ar2413SetupRawDataset produces) the backfill loops index with uint32 counters at 0: pPdGainBoundaries[ii-1] (ar2425.c:485) and pPDADCValues[kk-1] (:489) wrap to element index 0xFFFFFFFF and read at array+0x1FFFFFFFE bytes (+8.59 GB) -- proven by mapping the exact wild pages (kernel direct-map emulation), seeding 0x5A5A and observing both values propagate into gainBoundaries[0] (-> AR_PHY_TPCRG5 via ar2425SetPowerTable:557-562) and pcdacTable[0] (-> 32 PHY reg writes, ar2425.c:548-555). ar2425-specific nuance vs the family twins: Pmin_t2/Pmax_t2 are FUNCTION-SCOPE STATICS (:377-379), so *pMinCalPower = Pmin_t2[0] at :431 is a STALE-STATIC read (residue of the previous channel's calibration; harness 0xAAAA prefill propagates deterministically), not an uninitialized-stack read. In-kernel the +8.6GB read is a wild KVA read -> panic (KVA hole) or garbage radio programming; HALASSERT is compiled out in release. Exploitation gated on crafted-EEPROM AR2425 hardware (physical/supply-chain); ceiling is DoS/radio misprogramming. Twin of DF-4620 (ar5413) / DF-4649 (ar2316) / DF-4661 (ar2413) / DF-4681 (ar2317). Fix validated (early return + caller xpd_mask check): no wild reads, minPower sentinel untouched.