CVE-2026-87038

Time-of-check/time-of-use double fetch in the Zephyr i3c_transfer() syscall handler allows kernel-mode control-flow hijack from user mode

Published Nov 4, 2026 CVSS 3.1 · 7 High EPSS < 1% KEV · Not listed
Description
The user-mode verification handler for the i3c_transfer() system call, z_vrfy_i3c_transfer() in drivers/i3c/i3c_handlers.c, validated the caller-supplied struct i3c_device_desc in place instead of snapshotting it. It confirmed only that the descriptor was readable by the calling thread (K_SYSCALL_MEMORY_READ()), read target->bus once to check it with K_SYSCALL_OBJ(), and then passed the caller's live pointer down. The implementation z_impl_i3c_transfer() re-reads target->bus from that user memory and dispatches through it as DEVICE_API_GET(i3c, target->bus)->i3c_xfers(...), so the bus that was validated is not necessarily the bus that is used. DEVICE_API_GET() performs no runtime type check outside CONFIG_DEVICE_API_ASSERT builds.

On a build with CONFIG_USERSPACE and an I3C controller driver, a user thread that has been granted an I3C device object can exploit this with a second thread in the same memory domain: one thread calls i3c_transfer() while the other rewrites the bus field of the descriptor. The window between the check and the use spans the num_msgs validation, the message-array access check, a stack VLA allocation and a memcpy() of up to 32 struct i3c_msg, so the race is repeatable and can simply be retried until it lands.

When the substitution succeeds, the kernel dereferences an attacker-chosen pointer as a struct device, loads a function pointer from the attacker-controlled api table and calls it in supervisor mode with attacker-influenced arguments. This yields kernel-mode code execution from an unprivileged user thread — a complete escape of the userspace memory-protection sandbox; lesser outcomes are an arbitrary two-level kernel read or a kernel fault. Builds without CONFIG_USERSPACE, or without an I3C driver, are unaffected.

The fix copies the descriptor into a kernel-stack local with k_usermode_from_copy(), validates the bus in that copy, and dispatches on the copy, so the validated value is provably the value used.

Analysis

AI-generated

Technical impact

The i3c_transfer() syscall in Zephyr contains a double‑fetch flaw. The handler validates a user‑supplied i3c_device_desc pointer in place, but the implementation later reads the same user memory again. An attacker controlling two user‑space threads can alter the descriptor’s bus field after validation and before it is used by the kernel. This causes the kernel to dereference an attacker‑controlled struct device and invoke a function pointer from an attacker‑controlled API table, leading to kernel‑mode code execution from an unprivileged user thread. The weakness is a classic race condition (CWE‑367).

Affected Systems

Zephyr RTOS built with CONFIG_USERSPACE enabled and the I3C controller driver compiled in is impacted. The vulnerability exists where the i3c_transfer() syscall is present in the kernel image. No specific version range is provided; affected builds are those that include this syscall and the I3C driver without receiving the patch.

Risk and Exploitability

The CVSS score of 7.0 indicates high severity. EPSS data is not available, so the current exploit probability cannot be quantified, and the vulnerability is not listed in CISA KEV, meaning it has not yet been observed in the wild. Exploitation requires a local user‑space thread that has been granted an i3c_device_desc object and control over another thread in the same memory domain to perform the race. The race condition is repeatable and can be retried until the descriptor substitution succeeds, so an attacker can reliably trigger the flaw. Because the attack escalates from user mode to kernel mode, the risk to confidentiality, integrity, and availability is severe.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Apply the latest Zephyr patch that copies the i3c_device_desc into kernel space before validation, as implemented in commit 550437bc9efd7b733f13b9be73e77fd98858c8a2.
  • If a patch is not available, disable I3C driver support or CONFIG_USERSPACE in the Zephyr configuration to eliminate the attack surface.
  • Rebuild Zephyr with CONFIG_DEVICE_API_ASSERT enabled so that runtime checks on device API retrieval are performed during normal operation.
  • If the system must maintain userspace access to I3C devices, restrict user privileges so that no ordinary user thread can obtain the i3c_device_desc object used by the vfs.

Generated by OpenCVE AI on November 4, 2026 at 10:40 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'total'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Zephyrproject
Zephyrproject zephyr
Vendors & Products Zephyrproject
Zephyrproject zephyr
Type Values Removed Values Added
Description The user-mode verification handler for the i3c_transfer() system call, z_vrfy_i3c_transfer() in drivers/i3c/i3c_handlers.c, validated the caller-supplied struct i3c_device_desc in place instead of snapshotting it. It confirmed only that the descriptor was readable by the calling thread (K_SYSCALL_MEMORY_READ()), read target->bus once to check it with K_SYSCALL_OBJ(), and then passed the caller's live pointer down. The implementation z_impl_i3c_transfer() re-reads target->bus from that user memory and dispatches through it as DEVICE_API_GET(i3c, target->bus)->i3c_xfers(...), so the bus that was validated is not necessarily the bus that is used. DEVICE_API_GET() performs no runtime type check outside CONFIG_DEVICE_API_ASSERT builds. On a build with CONFIG_USERSPACE and an I3C controller driver, a user thread that has been granted an I3C device object can exploit this with a second thread in the same memory domain: one thread calls i3c_transfer() while the other rewrites the bus field of the descriptor. The window between the check and the use spans the num_msgs validation, the message-array access check, a stack VLA allocation and a memcpy() of up to 32 struct i3c_msg, so the race is repeatable and can simply be retried until it lands. When the substitution succeeds, the kernel dereferences an attacker-chosen pointer as a struct device, loads a function pointer from the attacker-controlled api table and calls it in supervisor mode with attacker-influenced arguments. This yields kernel-mode code execution from an unprivileged user thread — a complete escape of the userspace memory-protection sandbox; lesser outcomes are an arbitrary two-level kernel read or a kernel fault. Builds without CONFIG_USERSPACE, or without an I3C driver, are unaffected. The fix copies the descriptor into a kernel-stack local with k_usermode_from_copy(), validates the bus in that copy, and dispatches on the copy, so the validated value is provably the value used.
Title Time-of-check/time-of-use double fetch in the Zephyr i3c_transfer() syscall handler allows kernel-mode control-flow hijack from user mode
Weaknesses CWE-367
References
Metrics cvssV3_1

{'score': 7, 'vector': 'CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H'}

Weaknesses
  • CWE-367

    Time-of-check Time-of-use (TOCTOU) Race Condition

Sources

Status
PUBLISHED
Assigner
zephyr
Published
Updated
Nov 9, 2026, 9:27 PM
Reserved
Sep 8, 2026, 6:40 PM
Status
Awaiting Analysis
Published
Nov 4, 2026, 6:17 AM
Modified
Nov 9, 2026, 10:18 PM