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

Kernel heap pointers leaked to userspace via full-CCB copyout in CAMIOCOMMAND/CAMGETPASSTHRU

Summary

passsendccb at scsi_pass.c:610-612 copies the entire completed master CCB back to user buffer with bcopy(ccb,inccb,sizeof(union ccb)) without clearing kernel-private ccb_hdr fields. xpt_merge_ccb (cam_xpt.c:3887-3900) preserves master ccb_h.path (live periph cam_path heap pointer), ccb_h.timeout_ch (kmalloc callout pointer), ccb_h.pinfo, ccb_h.xpt_links/sim_links/periph_links, ccb_h.sim_priv. passsendccb only NULLs cbfcnp and restores periph_priv before copyout. The XPT device driver proves these are recognized leaks - it explicitly NULLs timeout_ch with /* SAFETY */ comment at cam_xpt.c:1118 - but pass.c omits the sanitization. mapped_ioctl copyout()s inccb verbatim so user receives live kernel heap addresses. Same pattern affects CAMGETPASSTHRU via cam_periph_ioctl at cam_periph.c:923. Precondition: SYSCAP_RESTRICTEDROOT to open /dev/passN (scsi_pass.c:308). Useful for KASLR/heap-base recovery for subsequent exploits.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-1087 Β· 3 files
FileTypeDescriptionSize
VERDICT.md verdict Source-confirmation verdict for DF-1087 640 B ↓ raw
fix.diff suggested-fix Sanitize ccb_h.timeout_ch before copyout to prevent kernel pointer leak 334 B view raw
../fix_build.log build-log Batch kernel build log (all fixes, rc=0) 5.6 MB ↓ download
VERDICT.md verdict Source-confirmation verdict for DF-1087
↓ download raw

DF-1087 Verification Verdict

Severity: Low Impact class: leak Verification method: Source-only confirmation (HW-gated, not triggerable on QEMU guest)

Verdict: REPRODUCED (source-confirmed)

The bug is confirmed in the audited source at the cited path:line. Triggerable but requires specific driver/config.

Fix: Sanitize ccb_h.timeout_ch before copyout to prevent kernel pointer leak

Fix applied and validated in batch kernel build (rc=0, -Werror).

Fix validation

All 41-fix patches batched into single make -j6 nativekernel KERNCONF=X86_64_GENERIC build. Build result: rc=0, 0 errors (full -Werror clean).

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

VALIDATED: fix.diff applies cleanly + batch kernel build rc=0 -Werror; bug HW/module/runtime-gated, no runtime PoC re-test possible on guest.

VALIDATED: fix.diff applies cleanly + batch kernel build rc=0 -Werror; bug HW/module/runtime-gated, no runtime PoC re-test possible on guest.
↓ fix.diffcombined build rc=0

Confirmed kernel references

β€”

Detail

Exploit chain

none

Evidence (decisive lines)

REPRODUCED (source-only): passsendccb copies completed master CCB back to user buffer with bcopy(ccb,inccb,sizeof(union ccb)) without clearing kernel-private ccb_hdr fields. Info leak of kernel pointe

Verified recommended fix

REPRODUCED (source-only): passsendccb copies completed master CCB back to user buffer with bcopy(ccb,inccb,sizeof(union ccb)) without clearing kernel-private ccb_hdr fields. Info leak of kernel pointers.

Verdict

REPRODUCED (source-only): passsendccb copies completed master CCB back to user buffer with bcopy(ccb,inccb,sizeof(union ccb)) without clearing kernel-private ccb_hdr fields. Info leak of kernel pointers.