Summary
NetBSD's hdaudio(4) driver does not adequately restrict access to the HDAUDIO_FGRP_SETCONFIG ioctl on /dev/hdaudioN device nodes. An unprivileged local attacker may trigger a race involving live DMA and interrupts, potentially causing an audio-subsystem denial of service, kernel panic, or local kernel privilege escalation.
Affected context
The issue occurs in NetBSD systems exposing hdaudio(4) device nodes where:
- Unprivileged users can access /dev/hdaudioN
- The HDAUDIO_FGRP_SETCONFIG ioctl is available without an effective access check
- Audio streams, DMA activity, and interrupt handling remain active during configuration changes
Systems with stronger device-node permissions or restricted local access may reduce the practical exposure.
Exploit preconditions
- Attack surface: Local kernel device interface through /dev/hdaudioN
- Required access: An unprivileged local account with permission to open and interact with the device node
- Trigger point: Invocation of HDAUDIO_FGRP_SETCONFIG while audio DMA and interrupt processing remain active
- Why exploitation is possible: Missing authorization permits configuration changes, while concurrent teardown and interrupt activity can expose a use-after-free condition in the driver
Why this happens
The primary weakness is missing access control, mapped to CWE-862, because a privileged device operation is reachable without an appropriate authorization check.
The unsafe operation can also create a concurrency-related lifetime violation: hdafg_detach() may release callback-related state while a latched DMA interrupt can still reference it. This secondary behavior is consistent with a use-after-free condition, CWE-416, caused by insufficient synchronization between resource teardown and asynchronous interrupt activity.
Potential impact
- An attacker may crash the kernel or trigger a system panic
- The audio subsystem could become unavailable, causing local denial of service
- Kernel memory corruption could occur through stale callback references
- An attacker could potentially obtain local kernel-level privileges
- System availability and integrity may be affected until recovery or reboot
General mitigation guidance
Mitigation generally focuses on reducing access to privileged device operations and enforcing safe resource lifetimes.
Common defensive patterns include:
- Applying explicit authorization checks to configuration-changing ioctls
- Restricting /dev/hdaudioN ownership, modes, and group access according to least privilege
- Treating device-node access as a security boundary rather than relying on caller identity assumptions
- Synchronizing stream teardown, callback removal, DMA shutdown, and interrupt quiescence
- Ensuring callback pointers remain valid until all possible asynchronous users have stopped
- Using defensive lifetime management and state checks around concurrent driver operations
These controls address both the missing authorization boundary and the race-prone teardown path without relying on version-specific remediation instructions.
How teams detect issues like this
Detection approaches may include:
- Static analysis rules that identify ioctls lacking caller authorization checks
- Code review of device-driver entry points for privilege-sensitive configuration operations
- Concurrency analysis of detach, DMA, interrupt, and callback lifetimes
- Kernel testing that exercises device configuration changes during active streaming
- Runtime monitoring for unexpected unprivileged access to hdaudio device nodes and repeated configuration requests
- Policy checks verifying that device nodes are not broadly accessible to local users
Automated security review tools can help flag missing access checks and suspicious resource-release patterns, but driver-specific concurrency testing remains important.

