Stack buffer overflow in cue_setmulti: 8-byte hashtbl indexed by 9-bit multicast hash
Summary
cue_setmulti sizes local hash table to 8 bytes (uint8_t hashtbl[8] at if_cue.c:311) but CATC EL1210A uses 512-bit/64-byte multicast hash table (if_cuereg.h:97) and CUE_BITS is 9 (if_cue.c:273) so cue_mchash returns 0..511. Statements hashtbl[h>>3]|=1<<(h&0x7) (:329 :338) index byte 0..63 into 8-byte stack array writing up to 56 bytes past end. Broadcast ff:ff:ff:ff:ff:ff hashes to 255 (h>>3=31) so overflow triggered deterministically and unconditionally on every cue_setmulti while IFF_BROADCAST set (default for Ethernet). cue_setmulti reached from cue_init on ifconfig up and from SIOCADDMULTI/SIOCDELMULTI ioctls via any local user setsockopt(IP_ADD_MEMBERSHIP). |= bit-set at attacker-influenced byte offsets [8..63] and bit positions [0..7]. By choosing multicast IP whose MAC hashes to desired 9-bit value local attacker selects corrupted stack offset and bit. On stack-protected kernel immediate panic DoS. Without canary corrupts saved frame pointer/return address local unpriv->kernel code execution. IP_ADD_MEMBERSHIP needs no privilege.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-2339 Β· 5 files| File | Type | Description | Size | |
|---|---|---|---|---|
| VERDICT.md | verdict | analysis: code bug confirmed, gate confirmed, fix authored | 1.7 KB | β raw |
| fix.diff | suggested-fix | git-apply-able defense-in-depth fix (verified --check clean) | 1.1 KB | 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-2339 β PoC verdict
File: sys/bus/u4b/net/if_cue.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)
cue_setmulti sizes the local hash table to 8 bytes (uint8_t hashtbl[8]) but CUE_BITS=9 makes cue_mchash return 0..511 for the device 512-bit/64-byte table (if_cuereg.h:96). hashtbl[h>>3] therefore indexes 0..63 into an 8-byte stack array (up to 56 bytes past end); broadcast hashes to 255, so it overflows deterministically.
Cited lines
sys/bus/u4b/net/if_cue.c:273-283sys/bus/u4b/net/if_cue.c:311sys/bus/u4b/net/if_cue.c:329sys/bus/u4b/net/if_cue.c:338sys/bus/u4b/net/if_cuereg.h:96-100
Why it does not reproduce on this guest
No CATC EL1210A USB-ethernet adapter on the QEMU guest (usbconfig list shows no devices; only ehci/xhci host-controller modules loaded; no /dev/cue*).
Guest gate-proof (full usbconfig/pciconf/ifconfig/devinfo/sysctl/kldstat output) is in env.txt.
Defense-in-depth fix
Add CUE_HASH_TABLE_LEN=64, size hashtbl[CUE_HASH_TABLE_LEN], fill 64 bytes in the ALLMULTI branch, and write 64 bytes via cue_mem.
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-2339/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-2339/{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-2339/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): cue_setmulti hashtbl[8] indexed by 9-bit hash -> stack overflow (no CATC USB-ethernet). 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.