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

Heap overflow in update_slot_layout_info via unchecked ucConnNum

Summary

update_slot_layout_info at bios_parser.c:2634: check sizeof(ATOM_BRACKET_LAYOUT_RECORD)<=ucRecordSize only proves 1 flex element readable. :2654 slot_layout_info->num_of_connectors=record->ucConnNum (u8 0-255). :2655 loop writes connectors[j], connectors[MAX_CONNECTOR_NUMBER_PER_SLOT=16]. ucConnNum>16 -> heap overflow past slot_layout_info. Attacker controls position and connector_id values from VBIOS asConnInfo. Crafted VBIOS bracket layout record. Sibling of DF-1250/DF-1252. Fix: check ucConnNum<=MAX_CONNECTOR_NUMBER_PER_SLOT.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-1298 Β· 9 files
FileTypeDescriptionSize
VERDICT.md verdict source-trace verdict: latent heap overflow in VBIOS bracket-layout parser 2.8 KB ↓ raw
README.md readme build/run/expected for this hardware-gated finding 2.0 KB ↓ raw
trigger_path.c trigger-source documents the unreachable trigger path (no AMD GPU on guest) 1.1 KB view raw
fix.diff suggested-fix clamp num_of_connectors to MAX_CONNECTOR_NUMBER_PER_SLOT 777 B view raw
build.sh build-log no userspace PoC; documents hardware-gated nature 389 B view raw
run.sh run-log reachability check (module/PCI/CPU) 677 B view raw
env.txt environment guest uname, cc, PCI, CPU, module presence 2.2 KB view raw
../fix_build_combined.log build-log Combined 41-finding kernel build (rc=0, -Werror clean) 5.6 MB ↓ download
../fix_build_summary.txt build-summary Summary of the combined 41-finding kernel build 826 B view raw
README.md readme build/run/expected for this hardware-gated finding
↓ download raw

DF-1298 / DF-1305 / DF-1314 / DF-1315 β€” hardware-gated driver findings

These four findings are kernel driver/virtualization bugs that are confirmed real by source trace but that cannot run on the QEMU audit guest because the required hardware is absent (see env.txt):

Finding Subsystem Required hardware Present on guest?
DF-1298 amdgpu display VBIOS parser AMD GPU (amdgpu) NO (QEMU std-VGA only)
DF-1305 radeon kv DPM AMD radeon KV APU NO
DF-1314 radeon btc/evergreen DPM AMD radeon NI GPU NO
DF-1315 nvmm AMD-SVM backend AMD-SVM CPU NO (guest CPU has no SVM bit)

Build

./build.sh

There is no userspace PoC binary to compile for these β€” the vulnerable code is inside a kernel driver/VMM module that only executes when the relevant device attaches or the SVM backend runs. build.sh documents this.

Run

./run.sh

run.sh performs a reachability check (kldstat, pciconf, dmesg) and reports that the path is unreachable on this guest. No panic/leak is expected here because the trigger hardware is absent.

Expected (bug present, on a host WITH the hardware)

Each VERDICT.md describes the exact trigger and the kernel-level effect (heap overflow / OOB write / host DR7 persistence). On this guest those are latent.

Reproduce the FIX validation

The fix for each is fix.diff. To compile-validate a module fix: 1. scp fix.diff to the guest; cd /usr/src && patch -p1 < fix.diff 2. Build the relevant module, e.g. cd /usr/src && make -j6 MODULES_OVERRIDE=... or a full make -j6 nativekernel KERNCONF=X86_64_GENERIC (which also builds modules). 3. Confirm the module/object compiles with no errors (see fix_build.log).

Runtime fix-behaviour cannot be compared on this guest because the PoC paths are hardware-gated; the fix is therefore classified not_testable with a compile + source-trace validation.

VERDICT.md verdict source-trace verdict: latent heap overflow in VBIOS bracket-layout parser
↓ download raw

DF-1298 β€” update_slot_layout_info heap overflow (amdgpu display VBIOS parser)

Verdict

NOT TESTABLE AT RUNTIME on this guest β€” confirmed real latent vulnerability in source.

Mechanism (confirmed by source trace)

sys/dev/drm/amd/display/dc/bios/bios_parser.c:2601 update_slot_layout_info() parses an ATOM_BRACKET_LAYOUT_RECORD from the GPU's VBIOS image.

  • Line 2634: the guard sizeof(ATOM_BRACKET_LAYOUT_RECORD) <= record_header->ucRecordSize only proves the base struct (one flex element) is readable β€” it says nothing about the connector count.
  • Line 2654: slot_layout_info->num_of_connectors = record->ucConnNum; (ucConnNum is a raw u8 from VBIOS, range 0–255, no bounds check).
  • Line 2655: for (j = 0; j < slot_layout_info->num_of_connectors; ++j) writes slot_layout_info->connectors[j] each iteration.
  • connectors is a fixed array of MAX_CONNECTOR_NUMBER_PER_SLOT = 16 (sys/dev/drm/amd/display/include/grph_object_defs.h:172). slot_layout_info is &board_layout_info->slots[i] (line 2777), an embedded struct, so an overflow writes past the slot into adjacent slots[] / whatever follows the board_layout_info allocation β†’ heap overflow. The overflow bytes (connector_type, length, position, connector_id) are all attacker-shaped (taken from the VBIOS record), so content is controllable.

Why it does not reproduce on this guest

  • amdgpu is not in X86_64_GENERIC; it exists only as the loadable module amdgpu.ko, which is not loaded (kldstat).
  • The only VGA device is vgapci0 = QEMU/Bochs std-VGA (1234:1111), not an AMD GPU. amdgpu never attaches, so the VBIOS parser never runs.
  • The parsed data is the GPU card's own VBIOS ROM β€” there is no userspace syscall that feeds this parser on a GPU-less machine. (Case d: genuinely not reachable on this kernel/guest.)

Severity / realistic ceiling

On a host with an AMD GPU whose VBIOS contains (or has been maliciously reflashed to contain) ucConnNum > 16, this is a kernel heap overflow in the display init path. Realistic impact: panic / heap corruption at GPU/driver bring-up; the data comes from firmware, so the practical attack vector is a malicious or buggy VBIOS rather than a pure unprivileged syscall. Still a real memory-safety defect worth fixing.

Fix (see fix.diff)

Clamp num_of_connectors to MAX_CONNECTOR_NUMBER_PER_SLOT before the loop. This is a compile-validated one-line guard (module build of amdgpu / or kernel module compile). Runtime cannot be exercised on the GPU-less guest.

Note

The job brief's "DF-1298: mpr SAS" label was wrong β€” bios_parser.c is the amdgpu display BIOS parser, not the mpr SCSI driver. Verified against the DB (file = sys/dev/drm/amd/display/dc/bios/bios_parser.c).

Fix verification

not_testable

compile+boot validated -Werror

nativekernel rc=0, boots #1 clean
↓ fix.diffDragonFly 6.5-DEVELOPMENT #1: Fri Jul 17 11:03:53 UTC 2026

Confirmed kernel references

β€”

Detail

Exploit chain

none

Evidence (decisive lines)

β€”

Verdict

Source-confirmed. amdgpu bios_parser update_slot_layout_info ucConnNum u8 unbounded vs connectors[16]. Not in GENERIC.