Zephyrのデバイスドライバーで境界外書き込みの脆弱性 ユーザーモードから権限昇格のおそれ
Summary
ESP32のMCPWMドライバーでチャネル番号の範囲チェックがなく、ユーザーモードのスレッドからカーネル内メモリの境界外に書き込まれるおそれがあります。影響を受けるのはZephyr 4.4.0以上4.5.0未満で、4.5.0で修正されています。CONFIG_USERSPACEを有効にしたESP32-C6などで影響があり、利用中の版を確認して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.
ESP32のMCPWMドライバーでチャネル番号の範囲チェックがなく、ユーザーモードのスレッドからカーネル内メモリの境界外に書き込まれるおそれがあります。影響を受けるのはZephyr 4.4.0以上4.5.0未満で、4.5.0で修正されています。CONFIG_USERSPACEを有効にしたESP32-C6などで影響があり、利用中の版を確認して4.5.0への更新を急ぐ必要があります。
Affected packages
| Package | Affected → Fixed | |
|---|---|---|
| zephyrprojectzephyr |
≥ 4.4.0, < 4.5.0→ 4.5.0 |
4.5.0 |
Original description The description as published by the source.
The Espressif MCPWM PWM driver (drivers/pwm/pwm_mc_esp32.c) indexed its per-channel configuration array config->channel_config[] with the caller-supplied channel_idx in mcpwm_esp32_set_cycles() without any bounds check; the existing if (!channel) test can never fail. The driver then wrote channel->freq, channel->duty and channel->inverted through the out-of-bounds element and used out-of-bounds timer_id/operator_id/generator_id values to index MCPWM hardware registers.
pwm_set_cycles() is a system call, and neither z_vrfy_pwm_set_cycles() nor z_impl_pwm_set_cycles() validates the channel. With CONFIG_USERSPACE enabled on an Espressif RISC-V SoC with PMP (ESP32-C6, and ESP32-C5 in later code), an unprivileged user-mode thread that has been granted access to the MCPWM device can pass an arbitrary channel number and cause the kernel-mode driver to write outside the array.
The configuration object is a writable static in kernel RAM, so this gives a user thread a partially controlled kernel memory write (and stray peripheral register writes), which can crash the system and may be leveraged for privilege escalation. Builds without CONFIG_USERSPACE are not affected in a security sense, since only trusted code can call the driver. The fix adds a channel bounds check to mcpwm_esp32_set_cycles().
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