CVE-2026-105418: NULL pointer dereference in SocketCAN getsockopt/setsockopt on an unbound socket
The SocketCAN socket layer in subsys/net/lib/sockets/socketscan.c dereferences a NULL device pointer when a NETSOLCANRAW socket option is read or written on a CAN socket that has not yet been bound. A freshly created CAN socket has interface index -1. netcontextgetiface() therefore returns NULL, netifgetdevice() returns NULL, and cansocksetsockoptvmeth() / cansockgetsockoptvmeth() read dev->api without a check and then call through the resulting pointer.
Any thread that can create a CAN socket can trigger the dereference by calling setsockopt() or getsockopt() at level SOLCANRAW before bind(). That ordering is common in code ported from Linux. Because zsocksocket, zsocksetsockopt and zsockgetsockopt are system calls, an unprivileged user-mode thread on a CONFIGUSERSPACE build with CONFIGNETSOCKETSCAN enabled can make the kernel perform the faulting access in supervisor mode.
The result is a kernel fatal error that halts or resets the system: a local denial of service across the user/kernel boundary. On targets without NULL-pointer fault detection, the kernel instead makes an indirect call through a value read from low memory, which the attacker does not control. Builds without CONFIGUSERSPACE gain no privilege boundary from this defect. The fix makes both socket-option handlers fail with ENODEV until the socket is bound to a CAN interface.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In both CAN socket-option handlers, return ENODEV when the socket is unbound, before dereferencing the device pointer.
Event History
Frequently Asked Questions
Which deployments have an unprivileged user/kernel-boundary denial-of-service risk?
The described cross-boundary risk applies to CONFIG_USERSPACE builds with CONFIG_NET_SOCKETS_CAN enabled, where an unprivileged user-mode thread can create and operate on CAN sockets. More generally, any thread able to create a CAN socket can trigger the fault.
What operation triggers the failure?
An attacker creates a CAN socket and calls getsockopt() or setsockopt() at the SOL_CAN_RAW level before binding the socket. A newly created socket has no associated interface, causing the device pointer used by the socket-option handlers to be NULL.
What can be done if patching is not immediately possible?
Ensure applications bind CAN sockets before reading or writing SOL_CAN_RAW socket options. Where CAN sockets are not required, disabling CONFIG_NET_SOCKETS_CAN removes the configuration identified as exposing this path.