CVE-2021-39685: Linux USB Gadget Buffer overflows

:linux_kernel: Updated 02 Oct 2025

Summary

01/03/2022
Yes i
High
Not published

CVE-2021-39685: In various setup methods of the USB gadget subsystem, there is a possible out of bounds write due to an incorrect flag check. Affects :linux_kernel: versions >= :0, < :2022-03-05. Fixed in :2022-03-05. How to fix ↓

Also tracked for

The same CVE-2021-39685 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The Linux USB Gadget subsystem is responsible for enabling USB device functionality on Linux systems. It allows the system to act as a USB device, providing various functionalities such as file transfer, network connectivity, and emulation of USB devices. This vulnerability affects the USB gadget subsystem in the Linux kernel, specifically in various setup methods. The vulnerability arises due to an incorrect flag check, leading to a possible out-of-bounds write. Exploiting this vulnerability could result in local privilege escalation without requiring additional execution privileges. It is important to note that user interaction is not necessary for exploitation.

Vulnerability Detail

The vulnerability in the Linux USB Gadget subsystem arises from an incorrect flag check in various setup methods. This flaw allows an attacker to perform an out-of-bounds write, potentially leading to local privilege escalation. By exploiting this vulnerability, an attacker could gain elevated privileges on the affected system. The impact of this vulnerability is significant as it could allow an attacker to execute arbitrary code or access sensitive information. It is crucial to apply the necessary fixes to mitigate the risk of exploitation.

How To Fix

Minimum fixed version

:2022-03-05

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Conclusion

The Linux USB Gadget subsystem is vulnerable to buffer overflows due to an incorrect flag check in various setup methods. This vulnerability could allow an attacker to escalate their privileges on the affected system without requiring additional execution privileges. It is crucial to update the Linux kernel with the provided fixes to mitigate the risk of exploitation. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for :linux_kernel: →

Share this vulnerability

FAQ

The Linux USB Gadget subsystem enables a Linux system to act as a USB device, providing various functionalities such as file transfer, network connectivity, and emulation of USB devices.

This vulnerability allows for local privilege escalation, potentially enabling an attacker to execute arbitrary code or access sensitive information on the affected system.

No, user interaction is not needed for exploitation of this vulnerability.

To fix this vulnerability, it is recommended to update the Linux kernel to a version that includes the necessary patches provided by the Android ecosystem.

The fixes for this vulnerability can be obtained from the Android source repositories. Links to the specific fixes are provided in the 'how_to_fix' section of this report.

Related vulnerabilities

Recent vulnerabilities recorded for :linux_kernel:.

How To Fix

Minimum fixed version

:2022-03-05

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback