Description
The flash_copy() system call is verified by z_vrfy_flash_copy() in drivers/flash/flash_util.c. On builds with CONFIG_USERSPACE enabled, this handler is the kernel-side trust boundary for a user-mode caller. Prior to the fix it validated only the output buffer (K_SYSCALL_MEMORY_WRITE) and passed the two struct device * arguments, src_dev and dst_dev, directly into the implementation without any object validation — unlike every sibling flash syscall, which guards its device pointer with K_SYSCALL_DRIVER_FLASH.

A user-mode thread fully controls the values of src_dev/dst_dev and the contents of its own address space. The implementation z_impl_flash_copy() dereferences these pointers and calls through their driver-API function tables (e.g. api->get_parameters(dst_dev), flash_read(src_dev, ...), flash_write(dst_dev, ...)). By supplying a pointer to a forged struct device whose api table contains attacker-chosen function pointers, an unprivileged thread can cause the kernel to call arbitrary code in supervisor mode; passing any arbitrary or invalid address otherwise yields a kernel crash or out-of-bounds read.

The result is a local privilege escalation out of the userspace sandbox (with kernel denial-of-service and information disclosure as lesser outcomes). The fix adds K_SYSCALL_DRIVER_FLASH(src_dev, read) and K_SYSCALL_DRIVER_FLASH(dst_dev, write) to z_vrfy_flash_copy(), which verify each device is a registered flash-driver kernel object the calling thread is permitted to use before any dereference, closing the path completely.
Published: 2026-08-17
Score: 8.8 High
EPSS: n/a
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

The flash_copy() system call in Zephyr was verified only against the destination buffer, while the source and destination device pointers were passed unchecked into the driver implementation. An unprivileged user process could forge a struct device whose API table contains malicious function pointers, causing the kernel to execute arbitrary code in supervisor mode. This results in a local privilege escalation, with denial‑of‑service and optional information disclosure as secondary effects.

Affected Systems

Zephyr Kernel – any build that enables CONFIG_USERSPACE and exposes the flash_copy() syscall is affected. The vulnerability manifests in all recent Zephyr releases prior to the commit that introduces device‑pointer validation. The affected products are listed under the cnvner field zephyrproject:zephyr; specific version ranges are not supplied. Adapters that rely on flash_copy() in a userspace context will be susceptible.

Risk and Exploitability

The CVSS score of 8.8 classifies the flaw as high severity. Despite no EPSS data, the exploit is conceptually straightforward for a local attacker who can craft a forged device structure. Once the kernel dereferences the supplied pointers, it invokes driver callbacks via the faux API table, handing the attacker complete privilege. The flaw has not yet been listed in the CISA KEV catalog, but its high CVSS rating and local nature warrant immediate attention. Attackers require only a userspace process with the ability to call flash_copy() and control of the memory that holds the forged device structures. The potential impact is full kernel compromise with elevated privileges, making exploitation highly consequential.

Generated by OpenCVE AI on August 17, 2026 at 17:42 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Apply a Zephyr kernel update that includes the driver‑pointer validation added in commit 1b1ecdc438092cdd469319a0d51cba6cf82e06f4 or later release.
  • Verify that recompiled kernels contain the K_SYSCALL_DRIVER_FLASH checks in z_vrfy_flash_copy() when CONFIG_USERSPACE is enabled.
  • If an update cannot be applied immediately, limit the attack surface by disabling CONFIG_USERSPACE for code that requires flash_copy() or restricting user‑mode access to flash drivers through kernel configuration or RBAC exclusions.

Generated by OpenCVE AI on August 17, 2026 at 17:42 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Mon, 17 Aug 2026 18:00:00 +0000

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

Mon, 17 Aug 2026 16:30:00 +0000

Type Values Removed Values Added
Description The flash_copy() system call is verified by z_vrfy_flash_copy() in drivers/flash/flash_util.c. On builds with CONFIG_USERSPACE enabled, this handler is the kernel-side trust boundary for a user-mode caller. Prior to the fix it validated only the output buffer (K_SYSCALL_MEMORY_WRITE) and passed the two struct device * arguments, src_dev and dst_dev, directly into the implementation without any object validation — unlike every sibling flash syscall, which guards its device pointer with K_SYSCALL_DRIVER_FLASH. A user-mode thread fully controls the values of src_dev/dst_dev and the contents of its own address space. The implementation z_impl_flash_copy() dereferences these pointers and calls through their driver-API function tables (e.g. api->get_parameters(dst_dev), flash_read(src_dev, ...), flash_write(dst_dev, ...)). By supplying a pointer to a forged struct device whose api table contains attacker-chosen function pointers, an unprivileged thread can cause the kernel to call arbitrary code in supervisor mode; passing any arbitrary or invalid address otherwise yields a kernel crash or out-of-bounds read. The result is a local privilege escalation out of the userspace sandbox (with kernel denial-of-service and information disclosure as lesser outcomes). The fix adds K_SYSCALL_DRIVER_FLASH(src_dev, read) and K_SYSCALL_DRIVER_FLASH(dst_dev, write) to z_vrfy_flash_copy(), which verify each device is a registered flash-driver kernel object the calling thread is permitted to use before any dereference, closing the path completely.
Title Missing device-pointer validation in flash_copy() syscall allows userspace privilege escalation
Weaknesses CWE-822
CWE-862
References
Metrics cvssV3_1

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


Subscriptions

Zephyrproject Zephyr
cve-icon MITRE

Status: PUBLISHED

Assigner: zephyr

Published:

Updated: 2026-08-17T18:25:14.470Z

Reserved: 2026-05-27T22:08:41.676Z

Link: CVE-2026-9771

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Received

Published: 2026-08-17T17:16:57.720

Modified: 2026-08-17T17:16:57.720

Link: CVE-2026-9771

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-08-17T17:45:03Z

Weaknesses