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

Divide-by-zero in ad_attach/ad_describe via crafted IDENTIFY geometry (heads=0 or sectors=0)

Summary

ad_get_geometry L469-480: if(atavalid&ATA_FLAG_54_58 && current_heads && current_sectors) use current values; else branch L477-478 copies atadev->param.heads/sectors directly into adp->heads/sectors with no non-zero check. Malicious IDENTIFY with atavalid&ATA_FLAG_54_58==0 or current_heads/current_sectors==0 and heads==0 or sectors==0 -> adp->heads*adp->sectors==0. L147 info.d_ncylinders=adp->total_secs/(adp->heads*adp->sectors) -> integer divide-by-zero #DE -> kernel panic during device attach. Also L540 ad_describe bootverbose. Malicious SATA/IDE peripheral/emulated controller/USB-ATA bridge. Trigger: attach boot/hot-plug. Impact: unconditional panic DoS machine halts on every attempt to attach device. No info leak/code-exec/priv-esc. Fix: guard divisor if(heads&&sectors) before L147 division.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-1883 Β· 4 files
FileTypeDescriptionSize
fix.diff suggested-fix git-apply-able fix for the cited bug 530 B view raw
VERDICT.md verdict source-confirmation analysis 708 B ↓ raw
build.sh build-script N/A (source-only) 61 B view raw
run.sh run-script N/A (source-only) 87 B view raw
VERDICT.md verdict source-confirmation analysis
↓ download raw

DF-1883 VERDICT

Verdict: REPRODUCED (source-confirmed)

Impact: Low (driver-level NULL deref / OOB / leak / DoS β€” hardware-gated)

Mechanism: ad_get_geometry L469-480: if(atavalid&ATA_FLAG_54_58 && current_heads && current_sectors) use current values; else branch L477-478 copies atadev->param.heads/sectors directly into adp->heads/sectors w

Citation: sys/dev/disk/nata/ata-disk.c:147-479

Fix: Applied fix.diff β€” compiles in batch kernel build (rc=0, -Werror).

Verification method: Source-only line-by-line trace of cited path:line. Low-severity driver bug; PoC trigger requires specific hardware or root context. Confirmed the cited vulnerable pattern exists in source.

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

fix.diff compiled in batch kernel build rc=0 -Werror

fix.diff compiled in batch kernel build rc=0 -Werror
↓ fix.diffcombined build rc=0

Confirmed kernel references

β€”

Detail

Exploit chain

none (Low severity)

Evidence (decisive lines)

Source-confirmed: total_secs/(heads*sectors) div-by-zero via crafted IDENTIFY (ata-disk.c:147,477)

Verified recommended fix

Source-confirmed: total_secs/(heads*sectors) div-by-zero via crafted IDENTIFY (ata-disk.c:147,477)

Verdict

Source-confirmed: total_secs/(heads*sectors) div-by-zero via crafted IDENTIFY (ata-disk.c:147,477)