Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2025-38497

CVE-2025-38497: Linux Kernel Buffer Overflow Vulnerability

CVE-2025-38497 is a buffer overflow flaw in the Linux Kernel USB gadget configfs that allows out-of-bounds memory reads when writing empty strings. This article covers technical details, affected versions, and mitigation.

Published:

CVE-2025-38497 Overview

CVE-2025-38497 is an out-of-bounds read vulnerability [CWE-125] in the Linux kernel USB gadget ConfigFS subsystem. The flaw affects the os_desc_qw_sign_store() and webusb_landingPage_store() functions. Writing an empty string to the qw_sign or landingPage sysfs attributes triggers an access to page[l - 1] before the length l is validated as non-zero. This underflow reads memory outside the intended buffer bounds. The issue impacts multiple Linux kernel versions including 6.16 release candidates and has been backported to Debian LTS distributions.

Critical Impact

A local authenticated attacker with write access to the affected sysfs attributes can trigger an out-of-bounds read, resulting in kernel memory disclosure or a denial-of-service condition.

Affected Products

  • Linux Kernel (multiple versions, including 6.16-rc1 through 6.16-rc6)
  • Debian Linux 11.0
  • Systems using USB gadget ConfigFS with qw_sign or landingPage attributes

Discovery Timeline

  • 2025-07-28 - CVE-2025-38497 published to the National Vulnerability Database (NVD)
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2025-38497

Vulnerability Analysis

The vulnerability resides in the Linux kernel USB gadget ConfigFS interface, which exposes writable sysfs attributes for configuring USB descriptors. When userspace writes to qw_sign or landingPage, the store handlers process the input to strip a trailing newline. Before checking whether the input length is greater than zero, the code dereferences page[l - 1]. An empty write causes l to equal zero, and the expression l - 1 underflows to a large unsigned index. The kernel then reads memory outside the input buffer.

The read is an out-of-bounds access [CWE-125] rather than a write. However, the consequence depends on adjacent memory layout. Depending on kernel configuration and allocator behavior, this can leak sensitive kernel data or trigger a fault leading to denial of service.

Root Cause

The root cause is missing input length validation prior to array indexing. The store functions assume that the written page buffer contains at least one byte and attempt to inspect the final character to determine whether a trailing newline should be trimmed. There is no guard clause that returns early when the write length is zero.

Attack Vector

Exploitation requires local access with permissions to write to the vulnerable ConfigFS sysfs attributes under /sys/kernel/config/usb_gadget/*/os_desc/qw_sign or the WebUSB landingPage path. On typical systems, these paths are restricted to privileged users, but any process with the required capability or misconfigured permissions can trigger the flaw with a zero-length write. No user interaction is required. The vulnerability requires low complexity and low privileges according to the CVSS vector recorded in NVD.

See the upstream fix commits linked in the Kernel Git Commit 15a8720 and related patches for the corrected boundary check that returns immediately on zero-length input.

Detection Methods for CVE-2025-38497

Indicators of Compromise

  • Unexpected zero-length writes to /sys/kernel/config/usb_gadget/*/os_desc/qw_sign or webusb landingPage sysfs paths.
  • Kernel log entries referencing faults in os_desc_qw_sign_store or webusb_landingPage_store.
  • Processes accessing USB gadget ConfigFS interfaces without a legitimate device provisioning workflow.

Detection Strategies

  • Audit kernel version output from uname -r against the patched stable kernel commits published by kernel.org.
  • Monitor auditd for write syscalls targeting USB gadget ConfigFS attributes with a byte count of zero.
  • Correlate kernel dmesg output for KASAN or slab out-of-bounds warnings tied to the affected functions.

Monitoring Recommendations

  • Enable Linux audit rules on /sys/kernel/config/usb_gadget/ to capture write activity and originating processes.
  • Forward kernel logs to a centralized data lake for detection of anomalous ConfigFS access patterns.
  • Track privileged process behavior on embedded, mobile, and gadget-capable Linux systems where USB gadget mode is common.

How to Mitigate CVE-2025-38497

Immediate Actions Required

  • Apply the upstream Linux kernel patches referenced in the vendor advisories and rebuild or update affected kernel packages.
  • Update Debian systems using the fixes published in the Debian LTS Announcement #00007 and Debian LTS Announcement #00008.
  • Restrict local write access to USB gadget ConfigFS sysfs attributes to trusted administrative users only.

Patch Information

The upstream fix adds an explicit zero-length check at the entry of os_desc_qw_sign_store() and webusb_landingPage_store() so the functions return immediately for empty writes. Fixes are available in multiple stable branches. See Kernel Git Commit 22b7897, Kernel Git Commit 2798111, Kernel Git Commit 3014168, Kernel Git Commit 58bdd51, Kernel Git Commit 783ea37, Kernel Git Commit 78b4114, and Kernel Git Commit d68b7c8.

Workarounds

  • If the USB gadget subsystem is not required, unload the libcomposite module and disable ConfigFS-based gadget configuration.
  • Tighten filesystem permissions on /sys/kernel/config/usb_gadget/ so only trusted provisioning services can write descriptor attributes.
  • Restrict user access on multi-tenant Linux hosts to prevent local principals from reaching the vulnerable code path.

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.