Description
The BBRAM system call verifiers z_vrfy_bbram_read() and z_vrfy_bbram_write() in drivers/bbram/bbram_handlers.c validated the device object and the user buffer but never validated the caller-supplied offset and size. Range checking was left to the individual BBRAM drivers (bbram_emul, bbram_it8xxx2, bbram_npcx, bbram_rts5912, bbram_stm32, bbram_xec), which all use the check offset + size > capacity. That sum wraps for large offset values: with offset = SIZE_MAX - k + 1 and size = k + j (j no larger than the capacity), the sum wraps to j, the check passes, and the driver accesses base + offset, which wraps to k bytes below the BBRAM region.
A user-mode thread that has been granted access to a BBRAM device object chooses both values, so k is bounded only by the size of the user buffer it supplies. Through bbram_read() the kernel copies that much memory from below the BBRAM window into the user buffer; through bbram_write() it copies attacker-controlled bytes over it. On the emulated driver that memory is kernel RAM: the reporter's proof of concept on qemu_x86 reads and overwrites a byte of an adjacent kernel MMIO pointer, and the kernel faults on its next use. On hardware it is the peripheral register space below the BBRAM window (on bbram_stm32, reached through a backup-register index that wraps below the register base). A user thread can therefore disclose and corrupt supervisor-only memory, and an access to an unmapped or side-effecting address in supervisor mode can raise a fatal fault.
The bbram syscalls are only present in the image when CONFIG_USERSPACE is enabled and bbram.h is emitted as a syscall header: in released versions this requires CONFIG_EMIT_ALL_SYSCALLS=y or an application-level zephyr_syscall_header() registration (without it a userspace build with BBRAM does not compile). In development builds after the header was registered by default, it applies to any CONFIG_USERSPACE build with a BBRAM driver.
The fix adds an overflow-safe range check against the device capacity (offset > capacity - size) in both syscall handlers before the driver is invoked: 8438d3b9c1a9 for the read path and c3ea409fc4a0 for the write path.
A user-mode thread that has been granted access to a BBRAM device object chooses both values, so k is bounded only by the size of the user buffer it supplies. Through bbram_read() the kernel copies that much memory from below the BBRAM window into the user buffer; through bbram_write() it copies attacker-controlled bytes over it. On the emulated driver that memory is kernel RAM: the reporter's proof of concept on qemu_x86 reads and overwrites a byte of an adjacent kernel MMIO pointer, and the kernel faults on its next use. On hardware it is the peripheral register space below the BBRAM window (on bbram_stm32, reached through a backup-register index that wraps below the register base). A user thread can therefore disclose and corrupt supervisor-only memory, and an access to an unmapped or side-effecting address in supervisor mode can raise a fatal fault.
The bbram syscalls are only present in the image when CONFIG_USERSPACE is enabled and bbram.h is emitted as a syscall header: in released versions this requires CONFIG_EMIT_ALL_SYSCALLS=y or an application-level zephyr_syscall_header() registration (without it a userspace build with BBRAM does not compile). In development builds after the header was registered by default, it applies to any CONFIG_USERSPACE build with a BBRAM driver.
The fix adds an overflow-safe range check against the device capacity (offset > capacity - size) in both syscall handlers before the driver is invoked: 8438d3b9c1a9 for the read path and c3ea409fc4a0 for the write path.
Analysis and contextual insights are available on OpenCVE Cloud.
Remediation
No vendor fix or workaround currently provided.
Additional remediation guidance may be available on OpenCVE Cloud.
Tracking
Sign in to view the affected projects.
Advisories
No advisories yet.
References
History
Sun, 06 Dec 2026 15:30:00 +0000
| Type | Values Removed | Values Added |
|---|---|---|
| Description | The BBRAM system call verifiers z_vrfy_bbram_read() and z_vrfy_bbram_write() in drivers/bbram/bbram_handlers.c validated the device object and the user buffer but never validated the caller-supplied offset and size. Range checking was left to the individual BBRAM drivers (bbram_emul, bbram_it8xxx2, bbram_npcx, bbram_rts5912, bbram_stm32, bbram_xec), which all use the check offset + size > capacity. That sum wraps for large offset values: with offset = SIZE_MAX - k + 1 and size = k + j (j no larger than the capacity), the sum wraps to j, the check passes, and the driver accesses base + offset, which wraps to k bytes below the BBRAM region. A user-mode thread that has been granted access to a BBRAM device object chooses both values, so k is bounded only by the size of the user buffer it supplies. Through bbram_read() the kernel copies that much memory from below the BBRAM window into the user buffer; through bbram_write() it copies attacker-controlled bytes over it. On the emulated driver that memory is kernel RAM: the reporter's proof of concept on qemu_x86 reads and overwrites a byte of an adjacent kernel MMIO pointer, and the kernel faults on its next use. On hardware it is the peripheral register space below the BBRAM window (on bbram_stm32, reached through a backup-register index that wraps below the register base). A user thread can therefore disclose and corrupt supervisor-only memory, and an access to an unmapped or side-effecting address in supervisor mode can raise a fatal fault. The bbram syscalls are only present in the image when CONFIG_USERSPACE is enabled and bbram.h is emitted as a syscall header: in released versions this requires CONFIG_EMIT_ALL_SYSCALLS=y or an application-level zephyr_syscall_header() registration (without it a userspace build with BBRAM does not compile). In development builds after the header was registered by default, it applies to any CONFIG_USERSPACE build with a BBRAM driver. The fix adds an overflow-safe range check against the device capacity (offset > capacity - size) in both syscall handlers before the driver is invoked: 8438d3b9c1a9 for the read path and c3ea409fc4a0 for the write path. | |
| Title | Integer wraparound in bbram_read and bbram_write syscalls allows user threads to read and overwrite kernel memory below the BBRAM region | |
| Weaknesses | CWE-125 CWE-190 CWE-787 |
|
| References |
| |
| Metrics |
cvssV3_1
|
Subscriptions
No data.
Status: PUBLISHED
Assigner: zephyr
Published:
Updated: 2026-12-06T15:16:29.360Z
Reserved: 2026-09-18T01:47:46.364Z
Link: CVE-2026-93466
No data.
No data.
No data.
OpenCVE Enrichment
No data.