CVE-2025-38557

Source
https://nvd.nist.gov/vuln/detail/CVE-2025-38557
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2025-38557.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2025-38557
Downstream
Published
2025-08-19T17:02:35.641Z
Modified
2025-11-27T02:33:29.442541Z
Summary
HID: apple: validate feature-report field count to prevent NULL pointer dereference
Details

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

HID: apple: validate feature-report field count to prevent NULL pointer dereference

A malicious HID device with quirk APPLEMAGICBACKLIGHT can trigger a NULL pointer dereference whilst the power feature-report is toggled and sent to the device in applemagicbacklightreportset(). The power feature-report is expected to have two data fields, but if the descriptor declares one field then accessing field[1] and dereferencing it in applemagicbacklightreportset() becomes invalid since field[1] will be NULL.

An example of a minimal descriptor which can cause the crash is something like the following where the report with ID 3 (power report) only references a single 1-byte field. When hid core parses the descriptor it will encounter the final feature tag, allocate a hid_report (all members of field[] will be zeroed out), create field structure and populate it, increasing the maxfield to 1. The subsequent field[1] access and dereference causes the crash.

Usage Page (Vendor Defined 0xFF00) Usage (0x0F) Collection (Application) Report ID (1) Usage (0x01) Logical Minimum (0) Logical Maximum (255) Report Size (8) Report Count (1) Feature (Data,Var,Abs)

Usage (0x02)
Logical Maximum (32767)
Report Size (16)
Report Count (1)
Feature (Data,Var,Abs)

Report ID (3)
Usage (0x03)
Logical Minimum (0)
Logical Maximum (1)
Report Size (8)
Report Count (1)
Feature (Data,Var,Abs)

End Collection

Here we see the KASAN splat when the kernel dereferences the NULL pointer and crashes:

[ 15.164723] Oops: general protection fault, probably for non-canonical address 0xdffffc0000000006: 0000 [#1] SMP KASAN NOPTI [ 15.165691] KASAN: null-ptr-deref in range [0x0000000000000030-0x0000000000000037] [ 15.165691] CPU: 0 UID: 0 PID: 10 Comm: kworker/0:1 Not tainted 6.15.0 #31 PREEMPT(voluntary) [ 15.165691] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 [ 15.165691] RIP: 0010:applemagicbacklightreportset+0xbf/0x210 [ 15.165691] Call Trace: [ 15.165691] <TASK> [ 15.165691] appleprobe+0x571/0xa20 [ 15.165691] hiddeviceprobe+0x2e2/0x6f0 [ 15.165691] reallyprobe+0x1ca/0x5c0 [ 15.165691] _driverprobedevice+0x24f/0x310 [ 15.165691] driverprobedevice+0x4a/0xd0 [ 15.165691] _deviceattachdriver+0x169/0x220 [ 15.165691] busforeachdrv+0x118/0x1b0 [ 15.165691] _deviceattach+0x1d5/0x380 [ 15.165691] deviceinitialprobe+0x12/0x20 [ 15.165691] busprobedevice+0x13d/0x180 [ 15.165691] deviceadd+0xd87/0x1510 [...]

To fix this issue we should validate the number of fields that the backlight and power reports have and if they do not have the required number of fields then bail.

Database specific
{
    "cna_assigner": "Linux",
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/blob/cc431b3424123d84bcd7afd4de150b33f117a8ef/cves/2025/38xxx/CVE-2025-38557.json"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
394ba612f9419ec5bfebbffb72212fd3b2094986
Fixed
ba08cc6801ec5fb98f2d02b5f0c614c931845325
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
394ba612f9419ec5bfebbffb72212fd3b2094986
Fixed
7e15d1eaa88179c5185e57a38ab05fe852d0cb8d
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
394ba612f9419ec5bfebbffb72212fd3b2094986
Fixed
00896c3f41cb6b74fec853386076115ba50baf0a
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
394ba612f9419ec5bfebbffb72212fd3b2094986
Fixed
1bb3363da862e0464ec050eea2fb5472a36ad86b

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
6.11.0
Fixed
6.12.42
Type
ECOSYSTEM
Events
Introduced
6.13.0
Fixed
6.15.10
Type
ECOSYSTEM
Events
Introduced
6.16.0
Fixed
6.16.1