Zephyrのi3c_transfer()に脆弱性、ユーザーモードからカーネル権限で処理を乗っ取られるおそれ
Summary
Zephyrのi3c_transfer()システムコールの処理に、検査時と使用時のあいだにデータを書き換えられる競合状態の脆弱性が見つかりました。ユーザースレッドから、カーネルモードで任意の関数を呼び出される可能性があり、CVSS v3のスコアは7です。3.2.0以降4.3.2未満と、4.4.0以降4.5.0未満のZephyrが影響を受けます。修正版は4.3.2と4.5.0で、該当する版の利用者は修正版への更新を検討してください。
AI summary
Produced by SecPulse using an external AI model; it may contain mistakes. Check the original description and references below before acting on it.
Zephyrのi3c_transfer()システムコールの処理に、検査時と使用時のあいだにデータを書き換えられる競合状態の脆弱性が見つかりました。ユーザースレッドから、カーネルモードで任意の関数を呼び出される可能性があり、CVSS v3のスコアは7です。3.2.0以降4.3.2未満と、4.4.0以降4.5.0未満のZephyrが影響を受けます。修正版は4.3.2と4.5.0で、該当する版の利用者は修正版への更新を検討してください。
Affected packages
| Package | Affected → Fixed | |
|---|---|---|
| zephyrprojectzephyr |
≥ 3.2.0, < 4.3.2→ 4.3.2 ≥ 4.4.0, < 4.5.0→ 4.5.0 |
4.3.2 4.5.0 |
Original description The description as published by the source.
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 yiel…
Source: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory
References
- advisory github.com
- advisory github.com
- advisory nvd.nist.gov
- package github.com
- patch github.com