CVE-2024-42236 usb: gadget: configfs: Prevent OOB read/write in usb_string_copy()
A local attacker can trigger an out-of-bounds read and write in the Linux kernel USB gadget configfs interface, potentially leading to code execution or system crash.
- Exploited in the wild
- Not known
- Login needed
- Any signed-in user
- Attackable
- Local or same network only
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2024-42236?
CVE-2024-42236 is a high-severity memory corruption vulnerability in Linux kernel, published on 7 Aug 2024. It can only be exploited from the same machine or local network, with no action from the victim.
Official description
In the Linux kernel, the following vulnerability has been resolved:
usb: gadget: configfs: Prevent OOB read/write in usb_string_copy()
Userspace provided string 's' could trivially have the length zero. Left unchecked this will firstly result in an OOB read in the form `if (str[0 - 1] == '\n') followed closely by an OOB write in the form `str[0 - 1] = '\0'`.
There is already a validating check to catch strings that are too long. Let's supply an additional check for invalid strings that are too short.
Weakness: CWE-787
Which versions are affected by CVE-2024-42236?
It affects 1 product.
Products include Linux kernel.
How do I fix CVE-2024-42236?
Apply the vendor's patch.
Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.
Is CVE-2024-42236 being exploited?
There is no known exploitation of CVE-2024-42236 in the wild and no public exploit code.
Other vulnerabilities in Linux kernel
Sources
Also known as AZL-47471, AZL-47621, BELL-CVE-2024-42236, DEBIAN-CVE-2024-42236, GHSA-557r-rm2w-qvrj, UBUNTU-CVE-2024-42236.