{"id":"CVE-2026-12631","aliases":["CVE-2026-12631"],"related":[],"kind":"vulnerability","state":"published","title":"Broken access-control denial in k_thread_join/k_thread_abort syscall validation in Zephyr kernel","summary":"The Zephyr kernel validates the k_thread_join() and k_thread_abort() system calls (declared __syscall in include/zephyr/kernel.h) through thread_obj_validate() in kernel/thread.c. Its default switch branch is the access-denied path, taken when k_object_validate() returns -EPERM (the calling user thread was never granted access to the target thread object) or -EBADF (the supplied pointer is not a registered kernel object of the right type). That branch invoked K_OOPS(K_SYSCALL_VERIFY_MSG(ret, \"access denied\")), but K_SYSCALL_VERIFY_MSG treats a true expression as success; the non-zero error code ret therefore read as \"verified OK\", the kernel oops was never raised, and control fell through to CODE_UNREACHABLE.\n\nBecause k_thread_join() and k_thread_abort() are system calls, an unprivileged user-mode thread (under CONFIG_USERSPACE) can reach this denial path directly by calling either syscall on a thread object it does not own. Instead of the offending thread being cleanly terminated, execution reaches __builtin_unreachable() while running in supervisor mode inside the syscall handler.\n\nOn Clang builds CODE_UNREACHABLE emits an illegal-instruction trap, so a user thread can deterministically crash the kernel — a locally triggerable denial of service that escapes the userspace sandbox. On GCC builds the path is undefined behavior: the compiler may drop the return-value handling for thread_obj_validate(), so it can return an undefined bool; if that is false, the caller proceeds into the real k_thread_join()/k_thread_abort() implementation for a thread the user was never authorized to access, an access-control bypass.\n\nThe fix changes the verification expression to ret == 0, so a denied (non-zero) result now correctly raises K_OOPS and terminates the offending caller.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"The Zephyr kernel validates the k_thread_join() and k_thread_abort() system calls (declared __syscall in include/zephyr/kernel.h) through thread_obj_validate() in kernel/thread.c. Its default switch branch is the access-denied path, taken when k_object_validate() returns -EPERM (the calling user thread was never granted access to the target thread object) or -EBADF (the supplied pointer is not a registered kernel object of the right type). That branch invoked K_OOPS(K_SYSCALL_VERIFY_MSG(ret, \"access denied\")), but K_SYSCALL_VERIFY_MSG treats a true expression as success; the non-zero error code ret therefore read as \"verified OK\", the kernel oops was never raised, and control fell through to CODE_UNREACHABLE.\n\nBecause k_thread_join() and k_thread_abort() are system calls, an unprivileged user-mode thread (under CONFIG_USERSPACE) can reach this denial path directly by calling either syscall on a thread object it does not own. Instead of the offending thread being cleanly terminated, execution reaches __builtin_unreachable() while running in supervisor mode inside the syscall handler.\n\nOn Clang builds CODE_UNREACHABLE emits an illegal-instruction trap, so a user thread can deterministically crash the kernel — a locally triggerable denial of service that escapes the userspace sandbox. On GCC builds the path is undefined behavior: the compiler may drop the return-value handling for thread_obj_validate(), so it can return an undefined bool; if that is false, the caller proceeds into the real k_thread_join()/k_thread_abort() implementation for a thread the user was never authorized to access, an access-control bypass.\n\nThe fix changes the verification expression to ret == 0, so a denied (non-zero) result now correctly raises K_OOPS and terminates the offending caller.","source":"cvelist"},{"lang":"es","text":"El kernel Zephyr valida las llamadas al sistema k_thread_join() y k_thread_abort() (declaradas __syscall en include/zephyr/kernel.h) a través de thread_obj_validate() en kernel/thread.c. Su rama switch predeterminada es la ruta de acceso denegado, tomada cuando k_object_validate() devuelve -EPERM (el hilo de usuario llamante nunca tuvo acceso concedido al objeto de hilo objetivo) o -EBADF (el puntero suministrado no es un objeto kernel registrado del tipo correcto). Esa rama invocó K_OOPS(K_SYSCALL_VERIFY_MSG(ret, ’access denied’)), pero K_SYSCALL_VERIFY_MSG trata una expresión verdadera como éxito; el código de error no nulo ret, por lo tanto, se leyó como ’verified OK’, el oops del kernel nunca se generó, y el control pasó a CODE_UNREACHABLE.\n\nDebido a que k_thread_join() y k_thread_abort() son llamadas al sistema, un hilo en modo usuario sin privilegios (bajo CONFIG_USERSPACE) puede alcanzar esta ruta de denegación directamente llamando a cualquiera de las syscall en un objeto de hilo que no posee. En lugar de que el hilo infractor sea terminado limpiamente, la ejecución alcanza __builtin_unreachable() mientras se ejecuta en modo supervisor dentro del gestor de syscall.\n\nEn compilaciones de Clang, CODE_UNREACHABLE emite una trampa de instrucción ilegal, por lo que un hilo de usuario puede bloquear el kernel de forma determinista - una denegación de servicio activable localmente que escapa al sandbox del espacio de usuario. En compilaciones de GCC, la ruta es un comportamiento indefinido: el compilador puede omitir el manejo del valor de retorno para thread_obj_validate(), por lo que puede devolver un booleano indefinido; si eso es falso, el llamante procede a la implementación real de k_thread_join()/k_thread_abort() para un hilo al que el usuario nunca fue autorizado a acceder, una omisión de control de acceso.\n\nLa solución cambia la expresión de verificación a ret == 0, por lo que un resultado denegado (no nulo) ahora genera correctamente K_OOPS y termina al llamante infractor.","source":"nvd"}],"published":"2026-08-18T20:55:42.859Z","modified":"2026-11-04T05:18:40.340Z","severity":{"scorer":"zephyr","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:N/I:N/A:H","score":6.5,"rating":"MEDIUM"},"severities":[{"scorer":"zephyr","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:N/I:N/A:H","score":6.5,"rating":"MEDIUM"}],"cwes":["CWE-862"],"affected":[{"ranges":[{"type":"semver","introduced":"2.3.0","fixed":"4.3.2","status":"affected"},{"type":"semver","introduced":"4.4.0","fixed":"4.4.2","status":"affected"}],"vendor":"zephyrproject","product":"zephyr","package":"zephyr","source":"cvelist"}],"references":[{"url":"https://github.com/zephyrproject-rtos/zephyr/commit/bd1828652dfc217ba9f3a2221a7499cd8914ed9c","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://github.com/zephyrproject-rtos/zephyr/security/advisories/GHSA-crfw-75jw-hjm3","tags":[],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"zephyr","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-08-19T13:17:32.022Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-12631","url":"https://www.cve.org/CVERecord?id=CVE-2026-12631","licence":"CVE Terms of Use","modified":"2026-11-04T04:59:39.284Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-12631","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-12631","licence":"Public domain","modified":"2026-11-04T05:18:40.340Z"}],"updatedAt":"2026-11-25T22:59:33.579Z","epss":{"score":0.00149,"percentile":0.04308,"date":"2026-12-01T12:00:22.000Z"}}