Description
The SF32LB MPI QSPI NOR flash driver (drivers/flash/flash_sf32lb_mpi_qspi_nor.c) validated the flash offset and length on its read and write paths with the test (offset + size) > data->size. Because offset is a signed off_t while size is unsigned, a negative offset is converted to a large unsigned value and the addition can wrap to a small result that passes the check. The read path then performs memcpy(dst, (void *)(data->base + offset), size) and the write path programs flash at offset and cache-invalidates data->base + offset, in both cases accessing memory outside the mapped flash window. The driver's erase path already rejected negative offsets, but read and write did not.

In builds with CONFIG_USERSPACE, flash_read and flash_write are syscalls whose verifiers validate the device object and the caller's buffer but deliberately delegate offset bounds checking to the driver. An unprivileged thread that has been granted access to this flash device can therefore call the syscall with a crafted negative offset and a buffer valid in its own memory domain, and reach the unchecked access.

The most direct impact is on the read path: by choosing a negative offset and matching size, an attacker slides the memcpy source below the flash base and copies arbitrary CPU-addressable memory into its own buffer, disclosing memory it is not authorized to read. The write path additionally allows programming flash at an out-of-range address and invalidating an attacker-chosen cache range, affecting integrity and availability. Reachability requires userspace to be enabled and the raw flash device object to be granted to an untrusted thread.

The fix replaces the check with qspi_nor_range_is_valid(), which rejects negative offsets and performs the bound comparison in overflow-safe 64-bit arithmetic on both paths, and additionally adds an SRAM DMA bounce buffer plus source/destination overlap rejection to prevent a separate DMA bus-hang condition.
Published: 2026-08-07
Score: 6.6 Medium
EPSS: n/a
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

The SF32LB MPI QSPI NOR flash driver in Zephyr incorrectly validates offsets for read and write operations. Because the offset field is signed while the size field is unsigned, a negative offset is converted to a large unsigned value, and the addition can wrap around to a small result that passes the original bounds check. This allows a read to copy arbitrary CPU‑addressable memory into an attacker’s buffer, and a write to program flash at an out‑of‑range address and invalidate a chosen cache range. The resulting impact is a disclosure of non‑authorized memory (confidentiality loss) and potential corruption of the flash device (integrity and availability loss).

Affected Systems

Zephyr Project’s SF32LB MPI QSPI NOR flash driver (drivers/flash/flash_sf32lb_mpi_qspi_nor.c). The vulnerability is present in builds with CONFIG_USERSPACE enabled and when the raw flash device object is granted to an untrusted userspace thread. No specific version number is stated, so any active Zephyr configuration that includes the vulnerable driver code may be affected.

Risk and Exploitability

The CVSS score of 6.6 indicates moderate severity, and the EPSS score is not available. Because the exploit requires an unprivileged userspace thread to be granted access to the raw flash device and the userspace feature to be enabled, the risk is non‑zero but limited to configurations that expose the device. The vulnerability is not listed in CISA’s KEV catalog, suggesting no mass exploitation as of the information provided. Nonetheless, the out‑of‑bounds read can leak memory contents, and the write can compromise firmware integrity, so the potential impact warrants prompt remediation.

Generated by OpenCVE AI on August 7, 2026 at 22:51 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Update Zephyr to a version that includes commit 909eb56875 or later, which replaces the offset check with an overflow‑safe validation and adds a blink‑buffer to prevent DMA bus‑hangs.
  • If upgrading Zephyr is not immediately possible, disable CONFIG_USERSPACE or restrict the raw flash device so that untrusted userspace threads cannot access it; this removes the attack vector.
  • After implementing the patch or restricting access, review userspace privilege configuration and ensure that only trusted code can obtain raw flash device handles.

Generated by OpenCVE AI on August 7, 2026 at 22:51 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Fri, 07 Aug 2026 22:45:00 +0000

Type Values Removed Values Added
First Time appeared Zephyrproject
Zephyrproject zephyr
Vendors & Products Zephyrproject
Zephyrproject zephyr

Fri, 07 Aug 2026 21:30:00 +0000

Type Values Removed Values Added
Description The SF32LB MPI QSPI NOR flash driver (drivers/flash/flash_sf32lb_mpi_qspi_nor.c) validated the flash offset and length on its read and write paths with the test (offset + size) > data->size. Because offset is a signed off_t while size is unsigned, a negative offset is converted to a large unsigned value and the addition can wrap to a small result that passes the check. The read path then performs memcpy(dst, (void *)(data->base + offset), size) and the write path programs flash at offset and cache-invalidates data->base + offset, in both cases accessing memory outside the mapped flash window. The driver's erase path already rejected negative offsets, but read and write did not. In builds with CONFIG_USERSPACE, flash_read and flash_write are syscalls whose verifiers validate the device object and the caller's buffer but deliberately delegate offset bounds checking to the driver. An unprivileged thread that has been granted access to this flash device can therefore call the syscall with a crafted negative offset and a buffer valid in its own memory domain, and reach the unchecked access. The most direct impact is on the read path: by choosing a negative offset and matching size, an attacker slides the memcpy source below the flash base and copies arbitrary CPU-addressable memory into its own buffer, disclosing memory it is not authorized to read. The write path additionally allows programming flash at an out-of-range address and invalidating an attacker-chosen cache range, affecting integrity and availability. Reachability requires userspace to be enabled and the raw flash device object to be granted to an untrusted thread. The fix replaces the check with qspi_nor_range_is_valid(), which rejects negative offsets and performs the bound comparison in overflow-safe 64-bit arithmetic on both paths, and additionally adds an SRAM DMA bounce buffer plus source/destination overlap rejection to prevent a separate DMA bus-hang condition.
Title Missing negative-offset/overflow check in SF32LB MPI QSPI NOR flash driver allows out-of-bounds read and write
Weaknesses CWE-125
References
Metrics cvssV3_1

{'score': 6.6, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:L'}


Subscriptions

Zephyrproject Zephyr
cve-icon MITRE

Status: PUBLISHED

Assigner: zephyr

Published:

Updated: 2026-08-07T21:10:23.470Z

Reserved: 2026-06-09T05:26:14.980Z

Link: CVE-2026-11743

cve-icon Vulnrichment

No data.

cve-icon NVD

No data.

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-08-07T23:00:04Z

Weaknesses