# CVE-2026-85035 - Use-after-free via dynamically allocated message queue retained by the CAN RX filter

DevFeed: [CVE-2026-85035 - Use-after-free via dynamically allocated message queue retained by the CAN RX filter](<https://devfeed.tech/articles/cve-2026-85035-use-after-free-via-dynamically-allocated-message-queue-retained-by-the-can-rx-filter-114175.md>)

Original publisher: [Read original article](<https://cvefeed.io/vuln/detail/CVE-2026-85035>)

Author: cvefeed.io

Published: 2026-11-03T14:17:39Z

Content type: article

Language: en

Sources: [Latest High/Critical Vulnerabilitiy Feed](<https://devfeed.tech/sources/latest-high-critical-vulnerabilitiy-feed.md>)

Topics: [Memory Safety](<https://devfeed.tech/topics/memory-safety.md>)

Tags: [can](<https://devfeed.tech/tags/can.md>), [cve-2026-85035](<https://devfeed.tech/tags/cve-2026-85035.md>), [filter](<https://devfeed.tech/tags/filter.md>), [heap](<https://devfeed.tech/tags/heap.md>), [isolation](<https://devfeed.tech/tags/isolation.md>), [kernel](<https://devfeed.tech/tags/kernel.md>), [message-queue](<https://devfeed.tech/tags/message-queue.md>), [thread](<https://devfeed.tech/tags/thread.md>), [use-after-free](<https://devfeed.tech/tags/use-after-free.md>), [user](<https://devfeed.tech/tags/user.md>), [zephyr](<https://devfeed.tech/tags/zephyr.md>), [zephyrproject](<https://devfeed.tech/tags/zephyrproject.md>)

## AI overview

In Zephyr builds with CONFIG_USERSPACE=y and CONFIG_DYNAMIC_OBJECTS=y, a user-mode thread can register a CAN RX filter with a dynamically allocated message queue, then release the queue or exit. The filter retains a raw pointer, so a later matching frame can make supervisor-context code access freed memory and corrupt the kernel heap. The verifier previously checked type, initialization, and permission but not whether the queue would remain alive. The fix uses K_SYSCALL_OBJ_STATIC(), allowing only statically defined queues for user-mode registration. Supervisor-mode callers bypass that verifier and must keep the queue valid until removing the filter. The excerpt also notes the dangling-pointer risk if an application thread exits without removing its filter.

## Source excerpt

CVE ID :CVE-2026-85035 Published : Nov. 3, 2026, 2:17 p.m. | 1 hour, 12 minutes ago Description :The can_add_rx_filter_msgq() system call installs a CAN RX filter whose callback (can_msgq_put() in drivers/can/can_common.c) is handed the caller's struct k_msgq * as user_data. The controller driver stores that raw pointer in its filter table and dereferences it from the RX path every time a matching frame arrives. The system call verifier z_vrfy_can_add_rx_filter_msgq() in drivers/can/can_handlers.c validated the queue only with K_SYSCALL_OBJ(), which is a point-in-time check of type, initialization and caller permission and says nothing about the object's lifetime. On a build with CONFIG_USERSPACE=y and CONFIG_DYNAMIC_OBJECTS=y, an unprivileged user-mode thread that has been granted access to a CAN device can obtain a message queue whose lifetime it fully controls: k_object_alloc(K_OBJ_MSGQ) followed by k_msgq_alloc_init(). The lifetime of such an object is driven solely by its permission bitmask, and a pointer retained by the kernel is not represented there. After registering the filter, the thread calls k_object_release() -- or simply terminates -- and unref_check() frees the struct k_msgq storage while the CAN driver still holds the pointer. The next matching CAN frame causes k_msgq_put() to run in supervisor context against freed memory that the attacker can have groomed with another kernel allocation: the frame payload is memcpy()d through the reused block's write_ptr, and the queue's wait_q (and poll_events under CONFIG_POLL) list nodes are manipulated. This yields kernel-heap corruption reachable from a user-mode thread, defeating the isolation CONFIG_USERSPACE is intended to provide; the same dangling pointer also arises benignly when an application thread exits without calling can_remove_rx_filter(). The fix validates the queue with K_SYSCALL_OBJ_STATIC(), which additionally rejects objects carrying K_OBJ_FLAG_ALLOC, so only statically defined queues (CAN_MSGQ