CVE-2026-105415 in Zephyrinfo

Summary

by MITRE • 11/29/2026

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().

If you want to get the best quality for vulnerability data then you always have to consider VulDB.

Analysis

by VulDB Data Team • 11/29/2026

The vulnerability identified within the Espressif MCPWM PWM driver for Zephyr RTOS represents a critical out-of-bounds write condition stemming from insufficient input validation in the kernel-mode device driver. Specifically, the function mcpwm_esp32_set_cycles() accepts a channel index provided by the caller and uses this value directly as an offset to access elements within the per-channel configuration array config->channel_config[]. The existing defensive logic relies on a check for null pointers via if (!channel), which verifies that the pointer itself is not zero but fails to validate whether the integer index falls within the valid range of allocated channels. Consequently, when a caller supplies an arbitrary or excessively large channel number, the driver proceeds to write data such as frequency, duty cycle, and inversion settings into memory locations beyond the bounds of the intended array structure.

This flaw is particularly severe because it occurs in kernel space and involves writable static variables located in kernel RAM. Under normal operating conditions without user-space isolation enabled, this bug would primarily result in system instability or a denial-of-service condition due to memory corruption. However, when CONFIG_USERSPACE is enabled on Espressif RISC-V SoCs equipped with Physical Memory Protection hardware, such as the ESP32-C6 and later versions of the ESP32-C5, the security implications escalate significantly. In this configuration, unprivileged user-mode threads that have been granted access to the MCPWM device can invoke the pwm_set_cycles system call. Since neither the verification wrapper z_vrfy_pwm_set_cycles() nor the implementation function z_impl_pwm_set_cycles() performs bounds checking on the channel index, an attacker in a lower-privilege domain can manipulate kernel memory by passing crafted arguments that cause writes to arbitrary locations within the kernel address space.

The operational impact of this vulnerability extends beyond simple memory corruption. The driver also utilizes out-of-bounds timer_id, operator_id, and generator_id values derived from the invalid channel index to write directly into MCPWM hardware registers. This dual vector for exploitation allows an attacker not only to corrupt internal kernel data structures but also to potentially misconfigure or disrupt peripheral operations. Such partial control over kernel memory writes is a classic precursor to privilege escalation attacks. By carefully crafting the input, an adversary could overwrite critical function pointers, return addresses, or security-critical flags within the kernel, thereby gaining unauthorized elevated privileges and full control over the system.

From a classification perspective, this vulnerability aligns with CWE-125: Out-of-bounds Read and CWE-787: Out-of-bounds Write, as it involves accessing memory outside of allocated boundaries due to missing index validation. In terms of offensive security frameworks, this flaw facilitates techniques associated with ATT&CK T1068: Exploitation for Privilege Escalation, specifically through the exploitation of software vulnerabilities in kernel components to bypass access controls and elevate privileges from user mode to ring zero or equivalent supervisor levels. The absence of bounds checking on a system call parameter is also indicative of CWE-20: Improper Input Validation, highlighting a failure to enforce syntactic correctness constraints on external inputs before processing them within the trusted execution environment.

Mitigation strategies must focus on enforcing strict input validation at the earliest possible point in the code path. The primary remediation involves adding explicit bounds checking logic to mcpwm_esp32_set_cycles() to ensure that the supplied channel index is strictly less than the maximum number of supported channels before any array access or hardware register manipulation occurs. This check should be implemented both in the user-space verification layer and within the kernel implementation to provide defense-in-depth. Furthermore, developers should consider enabling compiler-based security features such as stack canaries and address space layout randomization where applicable, although these are mitigations rather than fixes for this specific logical flaw. For systems running without CONFIG_USERSPACE, while the risk of remote exploitation is negligible since only trusted code calls the driver, applying the fix remains a best practice to maintain robustness against potential future changes in call chains or internal misuse by other kernel modules.

Responsible

Zephyr

Reservation

10/05/2026

Disclosure

11/29/2026

Moderation

accepted

CPE

ready

EPSS

0.00000

KEV

no

Activities

very low

Sources

Interested in the pricing of exploits?

See the underground prices here!