Skip to main content

CVE-2024-36895: Vulnerability in Linux Linux

Medium
VulnerabilityCVE-2024-36895cvecve-2024-36895
Published: Thu May 30 2024 (05/30/2024, 15:29:00 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: usb: gadget: uvc: use correct buffer size when parsing configfs lists This commit fixes uvc gadget support on 32-bit platforms. Commit 0df28607c5cb ("usb: gadget: uvc: Generalise helper functions for reuse") introduced a helper function __uvcg_iter_item_entries() to aid with parsing lists of items on configfs attributes stores. This function is a generalization of another very similar function, which used a stack-allocated temporary buffer of fixed size for each item in the list and used the sizeof() operator to check for potential buffer overruns. The new function was changed to allocate the now variably sized temp buffer on heap, but wasn't properly updated to also check for max buffer size using the computed size instead of sizeof() operator. As a result, the maximum item size was 7 (plus null terminator) on 64-bit platforms, and 3 on 32-bit ones. While 7 is accidentally just barely enough, 3 is definitely too small for some of UVC configfs attributes. For example, dwFrameInteval, specified in 100ns units, usually has 6-digit item values, e.g. 166666 for 60fps.

AI-Powered Analysis

AILast updated: 06/29/2025, 09:56:11 UTC

Technical Analysis

CVE-2024-36895 is a vulnerability identified in the Linux kernel's USB gadget subsystem, specifically affecting the USB Video Class (UVC) gadget driver. The issue arises from improper buffer size handling when parsing configuration filesystem (configfs) attribute lists on 32-bit platforms. A helper function (__uvcg_iter_item_entries()) introduced in a prior commit was designed to generalize parsing of variable-length lists by allocating a temporary buffer on the heap. However, the function failed to correctly validate the maximum buffer size using the computed size, instead relying on the sizeof() operator, which is inappropriate for dynamically sized buffers. This led to a maximum item size limit of 7 bytes (plus null terminator) on 64-bit systems, which is marginally sufficient, but only 3 bytes on 32-bit systems, which is insufficient for certain UVC configfs attributes such as dwFrameInterval. The dwFrameInterval attribute represents frame intervals in 100ns units and typically requires 6-digit values (e.g., 166666 for 60fps), exceeding the 3-byte limit on 32-bit platforms. This buffer size miscalculation can cause buffer overruns or truncation when parsing these attributes, potentially leading to memory corruption or unexpected behavior in the USB gadget subsystem. The vulnerability was resolved by correcting the buffer size checks to use the computed size rather than sizeof(), ensuring proper handling of variable-length configfs lists on all platforms. No known exploits are currently reported in the wild, and the issue primarily affects Linux kernel versions containing the faulty commit 0df28607c5cb. This vulnerability is technical and subtle, affecting low-level USB gadget functionality on 32-bit Linux systems, which are still in use in embedded devices and specialized hardware environments.

Potential Impact

For European organizations, the impact of CVE-2024-36895 depends on their use of 32-bit Linux systems with USB gadget functionality enabled, particularly those leveraging UVC gadget drivers for video streaming or device emulation. Embedded systems, industrial control systems, IoT devices, and specialized hardware running 32-bit Linux kernels may be vulnerable. Exploitation could lead to memory corruption, causing kernel instability, denial of service, or potential privilege escalation if an attacker can craft malicious configfs attribute lists. This could disrupt critical services or device operations, especially in sectors relying on embedded Linux devices such as manufacturing, telecommunications, healthcare, and transportation. Although no active exploits are known, the vulnerability represents a risk for organizations deploying 32-bit Linux-based USB gadgets, particularly where devices are exposed to untrusted users or networks. The limited scope to 32-bit platforms reduces the overall impact, as many modern systems use 64-bit architectures. However, legacy and embedded devices remain at risk, and failure to patch could lead to operational disruptions or serve as an attack vector in multi-stage attacks targeting device firmware or kernel components.

Mitigation Recommendations

European organizations should take the following specific mitigation steps: 1) Identify and inventory all 32-bit Linux systems in their environment, focusing on those using USB gadget functionality and UVC drivers. 2) Apply the official Linux kernel patches that correct the buffer size validation in the USB gadget subsystem as soon as they become available from trusted sources or Linux distributions. 3) For embedded devices or appliances where kernel updates are not straightforward, coordinate with vendors to obtain firmware updates or mitigations. 4) Restrict access to configfs interfaces and USB gadget configuration to trusted administrators only, minimizing exposure to untrusted users or processes that could exploit the vulnerability. 5) Implement monitoring for unusual kernel crashes or USB gadget subsystem errors that could indicate exploitation attempts. 6) Where feasible, consider migrating from 32-bit to 64-bit platforms to reduce exposure to this and similar legacy vulnerabilities. 7) Conduct security assessments on embedded devices to evaluate the risk and implement compensating controls such as network segmentation and device hardening.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2024-05-30T15:25:07.066Z
Cisa Enriched
true
Cvss Version
null
State
PUBLISHED

Threat ID: 682d9828c4522896dcbe25d8

Added to database: 5/21/2025, 9:08:56 AM

Last enriched: 6/29/2025, 9:56:11 AM

Last updated: 8/18/2025, 1:45:33 AM

Views: 12

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats