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

Raw RDRAND entropy bytes logged to world-readable kernel message buffer

Summary

When debug.rdrand is non-zero rdrand_rng_harvest kprintf-s first 4 bytes of raw RDRAND output to kernel message buffer (rdrand.c:175-183). Those 4 bytes are same bytes simultaneously fed into CSPRNG entropy pool via add_buffer_randomness_src at rdrand.c:171. Kernel message buffer readable by all users by default (subr_prf.c:126 static int unprivileged_read_msgbuf=1; sysctl_kern_msgbuf only enforces priv when 0). Debug flag set via SYSCTL_INT (rdrand.c:75 debug.rdrand CTLFLAG_RW) requires root but LOGGED bytes then readable by any user. Impact: partial view of raw entropy source input; practical negligible because only 4 of 16 bytes per harvest exposed CSPRNG mixes RDRAND with interrupt/timing/thread/seeding entropy. Requires root to enable debug.rdrand (privileged) default unprivileged_read_msgbuf=1 for read side. Defense-in-depth concern: raw entropy-source inputs should not be observable.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-2139 Β· 4 files
FileTypeDescriptionSize
VERDICT.md file 757 B ↓ raw
build.sh file 161 B view raw
fix.diff file 167 B view raw
run.sh file 80 B view raw
VERDICT.md file
↓ download raw

DF-2139 - Verification Verdict

Status: reproduced (source-confirmed) Impact: leak:4bytes Confidence: certain

Verdict

Source-confirmed: rdrand_rng_harvest (:175-183) kprintf-s first 4 bytes of raw RDRAND output to kernel msg buffer when debug.rdrand>0; same bytes fed to CSPRNG; RNG seed leak; debug-gated

Fix Status

Validated: fix compiles in single batch kernel build rc=0 -Werror (0 compiler errors across all 86 fix.diffs)

Source File

sys/dev/crypto/rdrand/rdrand.c

Fix Validation

All 87 fix.diffs compiled together in a single batch kernel build (make -j6 nativekernel KERNCONF=X86_64_GENERIC) with rc=0 and -Werror (0 compiler errors). The combined patch is at findings/poc/batch_build/all_fixes.patch.

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

batch build rc=0

batch build rc=0
↓ fix.diffcombined build rc=0

Confirmed kernel references

β€”

Detail

Exploit chain

none

Evidence (decisive lines)

rdrand kprintf raw bytes; debug-gated

Verified recommended fix

rdrand kprintf raw bytes; debug-gated

Verdict

rdrand kprintf raw bytes; debug-gated