Stack buffer overflow in ACPI SMBus handler: buf[32] vs attacker-controlled GSBUS lengths
Summary
smbus_acpi_space_handler() uses 32-byte stack buffer char buf[32] (sized for classic SMBus block transfers) but exposes it to ACPI GenericSerialBus transfers which ACPI spec and ACPICA allow to be up to 255 data bytes. AML-controlled lengths copied/transferred into buf with no bounds check on three paths: ATTRIB_BLOCK WRITE memcpy(buf gsb->data gsb->len) where gsb->len is [0 255]. ATTRIB_BYTES WRITE memcpy(buf gsb->data info->AccessLength) where AccessLength is UINT8 [0 255]. ATTRIB_BYTES READ passes buf and info->AccessLength to SMBUS_TRANS ig4 writes rcount bytes into rbuf no bounds check. Any value >32 smashes kernel stack. Attacker: malicious ACPI table (compromised firmware SSDT loaded via loader.conf runtime injection). Impact: stack corruption up to 223 bytes controlled content local DoS or kernel code execution.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-2332 Β· 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) | 762 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-2332 β PoC verdict
File: sys/bus/smbus/smbacpi/smbacpi.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)
smbus_acpi_space_handler() uses a 32-byte stack buffer char buf[32] but exposes it to ACPI GenericSerialBus transfers (up to 255 data bytes). memcpy(buf,gsb->data,gsb->len) [ATTRIB_BLOCK WRITE] and memcpy(buf,gsb->data,info->AccessLength) [ATTRIB_BYTES WRITE] have no bounds check; values >32 smash the kernel stack.
Cited lines
sys/bus/smbus/smbacpi/smbacpi.c:137sys/bus/smbus/smbacpi/smbacpi.c:208sys/bus/smbus/smbacpi/smbacpi.c:223
Why it does not reproduce on this guest
No ACPI SMBus (GenericSerialBus) device/AML on the QEMU guest; smbacpi does not attach (the PIIX3 0x7113 node is reported "none", not as an ACPI SMBus opregion). No /dev/smbus*.
Guest gate-proof (full usbconfig/pciconf/ifconfig/devinfo/sysctl/kldstat output) is in env.txt.
Defense-in-depth fix
Bound-check gsb->len and info->AccessLength against sizeof(buf) (return AE_AML_NUMERIC_OVERFLOW + goto err if exceeded) on both paths.
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-2332/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-2332/{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-2332/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): smbacpi char buf[32] vs GenericSerialBus up to 255 bytes stack overflow (no ACPI SMBus opregion). 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.