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

Kernel heap/buffer pointer disclosure to unprivileged dmesg readers via unconditional %p kprintf in hammer2 reptrack debug and check-failure paths

Summary

Two left-in reptrack debug prints and the krate(1/s) check-failure path print chain/bdata/dio/bp kernel addresses unconditionally; the message buffer is world-readable (verified as non-root) - the standard KASLR-defeat primitive on hardened configs (low value on this no-KASLR guest). Crafted image or bit rot induces the check failures at will. gate-or-drop-%p fix.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-5786 Β· 2 files
FileTypeDescriptionSize
README.md file 1.6 KB ↓ raw
verdict.json file 1.0 KB view raw
README.md file
↓ download raw

DF-5786 β€” kernel pointer disclosure to unprivileged dmesg readers via

hammer2 debug/error kprintf paths (pass 3; Info β€” hardening)

No PoC evidence pack: Low/Info hardening finding, verification skipped per audit contract (status recorded as untested by the orchestrator).

What

Unconditional kprintf("%p...") calls in sys/vfs/hammer2/hammer2_chain.c disclose kernel heap/object addresses to the console message buffer, which unprivileged users can read (dmesg/sysctl kern.msgbuf is world-readable on this guest β€” verified as user maxx during this session):

  • hammer2_chain.c:2266 kprintf("hammer2: debug REPTRACK %p->%p\n", parent, reptrack.chain) β€” reachable whenever hammer2_chain_repparent()'s parent-migration loop cycles (flusher/indirect-maintenance races).
  • hammer2_chain.c:2333-2334 kprintf("hammer2: debug repchange %p %p->%p\n", ...) β€” same machinery.
  • hammer2_chain.c:5460-5471 (hammer2_characterize_failed_chain) β€” prints chain, bdata, dio, bp pointers and buffer geometry on media check failures (krate-limited to 1/sec); check failures are attacker- inducible on a crafted image (mismatched check bytes) or by disk corruption.

Impact

Defeats kernel-address randomization for anyone who can read the message buffer (on guests/KASLR-less configs low value; on hardened configs it is the standard KASLR-bypass primitive). Info severity.

Suggested fix

Drop %p from these messages (print keys/tids instead of addresses), or gate them behind hammer2_debug bits like the neighboring LOST PARENT RETRY message (hammer2_chain.c:3966).

Fix verification

not_testable
baseline no→ patch + rebuild →patched clean
per-fix-DF-5786

Confirmed kernel references

Detail

Evidence (decisive lines)

static: unconditional %p at :2266/:2333/:5460; msgbuf world-readable verified on guest

Verified recommended fix

drop %p or gate behind hammer2_debug

Verdict

untested (Info pointer-disclosure; qualitatively reproducible via mismatched-check image + non-root dmesg)