Skip to main content

CVE-2025-21835: Vulnerability in Linux Linux

Medium
VulnerabilityCVE-2025-21835cvecve-2025-21835
Published: Fri Mar 07 2025 (03/07/2025, 09:09:55 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: usb: gadget: f_midi: fix MIDI Streaming descriptor lengths While the MIDI jacks are configured correctly, and the MIDIStreaming endpoint descriptors are filled with the correct information, bNumEmbMIDIJack and bLength are set incorrectly in these descriptors. This does not matter when the numbers of in and out ports are equal, but when they differ the host will receive broken descriptors with uninitialized stack memory leaking into the descriptor for whichever value is smaller. The precise meaning of "in" and "out" in the port counts is not clearly defined and can be confusing. But elsewhere the driver consistently uses this to match the USB meaning of IN and OUT viewed from the host, so that "in" ports send data to the host and "out" ports receive data from it.

AI-Powered Analysis

AILast updated: 06/30/2025, 09:41:48 UTC

Technical Analysis

CVE-2025-21835 is a vulnerability identified in the Linux kernel's USB gadget MIDI function driver (f_midi). The issue arises from incorrect setting of the bNumEmbMIDIJack and bLength fields within the MIDI Streaming endpoint descriptors. While the MIDI jacks themselves are configured correctly and the endpoint descriptors contain accurate information, these two fields are improperly set. This discrepancy does not affect scenarios where the number of MIDI input (IN) and output (OUT) ports are equal. However, when these counts differ, the host system receives malformed USB descriptors containing uninitialized stack memory. This memory leakage could potentially expose sensitive kernel stack data to the host. The vulnerability stems from confusion around the definition of IN and OUT ports, but the driver aligns with the USB standard where IN ports send data to the host and OUT ports receive data from it. The flawed descriptors may lead to information disclosure or unpredictable behavior in USB MIDI device communication. No known exploits are currently reported in the wild, and no CVSS score has been assigned yet. The vulnerability was published on March 7, 2025, and affects multiple versions of the Linux kernel identified by a specific commit hash. The issue has been resolved in the kernel, but patch links are not provided in the data. This vulnerability is subtle and specific to USB MIDI gadget functionality, which is typically used in embedded or specialized Linux systems acting as USB MIDI devices.

Potential Impact

For European organizations, the impact of CVE-2025-21835 depends largely on their use of Linux-based systems with USB MIDI gadget functionality. This vulnerability could lead to leakage of uninitialized kernel stack memory to connected USB hosts, potentially exposing sensitive information or enabling further exploitation if combined with other vulnerabilities. Organizations in sectors such as professional audio production, broadcasting, or embedded device manufacturing that utilize Linux USB MIDI gadgets may be at risk. While the vulnerability does not directly allow code execution or privilege escalation, information leakage from kernel memory can aid attackers in crafting more effective attacks. The impact on confidentiality is moderate due to potential exposure of sensitive data. Integrity and availability impacts are low as the vulnerability does not inherently cause system crashes or data corruption. Since no known exploits exist yet, the immediate risk is limited, but the vulnerability should be addressed promptly to prevent future exploitation. European organizations with Linux-based embedded systems or specialized USB MIDI devices should assess their exposure and apply patches to mitigate risks.

Mitigation Recommendations

1. Apply the latest Linux kernel updates that include the fix for CVE-2025-21835 as soon as they become available. Monitor official Linux kernel repositories and vendor advisories for patches. 2. For organizations using custom or embedded Linux distributions, ensure that the USB MIDI gadget driver is updated or disabled if not required. 3. Implement strict USB device control policies to limit the connection of untrusted USB devices, especially in sensitive environments. 4. Conduct thorough testing of USB MIDI device interactions in controlled environments to detect any anomalous behavior related to descriptor handling. 5. Employ kernel memory protection mechanisms such as Kernel Address Space Layout Randomization (KASLR) and stack canaries to reduce the risk of exploitation from leaked memory. 6. Monitor system logs and USB device activity for unusual patterns that could indicate attempts to exploit this vulnerability. 7. Educate system administrators and developers about the correct handling of USB descriptors and the importance of keeping kernel components up to date.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2024-12-29T08:45:45.777Z
Cisa Enriched
false
Cvss Version
null
State
PUBLISHED

Threat ID: 682d9832c4522896dcbe895c

Added to database: 5/21/2025, 9:09:06 AM

Last enriched: 6/30/2025, 9:41:48 AM

Last updated: 8/14/2025, 11:57:10 PM

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