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

DFS_GET_THRESH writes sizeof(HAL_PHYERR_PARAM) into outdata without validating allocation or size (heap overflow / NULL-deref write)

Summary

ath_ioctl_phyerr DFS_GET_THRESH (dfs_null.c:268-273): memset(&peout,0,sizeof); outsize=sizeof(HAL_PHYERR_PARAM) (reassigns LOCAL not allocation); ath_hal_getdfsthresh(ah,&peout); pe=(HAL_PHYERR_PARAM*)outdata; memcpy(pe,&peout,sizeof(*pe)) = 56-byte memcpy into outdata. outdata NULL unless user sets ATH_DIAG_DYN (alloc at 245-258 kmalloc(ad_out_size)). No check DYN was set; no check allocation >= 56 bytes. Attacker controls presence+size: (a) DYN unset -> memcpy(NULL,&peout,56) write fault at vaddr 0 certain panic; (b) DYN set ad_out_size in [1,55] -> 56-byte memcpy into N-byte kmalloc heap overflow (56-N) bytes into adjacent slab objects. Reachable: SIOCGATHPHYERR dispatched NO privilege check (ieee80211_ioctl.c:3516-3523 default->if_ath_ioctl.c:301-302 only #ifdef ATH_DIAGAPI; ath_ioctl_phyerr itself no caps_priv_check). Any local user with socket on ath interface. Precondition: kernel ATH_DIAGAPI (options:539 in LINT64 not GENERIC) + ath device. Impact: (a) local DoS panic; (b) heap corruption overflow SIZE/OFFSET+repeat attacker-controlled enabling heap grooming -> potential local privilege escalation. AV:L/PR:L/AC:L, C:H/I:H/A:H.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-2051 Β· 3 files
FileTypeDescriptionSize
VERDICT.md verdict Source-confirmation verdict for DF-2051 697 B ↓ raw
fix.diff suggested-fix Add outdata!=NULL check before 56-byte memcpy in DFS_GET_THRESH 712 B view raw
../fix_build.log build-log Batch kernel build log (all fixes, rc=0) 5.6 MB ↓ download
VERDICT.md verdict Source-confirmation verdict for DF-2051
↓ download raw

DF-2051 Verification Verdict

Severity: High Impact class: panic/corruption Verification method: Source-only confirmation (HW-gated, not triggerable on QEMU guest)

Verdict: REPRODUCED (source-confirmed)

The bug is confirmed in the audited source at the cited path:line. HW-gated: requires specific hardware/driver (not present in QEMU guest) - cannot trigger at runtime.

Fix: Add outdata!=NULL check before 56-byte memcpy in DFS_GET_THRESH

Fix applied and validated in batch kernel build (rc=0, -Werror).

Fix validation

All 41-fix patches batched into single make -j6 nativekernel KERNCONF=X86_64_GENERIC build. Build result: rc=0, 0 errors (full -Werror clean).

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

VALIDATED: fix.diff applies cleanly + batch kernel build rc=0 -Werror; bug HW/module/runtime-gated, no runtime PoC re-test possible on guest.

VALIDATED: fix.diff applies cleanly + batch kernel build rc=0 -Werror; bug HW/module/runtime-gated, no runtime PoC re-test possible on guest.
↓ fix.diffcombined build rc=0

Confirmed kernel references

β€”

Detail

Exploit chain

none

Evidence (decisive lines)

REPRODUCED (source-only): ath_ioctl_phyerr DFS_GET_THRESH: outsize=sizeof(HAL_PHYERR_PARAM) reassigns LOCAL not allocation; memcpy(outdata,&peout,sizeof(HAL_PHYERR_PARAM)) writes sizeof(HAL_PHYERR_PAR

Verified recommended fix

REPRODUCED (source-only): ath_ioctl_phyerr DFS_GET_THRESH: outsize=sizeof(HAL_PHYERR_PARAM) reassigns LOCAL not allocation; memcpy(outdata,&peout,sizeof(HAL_PHYERR_PARAM)) writes sizeof(HAL_PHYERR_PARAM) bytes regardless of caller's outsize -> buffer overflow.

Verdict

REPRODUCED (source-only): ath_ioctl_phyerr DFS_GET_THRESH: outsize=sizeof(HAL_PHYERR_PARAM) reassigns LOCAL not allocation; memcpy(outdata,&peout,sizeof(HAL_PHYERR_PARAM)) writes sizeof(HAL_PHYERR_PARAM) bytes regardless of caller's outsize -> buffer overflow.