Zephyr privilege escalation in PWM capture syscall
Affects Zephyr 2.5.0 up to 4.3.2 and 4.4.0 up to 4.5.0 when CONFIG_USERSPACE and CONFIG_PWM_CAPTURE are enabled and pwm_capture_cycles() is called with K_NO_WAIT. Fixed in 4.3.2 and 4.5.0.
- Exploited
- No known exploitation
- Fix
- Fixed in 4.3.2, 4.5.0
- Who is exposed
- Specific setups only
Summary
Zephyr's PWM capture system call leaves a callback pointing at an expired kernel stack frame when called with K_NO_WAIT, and a local user-mode thread with low privileges and access to a capture-capable PWM device can trigger it without user interaction. When the capture completes, the callback writes into that freed kernel stack memory, which can corrupt kernel memory, crash the system, and possibly allow privilege escalation, and each call can also leak up to 8 bytes of stale kernel stack data.
Written by a model
Original description
z_impl_pwm_capture_cycles() in drivers/pwm/pwm_capture.c stores its capture context (struct z_pwm_capture_cb_data, including a struct k_sem) on its own stack and registers a pointer to it as the driver capture callback's user_data. When called with a K_NO_WAIT timeout, k_sem_take() returns -EBUSY, which the function did not handle: it fell through, returned the uninitialized status field, copied uninitialized period/pulse values to the caller when that status happened to be zero, and returned without disabling the capture or clearing the callback.
pwm_capture_cycles() is a system call, and z_vrfy_pwm_capture_cycles() passes the caller's timeout through unchanged. With CONFIG_USERSPACE and CONFIG_PWM_CAPTURE enabled, an unprivileged user-mode thread that has been granted access to a capture-capable PWM device can pass K_NO_WAIT to trigger the defect. Without userspace the function is only reachable from trusted application code.
The uninitialized values come from the thread's privileged (kernel) stack, so a user-mode caller can read up to 8 bytes of stale kernel stack memory per call. More seriously, when the capture later completes, the driver ISR invokes z_pwm_capture_cycles_callback() with the dangling pointer. The callback writes into the expired kernel stack region and calls k_sem_give() on whatever memory now occupies it, which can corrupt live kernel stack frames and make the scheduler walk a forged wait queue. The result is kernel memory corruption from interrupt context, leading at least to a crash and possibly to privilege escalation out of the userspace sandbox. The fix rejects K_NO_WAIT with -EINVAL before any capture is configured.
Who should check
Teams running Zephyr with CONFIG_USERSPACE and CONFIG_PWM_CAPTURE, where user-mode threads are granted access to PWM capture-capable devices; affected range is >= 2.5.0 < 4.3.2 and >= 4.4.0 < 4.5.0.
Not fixed by: Release lines that have not yet taken the backport remain affected.
“Fixed in 4.3.2 , 4.5.0 . Release lines that have not yet taken the backport remain affected”
What to do
Check whether your setup matches what the bug needs.
CONFIG_USERSPACE and CONFIG_PWM_CAPTURE must be enabled. The caller passes a K_NO_WAIT timeout to pwm_capture_cycles().Upgrade to a fixed version: 4.3.2, 4.5.0.
Check your systems with an agent
Paste this into a coding or ops agent. It checks your systems read-only and reports a table per asset.
Check whether my systems are affected by CVE-2026-102957 (PWM capture syscall leaves callback armed on a dead kernel stack frame when called with K_NO_WAIT), using the cve.now data below.
Rules: work read-only. Do not run exploit code, proof-of-concept scripts or scanners that send attack payloads, and do not change any configuration, package, image or deployment. Report findings only.
What cve.now has for CVE-2026-102957 (entry last updated 2026-11-25):
Affected:
- zephyrproject zephyr: from 2.5.0, fixed in 4.3.2; from 4.4.0, fixed in 4.5.0
Fixed versions: 4.3.2, 4.5.0.
Conditions (all must be true for the bug to be hit):
- CONFIG_USERSPACE and CONFIG_PWM_CAPTURE must be enabled. (source: https://github.com/zephyrproject-rtos/zephyr/security/advisories/GHSA-gmqw-xpww-374m)
- The caller passes a K_NO_WAIT timeout to pwm_capture_cycles(). (source: https://github.com/zephyrproject-rtos/zephyr/security/advisories/GHSA-gmqw-xpww-374m)
Setup: unknown whether the bug needs a non-default feature or setting. Check the advisory.
Attacker needs: local access, low-privilege login, no user action.
CISA KEV: CVE-2026-102957 is not listed as of cve.now's last read.
This KEV status is for CVE-2026-102957 only. If you also check another CVE, look up its own KEV status; never assume it from this one.
How to check:
- Installed software: check what is actually running, not what a repo declares. Read the version from each host, container image and Kubernetes node (the binary's version output, the OS package database, image layers), and check whether the conditions above hold there. Distribution packages may carry a backported fix under an older version number; confirm against the distribution's own advisory.
Verify against the linked advisories before concluding, and cite the date you read each one:
- https://github.com/zephyrproject-rtos/zephyr/commit/cad8ad3ed2511d2816a3e8ce63e8028f7c3a1a1e
- https://github.com/zephyrproject-rtos/zephyr/security/advisories/GHSA-gmqw-xpww-374m
Do not conclude an asset is unaffected unless you checked it and the evidence covers both its version and the conditions above. If you could not check something, mark it unknown and say what is missing.
Report a table with one row per asset and these columns: Asset | Version or build | Status (affected, fixed, not applicable, unknown) | Compensating controls | Exposure (internet-facing, internal, none) | Evidence | Next action.
Entry: https://cve.now/CVE-2026-102957
For follow-up questions, use the cve.now MCP server at https://mcp.cve.now/mcp (no authentication), for example execute with name cve.get and arguments {"id": "CVE-2026-102957"}.Affected versions
- zephyrFrom 2.5.0 · fixed in 4.3.2; From 4.4.0 · fixed in 4.5.0
cve.now Index
- Exploitation?/40Unknown. No CISA SSVC exploitation rating yet
- Exposure5/25Specific setups only
- Reach?/20Unknown. No tracked technology or package matched
- Severity7.7/10CVSS 7.7
- No patch0/5No signal
What would change the score
- Would score about 63 if added to CISA KEV
- Would score about 58 if CISA's SSVC rates exploitation active
- Would score about 23 if CISA's SSVC rates it automatable
Timeline
- CVE published
- First seen by cve.now
Evidence 4
| Kind | Source |
|---|---|
| Vendor advisory 1Establishes: Affected and fixed versions. | |
| Advisory | GitHub · zephyrproject-rtos/zephyr · Advisory GHSA-gmqw-xpww-374m |
| CVE record 2Establishes: The identifier and description. | |
| Record | CVE List · CVE-2026-102957 |
| Record | NVD · CVE-2026-102957 |
| Other links 1 | |
| Patch | GitHub · zephyrproject-rtos/zephyr · Commit cad8ad3e |
Questions about CVE-2026-102957
Is CVE-2026-102957 being exploited?
It is not in CISA's Known Exploited Vulnerabilities catalog, and CISA's SSVC assessment does not mark exploitation as active. That does not mean it has not been attacked: vendors and researchers can report attacks before CISA lists them. No public exploit code is tracked.
Source: cve.now feed data
What does this mean?
When pwm_capture_cycles() is called with K_NO_WAIT, the PWM capture syscall leaves its callback armed on a kernel stack frame that no longer exists. Later interrupts can then write into kernel memory, which can crash the system and possibly allow escape from the userspace sandbox.
Source: github.com
Which versions are affected by CVE-2026-102957?
zephyr: from 2.5.0 before 4.3.2; from 4.4.0 before 4.5.0.
Source: cve.now feed data
Am I affected, and how do I check?
Zephyr releases from 2.5.0 up to 4.3.2 and from 4.4.0 up to 4.5.0 are in range, but only builds with both CONFIG_USERSPACE and CONFIG_PWM_CAPTURE enabled and a caller that passes K_NO_WAIT. Check the Zephyr version in the build and the values of these two options in the build configuration.
Source: github.com
How do I fix CVE-2026-102957?
Upgrade to Zephyr 4.3.2 on the 4.3 line or 4.5.0 on the 4.4 line. No vendor patch identifiers beyond these fixed versions are given in the facts.
Source: github.com
Related
- CVE-2026-100374Missing user buffer validation in SMBus block read and block process call syscalls allows kernel memory writes
- CVE-2026-95826Out-of-bounds write in the SMSC911x Ethernet driver when transmitting frames larger than the staging buffer
- CVE-2026-95823Use-after-free and net_buf leak in Zephyr TCP header linearization (tcp_pkt_linearize)
- CVE-2026-102960Stack buffer overflow in Grow R502-A fingerprint sensor driver UART RX handler
- CVE-2026-102954Out-of-bounds write from peripheral-supplied block count in STM32 SMBus driver
- CVE-2026-102951Agilex5 System Manager registers mapped read/write for user mode threads
No corrections so far. Something wrong on this page? Report an error.