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

Untrusted IOC-supplied indices index raid_disks/raid_volumes arrays without bounds checks (OOB read/write of kernel heap)

Summary

Driver sizes raid_disks to ioc_page2 MaxPhysDisks and raid_volumes to MaxVolumes (both U8 set at mpt.c) but then indexes those same arrays with PhysDiskNum/VolumePageNumber values read from separate IOC config pages and IR events without ever comparing index to raid_max_disks/raid_max_volumes. Five sites: mpt_raid_event :413-414 mpt_refresh_raid_vol :1309-1311 (WRITES kernel pointer volume) mpt_announce_vol :1155 mpt_refresh_raid_data :1405-1413 (RMW writes flags) :1436-1448 (RMW writes flags reads config_page). U8 index can range 0-254 while array sized by unrelated U8 typically 2-8. Malicious/faulty IOC (PCIe DMA peripheral emulated mptsas guest firmware bug) supplies out-of-range index. Impact: heap OOB write of kernel pointer and u_int fields at attacker-influenced offsets up to ~38KB past raid_disks -> kernel memory corruption privilege escalation or panic.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-2484 Β· 6 files
FileTypeDescriptionSize
VERDICT.md verdict Source trace confirming DF-2484 bug is real but HW-gated 1.3 KB ↓ raw
fix.diff suggested-fix Add raid_max_disks/raid_max_volumes bounds checks at all 5 IOC-index sites 1.8 KB view raw
env.txt environment Guest gate proof: kldstat, pciconf, camcontrol (no target HBA) 1.1 KB view raw
build.sh build-script No buildable PoC (HW-gated) 384 B view raw
run.sh run-script Gate verification commands 411 B view raw
README.md readme Overview of HW-gated finding 791 B ↓ raw
README.md readme Overview of HW-gated finding
↓ download raw

HW-gated SCSI/FC HBA driver finding

This finding targets a SCSI/FC/SATA HBA driver that is not present in this QEMU/KVM guest (only PIIX3 IDE + virtio). The driver cannot attach and the cited code path is unreachable at runtime.

Reproduction status: NOT REPRODUCED (HW-gated)

  • The source bug is confirmed real by line-by-line source trace (see VERDICT.md).
  • It cannot be triggered because the HBA hardware/driver does not exist on this guest.
  • A defense-in-depth fix.diff has been authored and validated with git apply --check.

Evidence

  • VERDICT.md β€” full source trace and analysis
  • env.txt β€” guest environment (kldstat, pciconf, camcontrol gate proof)
  • fix.diff β€” git-apply-able defense-in-depth fix
  • manifest.json β€” machine-readable catalog
VERDICT.md verdict Source trace confirming DF-2484 bug is real but HW-gated
↓ download raw

DF-2484 β€” Untrusted IOC-supplied indices index raid_disks/raid_volumes

Verdict: NOT REPRODUCED (HW-gated) β€” source bug CONFIRMED

Hardware gate

No LSI Logic MPT HBA in guest: kldstat shows only kernel/ehci/xhci; pciconf -l shows no LSI device. RAID arrays do not exist.

Source trace (confirmed real bug)

File: sys/dev/disk/mpt/mpt_raid.c β€” five sites:

  1. Line 414: mpt_disk = mpt->raid_disks + raid_event->PhysDiskNum;
  2. Line 1155: mpt_disk = mpt->raid_disks + vol_pg->PhysDisk[i].PhysDiskNum;
  3. Line 1309: mpt_disk = mpt->raid_disks + vol_pg->PhysDisk[i].PhysDiskNum;
  4. Line 1405: mpt_disk = mpt->raid_disks + ioc_disk->PhysDiskNum;
  5. Line 1436: mpt_vol = mpt->raid_volumes + ioc_vol->VolumePageNumber;

None of these compare the index to raid_max_disks/raid_max_volumes. The arrays are sized by MaxPhysDisks/MaxVolumes (U8), but the indices are independently supplied U8 values from different IOC config pages. A malicious/faulty IOC can supply PhysDiskNum=254 when the array has 2-8 entries β†’ heap OOB write of kernel pointer and u_int fields up to ~38KB past the array.

Fix

Added >= raid_max_disks/>= raid_max_volumes bounds checks before each indexing site. See fix.diff.

Impact (on HW that has the HBA)

Medium β€” heap OOB read/write of kernel pointers and u_int fields via malicious IOC.

Fix verification

not_testable
baseline no→ patch + rebuild →patched clean

not_testable: target driver cannot attach (no target HBA). fix.diff validated with git apply --check (EXIT=0); fix is correct by source trace.

git apply --check findings/poc/DF-2484/fix.diff => EXIT=0. No runtime test possible (no target HBA).
↓ fix.diffDragonFly 6.5-DEVELOPMENT #0 (unpatched with-src baseline β€” target driver not loadable on this guest)

Confirmed kernel references

Detail

Exploit chain

none β€” valid hard blocker (driver code path dead at runtime on this guest: no target HBA). No unprivileged->root path.

Evidence (decisive lines)

kldstat -> kernel/ehci/xhci only (no target driver); pciconf -l -> PIIX3 IDE + virtio only (no target HBA); camcontrol devlist -> only <QEMU QEMU DVD-ROM>. Source confirmed at cited lines.

PoC changes

Created findings/poc/DF-2484/{VERDICT.md,fix.diff,manifest.json,env.txt,build.sh,run.sh,README.md}. No PoC source (HW-gated).

Verified recommended fix

Defense-in-depth fix.diff closes the cited path (see findings/poc/DF-2484/fix.diff; git apply --check OK).

Verdict

NOT REPRODUCED (HW-gated). The bug is REAL in source (traced line-by-line): mpt_raid untrusted IOC indices index raid_disks/raid_volumes OOB (needs LSI MPT RAID HBA). Gate confirmed: kldstat (only kernel+ehci+xhci; no isp/mpt/sili/trm/sbp module loaded), pciconf -l (no QLogic ISP/LSI MPT/SiliconImage/Tekram/FireWire HBA β€” only PIIX3 IDE atapci0 + virtio), camcontrol devlist (only QEMU DVD-ROM). The target driver cannot attach so the cited code path is dead at runtime on this guest.