DragonFlyBSD Kernel Audit
← triage · dashboard
DF-2960

kcollect_register pins no caller-module lifetime; kcollect_unregister unenforced — latent UAF (indirect call + strlen) for loadable-module consumers

Field Value
ID DF-2960
Status new
Severity Info
CVSS 3.1 CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:N/I:N/A:H
CWE CWE-416
File sys/kern/kern_collect.c
Lines 81-115 (sinks :161-164, :225-227)
Area kern
Confidence speculative
Discovered 2026-09-02
Pass 2 (GLM 5.3 second pass)
Bucket memcorrupt
Reported pending
Known CVE none
CVE match novel

Summary

kcollect_register() stores the caller's raw 'const char *id' and raw kcallback_t function pointer into global arrays with no reference on the registering module, and nothing enforces kcollect_unregister() (zero in-tree callers) before a kld unload. After such an unload, the kcollect thread indirect-calls through the dangling kcollect_callback[n] every 10 seconds and the sysctl strlen()s the dangling kcollect_slots[i] — a use-after-free control-flow primitive and a UAF read. Not reachable on a stock system: all five in-tree registrants are compiled-in, and triggering requires a third-party kld (i.e. root). Filed as hardening/defense-in-depth for the exported kernel API. Fix: copy the id string into fixed internal storage + make unregister a documented mandatory module-unload step.

Timeline

  • 2026-09-02 Discovered during pass-2 audit of kern_collect.c (GLM 5.3).

Discussion (0)

No comments yet.