{"id":"CVE-2026-12631","sourceIdentifier":"vulnerabilities@zephyrproject.org","published":"2026-08-18T21:16:33.647","lastModified":"2026-11-04T05:18:40.340","vulnStatus":"Awaiting Analysis","cveTags":[],"descriptions":[{"lang":"en","value":"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."},{"lang":"es","value":"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."}],"affected":[{"source":"vulnerabilities@zephyrproject.org","affectedData":[{"vendor":"zephyrproject","product":"zephyr","defaultStatus":"unaffected","collectionURL":"https://github.com/zephyrproject-rtos/zephyr","packageName":"zephyr","programFiles":["kernel/thread.c"],"versions":[{"version":"2.3.0","lessThan":"4.3.2","versionType":"semver","status":"affected"},{"version":"4.4.0","lessThan":"4.4.2","versionType":"semver","status":"affected"}]}]}],"metrics":{"cvssMetricV31":[{"source":"vulnerabilities@zephyrproject.org","type":"Secondary","cvssData":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:N/I:N/A:H","baseScore":6.5,"baseSeverity":"MEDIUM","attackVector":"LOCAL","attackComplexity":"LOW","privilegesRequired":"LOW","userInteraction":"NONE","scope":"CHANGED","confidentialityImpact":"NONE","integrityImpact":"NONE","availabilityImpact":"HIGH"},"exploitabilityScore":2.0,"impactScore":4.0}],"ssvcV203":[{"source":"134c704f-9b21-4f2e-91b3-4a467353bcc0","ssvcData":{"timestamp":"2026-08-19T13:17:32.022813Z","id":"CVE-2026-12631","options":[{"exploitation":"none"},{"automatable":"no"},{"technicalImpact":"partial"}],"role":"CISA Coordinator","version":"2.0.3"}}]},"weaknesses":[{"source":"vulnerabilities@zephyrproject.org","type":"Secondary","description":[{"lang":"en","value":"CWE-862"}]}],"references":[{"url":"https://github.com/zephyrproject-rtos/zephyr/commit/bd1828652dfc217ba9f3a2221a7499cd8914ed9c","source":"vulnerabilities@zephyrproject.org"},{"url":"https://github.com/zephyrproject-rtos/zephyr/security/advisories/GHSA-crfw-75jw-hjm3","source":"vulnerabilities@zephyrproject.org"}]}