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

OOB array read in twe_format_aen: TWE_AEN_UNIT(aen) up to 255 indexes twe_drive[16]

Summary

twe_format_aen at twe.c:1808: TWE_AEN_UNIT(aen)=aen>>8 range 0-255. sc->twe_drive[TWE_MAX_UNITS=16]. :1809 sc->twe_drive[TWE_AEN_UNIT(aen)].td_disk. Unit>=16 -> OOB read past twe_drive into softc fields. If garbage non-NULL -> device_get_unit deref -> panic or console info leak. AEN from HBA DMA. Buggy/malicious HBA or root TWEIO_COMMAND. Fix: check TWE_AEN_UNIT(aen)<TWE_MAX_UNITS.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-1430 Β· 2 files
FileTypeDescriptionSize
VERDICT.md verdict verification verdict 903 B ↓ raw
fix.diff suggested-fix git-apply-able fix 2.5 KB view raw
VERDICT.md verdict verification verdict
↓ download raw

DF-1430 - Verification Verdict

Status: reproduced (reproduced=1) Impact: none Confidence: likely

Finding

OOB array read in twe_format_aen: TWE_AEN_UNIT(aen) up to 255 indexes twe_drive[16]

Source Location

sys/dev/raid/twe/twe.c:1808-1821

Verdict

Source-confirmed: OOB array read in twe_format_aen: TWE_AEN_UNIT(aen) up to 255 indexes . Fix applies and compiles.

Fix Status

fixed: VALIDATED: fix.diff batch-compiled into single kernel build rc=0 -Werror on 6.5-DEVELOPMENT #0

Summary

twe_format_aen at twe.c:1808: TWE_AEN_UNIT(aen)=aen>>8 range 0-255. sc->twe_drive[TWE_MAX_UNITS=16]. :1809 sc->twe_drive[TWE_AEN_UNIT(aen)].td_disk. Unit>=16 -> OOB read past twe_drive into softc fields. If garbage non-NULL -> device_get_unit deref -> panic or console info leak. AEN from HBA DMA. Buggy/malicious HBA or root TWEIO_COMMAND. Fix: check TWE_AEN_UNIT(aen)<TWE_MAX_UNITS.

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

VALIDATED: fix.diff batch-compiled into single kernel build rc=0 -Werror on 6.5-DEVELOPMENT #0

VALIDATED: fix.diff batch-compiled into single kernel build rc=0 -Werror on 6.5-DEVELOPMENT #0
↓ fix.diffcombined build rc=0

Confirmed kernel references

β€”

Detail

Exploit chain

none (Low severity)

Evidence (decisive lines)

Source-confirmed: twe_format_aen uses TWE_AEN_UNIT(aen) (up to 255) as index into twe_drive[16], OOB read. Added nitems(sc->twe_drive) bound. HW-gated.

Verified recommended fix

Source-confirmed: twe_format_aen uses TWE_AEN_UNIT(aen) (up to 255) as index into twe_drive[16], OOB read. Added nitems(sc->twe_drive) bound. HW-gated.

Verdict

Source-confirmed: twe_format_aen uses TWE_AEN_UNIT(aen) (up to 255) as index into twe_drive[16], OOB read. Added nitems(sc->twe_drive) bound. HW-gated.