{"id":"CVE-2026-78118","kind":"vulnerability","aliases":["CVE-2026-78118"],"related":[],"title":"Zephyr RTOS: timer race lets a local thread corrupt kernel memory","description":"The kernel helper z_waitq_head() (kernel/include/wait_q.h) reads the head of a thread wait queue, but on SMP systems it was called from several places without holding the scheduler spinlock _sched_spinlock that serializes wait-queue mutation. The consequential call site is z_timer_expiration_handler() in kernel/timer.c, which held only the timer subsystem lock timer_lock while reading timer->wait_q and then unpending, setting the return value of, and readying the thread it obtained. halt_thread() in kernel/sched.c removes an aborted thread from its wait queue while holding only _sched_spinlock, so the two paths are not mutually exclusive.\n\nWhen the last waiter is removed on another CPU inside that window, sys_dlist_peek_head() can return the list sentinel — a pointer into the k_timer object itself — typed as a struct k_thread * (with CONFIG_WAITQ_SCALABLE, rb_get_min() can return an arbitrary node of a tree being restructured), or it can return a pointer to a thread that has already been unpended and, for dynamically allocated threads, freed. The handler then calls unpend_thread_no_timeout(), which performs a sys_dlist_remove() through pointers read from that object, and arch_thread_return_value_set(), which writes unconditionally through the pointer.\n\nThe result is out-of-bounds and use-after-free writes in supervisor context, plus scheduler state corruption; a milder outcome is a thread that has re-pended elsewhere being woken with a success return value from an unrelated blocking call. All of the primitives needed to drive the interleaving — k_timer_start(), k_timer_status_sync(), k_thread_create() and k_thread_abort() — are system calls, so with CONFIG_USERSPACE enabled an unprivileged user-mode thread can attempt the race against kernel-owned data.\n\nExploitation requires a multi-CPU build (CONFIG_MP_MAX_NUM_CPUS greater than one; the affected region is a no-op on uniprocessor targets), local code execution, and winning a narrow timing window, so the practical outcome is most often a kernel crash rather than controlled corruption. The fix splits the helper into z_waitq_head_locked() for callers that already hold the scheduler spinlock and a z_waitq_head() that acquires it, and brings the timer expiration handler's head read, unpend and ready under a single LOCK_SCHED_SPINLOCK region.","summary":"On multi-CPU Zephyr builds, a race between the timer expiration handler and thread abort can make the kernel write through a stale or invalid thread pointer. A local user-mode thread with CONFIG_USERSPACE can attempt to trigger it, giving out-of-bounds and use-after-free writes in supervisor context that most often crash the kernel.","severity":"high","cvss":7.0,"epss":0.00083,"exploited":false,"exploited_at":null,"products":[],"ecosystems":[],"tags":["embedded","rtos","runtime","smp","zephyr"],"not_affected_if":["no-untrusted-local-code","no-userspace","uniprocessor-target"],"how_to_check":"- Check whether the build sets `CONFIG_MP_MAX_NUM_CPUS` greater than `1` in the device configuration.\n- Check whether `CONFIG_USERSPACE` is enabled, since user-mode threads are needed to drive the race.\n- Check the Zephyr version in use against the fixed release listed in the NVD entry.","fix":"- Update Zephyr to the release that includes the fix splitting `z_waitq_head()` and the timer handler locking change, as listed in the NVD entry (version unknown from these sources).\n- Rebuild and reflash affected firmware.","status":"open","published_at":"2026-10-21T19:17:03+00:00","first_seen_at":"2026-10-23T21:57:29+00:00","triaged_at":"2026-10-25T03:37:02+00:00","updated_at":"2026-10-25T03:37:02+00:00","category":"runtime","confidence":0.7,"triage":{"at":"2026-10-25T03:37:02Z","model":"claude-haiku-5-5","output":{"fix":"- Update Zephyr to the release that includes the fix splitting `z_waitq_head()` and the timer handler locking change, as listed in the NVD entry (version unknown from these sources).\n- Rebuild and reflash affected firmware.","reach":"local","title":"Zephyr RTOS: timer race lets a local thread corrupt kernel memory","impact":"high","summary":"On multi-CPU Zephyr builds, a race between the timer expiration handler and thread abort can make the kernel write through a stale or invalid thread pointer. A local user-mode thread with CONFIG_USERSPACE can attempt to trigger it, giving out-of-bounds and use-after-free writes in supervisor context that most often crash the kernel.","category":"runtime","nicknames":[],"who_cares":["zephyr","embedded","rtos","smp"],"confidence":0.7,"needs_auth":"yes","worst_case":"Kernel memory corruption or crash from a local user-mode thread","analyst_note":"Confirm the fixed Zephyr version and affected version range from the NVD entry and Zephyr security advisories.","how_to_check":"- Check whether the build sets `CONFIG_MP_MAX_NUM_CPUS` greater than `1` in the device configuration.\n- Check whether `CONFIG_USERSPACE` is enabled, since user-mode threads are needed to drive the race.\n- Check the Zephyr version in use against the fixed release listed in the NVD entry.","needs_analyst":true,"not_affected_if":["uniprocessor-target","no-userspace","no-untrusted-local-code"],"who_is_affected":"Only multi-CPU Zephyr builds are exposed, since the affected code is a no-op on uniprocessor targets. Exploitation needs local code execution and a user-mode thread on a system with CONFIG_USERSPACE, so teams running single-core targets or without untrusted local threads can skip it.","user_interaction":"no","needs_special_setup":"yes","severity_if_unknown":"high"},"cost_usd":0.000756,"input_tokens":4088,"output_tokens":695,"severity_before":"high"},"analyst_status":null,"analyst_note":null,"search":"'-2026':13A,16A '-78118':14A,17A 'abort':38B,168C,357C 'acquir':454C 'affect':397C 'alloc':256C 'alreadi':250C,443C 'anoth':194C 'arbitrari':232C 'arch':280C 'attempt':61B,373C 'block':333C 'bound':69B,297C 'bring':457C 'build':28B,387C 'call':106C,125C,262C,334C,360C 'caller':441C 'code':408C 'config':58B,223C,363C,388C 'consequenti':124C 'context':78B,306C 'control':428C 'corrupt':9A,310C,429C 'cpu':26B,195C,386C 'cpus':392C 'crash':82B,425C 'creat':353C 'cve':12A,15A 'data':380C 'dlist':200C,271C 'drive':341C 'dynam':255C 'elsewher':322C 'embed':18B 'enabl':365C 'exclus':186C 'execut':409C 'expir':34B,130C,460C 'exploit':381C 'fix':431C 'free':74B,302C 'freed':258C 'get':227C 'give':65B 'greater':393C 'halt':162C 'handler':35B,131C,260C,461C 'head':90C,94C,202C,438C,452C,463C 'held':135C 'helper':87C,434C 'hold':111C,175C,444C 'insid':196C 'interleav':343C 'invalid':48B 'k':212C,220C,344C,347C,351C,355C 'kernel':10A,42B,84B,86C,378C,424C 'kernel-own':377C 'kernel/include/wait_q.h':91C 'kernel/sched.c':165C 'kernel/timer.c':133C 'last':189C 'let':5A 'list':206C 'local':7A,52B,407C 'lock':140C,142C,439C,471C 'make':40B 'max':390C 'memori':11A 'milder':312C 'min':228C 'mode':55B,370C 'mp':389C 'multi':25B,385C 'multi-cpu':24B,384C 'mutat':122C 'mutual':185C 'narrow':413C 'need':339C 'no-op':401C 'node':233C 'num':391C 'object':214C,278C 'obtain':161C 'often':81B,422C 'one':395C 'op':403C 'out-of-bound':66B,294C 'outcom':313C,419C 'own':379C 'path':182C 'peek':201C 'pend':321C 'perform':268C 'place':109C 'plus':307C 'pointer':50B,209C,244C,274C,290C 'practic':418C 'primit':338C 'q':147C 'queue':99C,121C,173C 'race':4A,30B,375C 'rather':426C 'rb':226C 're':320C 're-pend':319C 'read':92C,144C,275C,464C 'readi':157C,467C 'region':398C,474C 'remov':166C,192C,272C 'requir':382C 'restructur':238C 'result':292C 'return':153C,204C,230C,242C,282C,328C 'rtos':2A,19B 'runtim':20B 'scalabl':225C 'sched':115C,177C,472C 'schedul':113C,308C,446C 'sentinel':207C 'serial':118C 'set':151C,284C 'sever':108C 'singl':470C 'site':126C 'smp':21B,102C 'spinlock':114C,116C,178C,447C,473C 'split':432C 'stale':46B 'start':346C 'state':309C 'status':349C 'struct':219C 'subsystem':139C 'success':327C 'supervisor':77B,305C 'sync':350C 'sys':199C,270C 'system':103C,359C 'target':406C 'thread':8A,37B,49B,56B,97C,159C,163C,169C,221C,247C,257C,264C,281C,316C,352C,356C,371C 'time':414C 'timeout':266C 'timer':3A,33B,129C,138C,141C,145C,213C,345C,348C,459C 'tree':236C 'trigger':63B 'two':181C 'type':216C 'uncondit':287C 'uniprocessor':405C 'unpend':150C,252C,263C,465C 'unprivileg':367C 'unrel':332C 'use':72B,300C 'use-after-fre':71B,299C 'user':54B,369C 'user-mod':53B,368C 'userspac':59B,364C 'valu':154C,283C,329C 'wait':98C,120C,146C,172C 'wait-queu':119C 'waiter':190C 'waitq':89C,224C,437C,451C 'win':411C 'window':198C,415C 'without':110C 'woken':324C 'write':43B,75B,286C,303C 'z':88C,128C,436C,450C 'zephyr':1A,22B,27B","nicknames":[],"mitigations":[],"who_affected":"Only multi-CPU Zephyr builds are exposed, since the affected code is a no-op on uniprocessor targets. Exploitation needs local code execution and a user-mode thread on a system with CONFIG_USERSPACE, so teams running single-core targets or without untrusted local threads can skip it.","tier":"B","verified":{},"analyst_revisit_at":null,"first_public_at":"2026-10-21T19:17:03+00:00","kev":null,"cvss_vector":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H","cvss_by":"vulnerabilities@zephyrproject.org","poc_count":0,"sources":[{"source":"nvd","external_id":"CVE-2026-78118","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-78118","severity":null,"published_at":"2026-10-21T19:17:03+00:00","modified_at":"2026-10-23T22:17:00+00:00","first_seen_at":"2026-10-23T21:57:29+00:00","fetched_at":"2026-10-23T22:29:02+00:00","note":null},{"source":"epss","external_id":"CVE-2026-78118","url":"https://api.first.org/data/v1/epss?cve=CVE-2026-78118","severity":null,"published_at":null,"modified_at":null,"first_seen_at":"2026-10-24T13:15:54+00:00","fetched_at":"2026-10-24T13:15:54+00:00","note":null}],"documents":[],"notice":"Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai"}