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

nexus_get_resource() leftover debug kprintf discloses kernel stack and heap pointers to unprivileged local users via console log

Summary

Every bus_get_resource on a nexus child prints the caller's stack variable addresses and the rle heap pointer - lands in dmesg AND mode-644 /var/log/messages, read by unprivileged uid=1001 ('startp 0xfffff801... countp ... got 0xfffff800...'). KASLR-breaking material on hardened kernels. No in-tree runtime caller (grandchildren dispatch to their own methods) hence Low. Delete-the-print fix (0 occurrences after).

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-5451 Β· 11 files
FileTypeDescriptionSize
nxget.c β€” 2.0 KB view raw
build.sh β€” 81 B view raw
run.sh β€” 205 B view raw
build.log β€” 1.1 KB view raw
run.log β€” 1.4 KB view raw
run.2.log β€” 731 B view raw
fix_run.log β€” 499 B view raw
fix.diff β€” 340 B view raw
env.txt β€” 687 B view raw
VERDICT.md β€” 2.3 KB ↓ raw
verdict.json β€” 2.8 KB view raw
VERDICT.md
↓ download raw

DF-5451 VERDICT β€” REPRODUCED (kernel pointer disclosure to unprivileged users)

Finding

nexus_get_resource() β€” sys/platform/pc64/x86_64/nexus.c:560-576 β€” contains a leftover debug device_printf() at nexus.c:567-568 that prints, for every bus_get_resource() (and bus_get_resource_start/count, sys/kern/subr_bus.c:3391,3401,3414) on a direct nexus child: - startp/countp: addresses of the caller's output variables β€” kernel stack addresses; - got %p: the kmalloc'd struct resource_list_entry β€” kernel heap address.

Reproduction (baseline, kernel #0 Jul 2 2026)

KLD nxget.ko (nexus child) performs one ordinary bus_get_resource():

nxget0: type 3  rid 7  startp 0xfffff801180c7718  countp 0xfffff801180c7720 - got 0xfffff8008dc229d8

The line appears in dmesg AND /var/log/messages (mode 644 on this system); an unprivileged user (uid=1001) read both:

$ dmesg | grep -c startp        -> 1
$ grep -c startp /var/log/messages -> 1

Second run on a different boot leaked different addresses (0xfffff801183a3718 / 0xfffff8008dc22e00) β€” real per-boot kernel stack and heap addresses, not constants.

Impact

Local unprivileged users observe kernel stack and heap pointers. This system runs without kernel address randomization of these regions, so the immediate value is limited, but the disclosure is unconditional, logged permanently, and becomes KASLR-breaking material on hardened kernels; it is also pure debug cruft with no functional purpose. Trigger requires a driver to call bus_get_resource on a nexus child (rare in-tree β€” e.g. no current caller; KLD/out-of-tree and future in-tree callers hit it). Severity Low.

Fix validation (kernel #1 Oct 5 17:59:42)

fix.diff deletes the two printf lines. Patched result (fix_run.log): no startp line in dmesg or /var/log/messages; bus_get_resource() still returns 0 with correct values.

Kernel refs

sys/platform/pc64/x86_64/nexus.c:560-576 (printf at 567-568) sys/kern/subr_bus.c:3391, 3401, 3414

Fix status (batch validation)

Applied with the 36 sibling fix.diffs of this batch in findings/poc/_batch41/all_fixes.patch; single in-guest make -j6 nativekernel KERNCONF=X86_64_GENERIC completed RC=0 with zero errors under -Werror (full log: findings/poc/_batch41/fix_build8.log). Behavior A/B intentionally skipped for this Info-tier item.

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

fix.combined.diff applied in guest /usr/src, nativekernel rebuilt and booted: no 'startp' pointer line in dmesg or /var/log/messages; bus_get_resource() still succeeds with correct values

findings/poc/DF-5451/fix_run.log ([messages] count 0 on patched kernel)
↓ fix.diffper-fix-DF-5451

Confirmed kernel references

Detail

Exploit chain

Unprivileged local user reads /var/log/messages or runs dmesg -> obtains kernel stack and heap addresses (0xfffff801.../0xfffff800...) whenever any driver queried a nexus child's resource. Value today is limited (no KASLR on these regions in this build) but it is an unconditional, permanently-logged kernel-address disclosure (KASLR-breaking on hardened kernels).

Evidence (decisive lines)

run.log: 'startp 0xfffff801180c7718 countp 0xfffff801180c7720 - got 0xfffff8008dc229d8' present in dmesg and /var/log/messages; unprivileged 'dmesg | grep -c startp' = 1; run.2.log different boot/addresses; fix_run.log: 0 occurrences on patched kernel

PoC changes

none material: seed sketch concept kept as a nexus-child KLD performing one bus_get_resource(); added success/return-value print

Verified recommended fix

Delete the device_printf() at nexus.c:567-568

Verdict

REPRODUCED on the live guest: nexus_get_resource() (nexus.c:567-568) prints caller kernel-stack addresses (startp/countp) and the kmalloc'd resource_list_entry heap address via device_printf() on every bus_get_resource() of a direct nexus child. The line reached dmesg AND /var/log/messages (mode 644), both read successfully by an unprivileged uid=1001 user. Fix (delete the debug printf) validated on a rebuilt kernel: line gone, bus_get_resource() still returns correct values.