OOB heap write/read on interrupt[8] via AHCI controllers with >8 ports
Summary
Controller interrupt[] array fixed at 8 entries (ata-pci.h:67 with XXX comment) but ata_pci_setup_intr ata_pci_teardown_intr and ata_generic_intr index it with unchecked channel unit number that can reach 0-31 for AHCI controllers. AHCI chipinit computes ctlr->channels from hardware CAP/PI registers (up to 32 per AHCI spec). When channels > 8 channels 8-31 cause OOB writes past interrupt[7] last field of ata_pci_controller softc corrupting adjacent kernel heap. OOB read in ata_generic_intr dereferences heap garbage as function pointers. interrupt[8] is LAST field of struct so writes 16 bytes per entry x 24 entries = 384 bytes past end on 64-bit. Attacker: malicious PCIe card PCI passthrough crafted QEMU AHCI device CAP.NP>=8. No disk I/O needed OOB write fires during auto-config. No upper bound check in any chipset path.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-2492 Β· 7 files| File | Type | Description | Size | |
|---|---|---|---|---|
| VERDICT.md | verdict | HW-gate analysis + source trace + fix summary | 1.9 KB | β raw |
| fix.diff | suggested-fix | git-apply-able defense-in-depth fix (applies + compiles) | 1.7 KB | view raw |
| fix_build.log | build-log | combined build proof: all 18 fix.diffs compile in X86_64_GENERIC (-Werror, rc=0); each diff also passes git apply --check | 404 B | view raw |
| manifest.json | manifest | this catalog | 1.6 KB | view raw |
| env.txt | environment | guest uname + PCI/kldstat/dev inventory proving the gate | 3.6 KB | view raw |
| build.sh | build-script | no-op (HW-gated, nothing to build) | 356 B | view raw |
| run.sh | run-script | no-op (HW-gated, nothing to run) | 268 B | view raw |
DF-2492 β OOB heap write/read on interrupt[8] via AHCI controllers with >8 channels
Verdict
NOT REPRODUCED (hardware / trigger gated). The cited vulnerable code path exists
in sys/dev/disk/nata/ata-pci.c and is compiled into the X86_64_GENERIC kernel, but it is not
exercisable at runtime on this QEMU guest because the required HBA / device /
trigger is absent. Confidence in the source bug itself: certain.
Why it cannot be reproduced here (the gate)
Hard-gated: needs an AHCI controller advertising >8 channels (interrupt[] is a fixed 8-entry array). The guest has NO AHCI controller (atapci0 is PIIX3 IDE class 0x010180, 2 channels).
See env.txt for the full guest PCI/kldstat/dev-node inventory that proves the
gate.
The bug is real in source (traced line-by-line)
Cited path:
- sys/dev/disk/nata/ata-pci.c:383-384
- sys/dev/disk/nata/ata-pci.c:403-404
- sys/dev/disk/nata/ata-pci.c:578-588
- sys/dev/disk/nata/ata-pci.h:67
- The vulnerable construct is present verbatim in the current master source
(confirmed by direct read of the cited lines during verification).
- A defense-in-depth fix.diff that closes the path is included and was
validated to apply (git apply --check) and to compile cleanly in a full
X86_64_GENERIC kernel build with -Werror (build rc=0).
Fix
Bound-check the channel unit against NELEM(controller->interrupt) in ata_pci_setup_intr/teardown_intr, and cap the generic_intr loop to the array size.
The standalone git-apply-able diff is fix.diff.
Reproduce
./build.sh && ./run.sh β both are no-ops on this guest by design (the gate
holds). Exercising the path requires the corresponding HBA/device/trigger
(ATA disk / ATAPI floppy or tape / NVMe controller / AdvanSys HBA / AHCI
controller / a malicious ATAPI device / a CD burner / hot-unplug).
Status
status: not_reproduced | reproduced: 0 | impact: none (HW-gated) fix_status: not_testable (path cannot run on this guest; diff applies + compiles)
Fix verification
not_testablenot_testable: the vulnerable path is unreachable on this guest (no target HW/malicious device). Fix validated structurally: git apply --check OK + full kernel build rc=0 (-Werror).
git apply --check findings/poc/DF-2492/fix.diff -> OK. Combined kernel build: 'NK_DONE rc=0'. No runtime before/after possible (HW-gated).
Confirmed kernel references
Detail
Exploit chain
none β valid hard blocker (driver/device path dead at runtime on this guest: no target HBA / no malicious device / no removable media). No unprivileged->root path.
Evidence (decisive lines)
kldstat -> kernel/ehci/xhci only (no target driver); pciconf -l -> PIIX3 IDE + virtio only (no AHCI/NVMe/AdvanSys HBA); camcontrol devlist -> only <QEMU QEMU DVD-ROM>; ls /dev/<target> -> No such file. Source confirmed at cited lines.
PoC changes
Created findings/poc/DF-2492/{VERDICT.md,fix.diff,env.txt,build.sh,run.sh,manifest.json,fix_build.log}. No PoC source (HW-gated).
Verified recommended fix
Defense-in-depth fix.diff adds the validation/bounds check closing the cited path (see findings/poc/DF-2492/fix.diff; git apply --check OK).
Verdict
NOT REPRODUCED (HW/trigger-gated on this guest). The bug is REAL in source (traced line-by-line): nata ata-pci interrupt[8] OOB when AHCI controller advertises >8 channels (no AHCI controller). Gate confirmed via kldstat (target driver not loaded; only kernel+ehci+xhci), pciconf -l (no target HBA β only PIIX3 IDE atapci0 + virtio), camcontrol devlist (only QEMU DVD-ROM), and ls /dev (no target disk/tape/fd/nvme nodes). The benign QEMU devices cannot produce the malicious device responses the bugs require.
No comments yet.