Skip to contentSkip to conversation

CVE-2025-38103: HID: usbhid: Eliminate recurrent out-of-bounds bug in usbhid_parse()

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Jul 3, 2025

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

HID: usbhid: Eliminate recurrent out-of-bounds bug in usbhid_parse()

Update struct hid_descriptor to better reflect the mandatory and optional parts of the HID Descriptor as per USB HID 1.11 specification.
Note: the kernel currently does not parse any optional HID class descriptors, only the mandatory report descriptor.

Update all references to member element desc[0] to rpt_desc.

Add test to verify bLength and bNumDescriptors values are valid.

Replace the for loop with direct access to the mandatory HID class descriptor member for the report descriptor. This eliminates the possibility of getting an out-of-bounds fault.

Add a warning message if the HID descriptor contains any unsupported optional HID class descriptors.

The Linux kernel CVE team has assigned CVE-2025-38103 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 4.14 with commit f043bfc98c193c284e2cd768fefabe18ac2fed9b and fixed in 5.4.295 with commit 7a6d6b68db128da2078ccd9a751dfa3f75c9cf5b
	Issue introduced in 4.14 with commit f043bfc98c193c284e2cd768fefabe18ac2fed9b and fixed in 5.10.239 with commit 41827a2dbdd7880df9881506dee13bc88d4230bb
	Issue introduced in 4.14 with commit f043bfc98c193c284e2cd768fefabe18ac2fed9b and fixed in 5.15.186 with commit 1df80d748f984290c895e843401824215dcfbfb0
	Issue introduced in 4.14 with commit f043bfc98c193c284e2cd768fefabe18ac2fed9b and fixed in 6.1.142 with commit a8f842534807985d3a676006d140541b87044345
	Issue introduced in 4.14 with commit f043bfc98c193c284e2cd768fefabe18ac2fed9b and fixed in 6.6.94 with commit 4fa7831cf0ac71a0a345369d1a6084f2b096e55e
	Issue introduced in 4.14 with commit f043bfc98c193c284e2cd768fefabe18ac2fed9b and fixed in 6.12.34 with commit 74388368927e9c52a69524af5bbd6c55eb4690de
	Issue introduced in 4.14 with commit f043bfc98c193c284e2cd768fefabe18ac2fed9b and fixed in 6.15.3 with commit 485e1b741eb838cbe1d6b0e81e5ab62ae6c095cf
	Issue introduced in 4.14 with commit f043bfc98c193c284e2cd768fefabe18ac2fed9b and fixed in 6.16-rc1 with commit fe7f7ac8e0c708446ff017453add769ffc15deed
	Issue introduced in 3.2.95 with commit 99de0781e0de7c866f762b931351c2a501c3074f
	Issue introduced in 3.16.50 with commit 8d675aa967d3927ac100f7af48f2a2af8a041d2d
	Issue introduced in 3.18.76 with commit f4cf5d75416ae3d79e03179fe6f4b9f1231ae42c
	Issue introduced in 4.1.46 with commit 439f76690d7d5dd212ea7bebc1f2fa077e3d645d
	Issue introduced in 4.4.93 with commit 2929cb995378205bceda86d6fd3cbc22e522f97f
	Issue introduced in 4.9.57 with commit 57265cddde308292af881ce634a5378dd4e25900
	Issue introduced in 4.13.8 with commit 984154e7eef1f9e543dabd7422cfc99015778732

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2025-38103

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
drivers/hid/hid-hyperv.c
drivers/hid/usbhid/hid-core.c
drivers/usb/gadget/function/f_hid.c
include/linux/hid.h

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/7a6d6b68db128da2078ccd9a751dfa3f75c9cf5b
	https://git.kernel.org/stable/c/41827a2dbdd7880df9881506dee13bc88d4230bb
	https://git.kernel.org/stable/c/1df80d748f984290c895e843401824215dcfbfb0
	https://git.kernel.org/stable/c/a8f842534807985d3a676006d140541b87044345
	https://git.kernel.org/stable/c/4fa7831cf0ac71a0a345369d1a6084f2b096e55e
	https://git.kernel.org/stable/c/74388368927e9c52a69524af5bbd6c55eb4690de
	https://git.kernel.org/stable/c/485e1b741eb838cbe1d6b0e81e5ab62ae6c095cf
	https://git.kernel.org/stable/c/fe7f7ac8e0c708446ff017453add769ffc15deed