Heap OOB write in cmi_order[] when BIOS exposes >128 CMI instances
Summary
acpi_hp_hpcmi_read populates sc->cmi_order[128] (fixed-size array last field of acpi_hp_softc) by enumerating WMI CMI instances. Loop bound maxInstance from sc->has_cmi which is NOT boolean - ACPI_WMI_PROVIDES_GUID_STRING returns max_instance+1 (up to 256). Insertion code has no check cmi_order_size<128 before shift+insert so BIOS exposing >128 CMI instances produces kernel-heap overflow past softc. Each element 8 bytes so up to ~(maxInstance-128)*8 bytes written past end. i<127 literal is botched bound: caps search (and only to 127 missing index 127) not the write. Local unprivileged attacker opens /dev/hpcmi (0644) reads from it forces full CMI enumeration corrupts kernel heap.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-2382 Β· 5 files| File | Type | Description | Size | |
|---|---|---|---|---|
| VERDICT.md | verdict | analysis: code bug confirmed, gate confirmed, fix authored | 1.6 KB | β raw |
| fix.diff | suggested-fix | git-apply-able defense-in-depth fix (verified --check clean) | 621 B | view raw |
| env.txt | environment | guest gate-proof: usbconfig/pciconf/ifconfig/devinfo/sysctl output | 2.0 KB | view raw |
| build.sh | build-script | no-op (no live-device PoC) | 255 B | view raw |
| run.sh | run-script | gate check (required device is absent) | 333 B | view raw |
DF-2382 β PoC verdict
File: sys/dev/acpica/acpi_hp/acpi_hp.c
Verdict: NOT REPRODUCED on this QEMU guest β confirmed HW/ACPI/device-gated; the code bug is REAL and a defense-in-depth fix.diff is attached.
Mechanism (confirmed in source)
acpi_hp_hpcmi_read populates sc->cmi_order[128] by enumerating WMI CMI instances. The loop bound maxInstance comes from sc->has_cmi which is NOT boolean - ACPI_WMI_PROVIDES_GUID_STRING returns max_instance+1 (up to 256). There is no cmi_order_size<128 check before the shift+insert, so a BIOS exposing >128 CMI instances overflows cmi_order past the softc.
Cited lines
Why it does not reproduce on this guest
No HP WMI/CMI ACPI table on the QEMU/BOCHS guest (sysctl hw.acpi.hp/dev.hp -> unknown oid; acpi_hp does not attach; no /dev/hpcmi).
Guest gate-proof (full usbconfig/pciconf/ifconfig/devinfo/sysctl/kldstat output) is in env.txt.
Defense-in-depth fix
Before the insert-shift, check sc->cmi_order_size >= nitems(sc->cmi_order) (128) and break the enumeration if full.
The git-apply-able diff is in fix.diff (verified git apply --check clean).
Classification
status: not_reproducedreproduced: 0impact: none (not reachable on this guest; latent code bug confirmed in source)confidence: certain (code bug + gate both confirmed by direct source trace and guest enumeration)fix_status: not_testable (patch applies + compiles-correct by inspection, but no live device to exercise on this guest)
Fix verification
not_testablenot_testable: target device absent on this guest. fix.diff applies clean and is source-correct; no live device to exercise.
git apply --check findings/poc/DF-2382/fix.diff -> OK. No runtime test possible (HW/ACPI/device-gated).
Confirmed kernel references
Detail
Exploit chain
none β valid hard blocker (driver/device path dead at runtime on this guest: no target HW/ACPI/device). No unprivileged->root path.
Evidence (decisive lines)
usbconfig list -> No device match; pciconf -l -> no target HW/capability; ifconfig -> vtnet0 lo0; kldstat -> kernel/ehci/xhci only; sysctl/devinfo -> no target OIDs. Source confirmed at cited lines.
PoC changes
Created findings/poc/DF-2382/{VERDICT.md,fix.diff,manifest.json,env.txt,build.sh,run.sh}. No PoC source (HW/ACPI/device-gated).
Verified recommended fix
Defense-in-depth fix.diff closes the cited path (see findings/poc/DF-2382/fix.diff; git apply --check OK).
Verdict
NOT REPRODUCED (HW/ACPI/device-gated on this guest). The bug is REAL in source (traced line-by-line): acpi_hp cmi_order[128] OOB when BIOS exposes >128 WMI CMI (no HP WMI/CMI ACPI). Gate confirmed via usbconfig list (no devices), pciconf -l (no target HW/capability), ifconfig (vtnet0 lo0 only), kldstat (no target module), sysctl/devinfo (no target ACPI/device OIDs). The benign QEMU environment cannot produce the malicious device/ACPI/descriptor the bug requires.
No comments yet.