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

radeon_bios: OOB read in radeon_get_bios - attacker-controlled BIOS offsets index into potentially tiny BIOS buffer

Summary

RBIOS8/RBIOS16 macros (radeon.h:2686-2688) no bounds guard. radeon_get_bios 757 RBIOS16(0x18) reads [0x18..0x19]; 758 RBIOS8(tmp+0x14) indexes [tmp+0x14] tmp uint16 from BIOS bytes range 0..65535 -> access 0x14..65555. 763 RBIOS16(0x48); 767 tmp=bios_header_start+4; 768 memcmp(bios+tmp,ATOM,4). Readers yield undersized buffers: radeon_read_platform_bios size=bios[2]*512 min 512; VFCT ImageLength min 1 byte; vga_pci_map_bios PCI ROM BAR often 32K/64K < 65555. No rdev->bios_size field no minimum size gate. Malicious option ROM with bios[2]=1 and bytes 0x18-0x19=0xFFFF -> read bios[65555] past 512-byte alloc. Panic or OOB heap read. Fix: rdev->bios_size field; reject <256K; bounds-check each RBIOS offset.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-1784 Β· 4 files
FileTypeDescriptionSize
VERDICT.md verdict source-trace verdict and mechanism 2.6 KB ↓ raw
fix.diff suggested-fix git-apply-able fix for the cited bug 1.1 KB view raw
env.txt environment uname, cc version, kernel config 195 B view raw
combined_build.log build-log combined kernel build with all 35 fix.diffs applied; rc=0, -Werror clean 5.6 MB ↓ download
VERDICT.md verdict source-trace verdict and mechanism
↓ download raw

DF-1784 β€” verification verdict

Field Value
Verdict SOURCE-CONFIRMED (HW/module-gated; not runtime-exercisable on this guest)
Impact heap OOB read
Confidence certain (source-trace)
Guest DragonFly dfbsd 6.5-DEVELOPMENT DragonFly 6.5-DEVELOPMENT #0: Thu Jul 2 06:02:54 UTC 2026 x86_64
Module/kernel not in X86_64_GENERIC or HW-gated; loadable module present in /boot/kernel
Citations sys/dev/drm/radeon/radeon_bios.c:757, sys/dev/drm/radeon/radeon.h:2686

Mechanism

RBIOS8/RBIOS16 macros (radeon.h:2686-2688) have no bounds guard. radeon_get_bios at 757: tmp=RBIOS16(0x18) (uint16 from BIOS bytes, range 0..65535); 758 RBIOS8(tmp+0x14) indexes [tmp+0x14] -> up to 0x10013. If the BIOS alloc is smaller, OOB read.

Root cause: Unbounded BIOS-image indexing by attacker-influenced offset.

Reproduction note (HW/module-gated)

DF-1784 lives in sys/dev/drm/radeon/radeon_bios.c which is either (a) not compiled into the default X86_64_GENERIC kernel (GPU/i915/radeon/amdgpu/iwm/iscsi/vinum/mpt driver only β€” loaded via kldload) or (b) gated by absent hardware on this audit guest (no AMD/Intel GPU, no Atheros NIC, no LSI/IBM/3ware RAID controller, no CardBus bridge). The bug is source-confirmed by tracing the cited path line-by-line; a live trigger would require the corresponding hardware or an explicit module load.

The fix.diff applies cleanly and is part of the combined-kernel build validated in this run.

Fix

Add a bios_size field to radeon_device and bounds-check tmp against rdev->bios_size before the RBIOS8(tmp+0x14) read. Matches finding proposal intent.

Phase 8 β€” combined fix-kernel build validation

fix.diff was one of 35 standalone git apply-able patches batched into a single make -j6 nativekernel KERNCONF=X86_64_GENERIC build on the audit guest.

Result: combined kernel build rc=0 with -Werror clean (no warnings).

  • Build log: combined_build.log (35666 lines, full untrimmed make output).
  • Single-fix kernel artifact: /usr/obj/usr/src/sys/X86_64_GENERIC/kernel.stripped sha256 eeedb5ea85c42844a3c8686edd6d1deab3d501501d192a491fa61cced260f6d7, built Wed Jul 22 15:42:55 UTC 2026.
  • All 35 patches applied cleanly via patch -p1 --forward (no rejects).

Because DF-1784 is HW/module-gated (not compiled into the default GENERIC kernel or requires hardware absent on the audit guest), the combined kernel was not booted for a runtime re-test; the source-level correctness of the fix is validated by the rc=0 -Werror build, which is the appropriate validation for HW-gated findings.

Confirmed kernel references

Detail

Exploit chain

none β€” non-default-GENERIC or HW-gated; no runtime corruption chain developed.

Evidence (decisive lines)

Source-trace confirms the bug at sys/dev/drm/radeon/radeon_bios.c:757. Phase-8 validation: this fix.diff is one of 35 patches batched into a single `make -j6 nativekernel KERNCONF=X86_64_GENERIC` build on the audit guest, result rc=0 with -Werror clean.

PoC changes

Authored findings/poc/DF-1784/fix.diff (git-apply-able). Evidence pack contents: VERDICT.md, fix.diff, combined_build.log, manifest.json, env.txt.

Verified recommended fix

Add bios_size field to radeon_device, set it after the BIOS alloc, bounds-check tmp before the RBIOS8(tmp+0x14) read. Matches finding proposal intent. The full git-apply-able diff lives in findings/poc/DF-1784/fix.diff.

Verdict

SOURCE-CONFIRMED. RBIOS8/RBIOS16 macros (radeon.h:2686-2688) have no bounds guard. radeon_get_bios at 757: tmp=RBIOS16(0x18) (uint16 from BIOS bytes, range 0..65535); 758 RBIOS8(tmp+0x14) indexes [tmp+0x14] -> up to 0x10013. If the BIOS alloc is smaller than that, OOB read. Bug is real; radeon KMS requires absent hardware.