CVE-2025-38557
JSON

5.5medium

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

Severity
5.5medium CVSS:3.1 by NVD
Exploit likelihood
0.19% (higher than 9% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
Linux

Description

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 APPLE_MAGIC_BACKLIGHT can trigger a NULL pointer dereference whilst the power feature-report is toggled and sent to the device in apple_magic_backlight_report_set(). 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 apple_magic_backlight_report_set() 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:apple_magic_backlight_report_set+0xbf/0x210 [ 15.165691] Call Trace: [ 15.165691] <TASK> [ 15.165691] apple_probe+0x571/0xa20 [ 15.165691] hid_device_probe+0x2e2/0x6f0 [ 15.165691] really_probe+0x1ca/0x5c0 [ 15.165691] __driver_probe_device+0x24f/0x310 [ 15.165691] driver_probe_device+0x4a/0xd0 [ 15.165691] __device_attach_driver+0x169/0x220 [ 15.165691] bus_for_each_drv+0x118/0x1b0 [ 15.165691] __device_attach+0x1d5/0x380 [ 15.165691] device_initial_probe+0x12/0x20 [ 15.165691] bus_probe_device+0x13d/0x180 [ 15.165691] device_add+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.

Affected

Product or packageVersionsReported by
Linux Linuxfrom 394ba612f9419ec5bfebbffb72212fd3b2094986 before ba08cc6801ec5fb98f2d02b5f0c614c931845325, from 394ba612f9419ec5bfebbffb72212fd3b2094986 before 7e15d1eaa88179c5185e57a38ab05fe852d0cb8d, from 394ba612f9419ec5bfebbffb72212fd3b2094986 before 00896c3f41cb6b74fec853386076115ba50baf0a, from 394ba612f9419ec5bfebbffb72212fd3b2094986 before 1bb3363da862e0464ec050eea2fb5472a36ad86b, 6.11
Not affected: before 6.11, from 6.12.42 up to 6.12.*, from 6.15.10 up to 6.15.*, from 6.16.1 up to 6.16.*, from 6.17 up to *
CVE List
linux linux_kernelfrom 6.11 before 6.12.42, from 6.13 before 6.15.10, from 6.16 before 6.16.1NVD

Classification

CWE-476

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

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 APPLE_MAGIC_BACKLIGHT can trigger a NULL pointer dereference whilst the power feature-report is toggled and sent to the device in apple_magic_backlight_report_set(). 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 apple_magic_backlight_report_set() 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:apple_magic_backlight_report_set+0xbf/0x210 [ 15.165691] Call Trace: [ 15.165691] <TASK> [ 15.165691] apple_probe+0x571/0xa20 [ 15.165691] hid_device_probe+0x2e2/0x6f0 [ 15.165691] really_probe+0x1ca/0x5c0 [ 15.165691] __driver_probe_device+0x24f/0x310 [ 15.165691] driver_probe_device+0x4a/0xd0 [ 15.165691] __device_attach_driver+0x169/0x220 [ 15.165691] bus_for_each_drv+0x118/0x1b0 [ 15.165691] __device_attach+0x1d5/0x380 [ 15.165691] device_initial_probe+0x12/0x20 [ 15.165691] bus_probe_device+0x13d/0x180 [ 15.165691] device_add+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.

NVD (es)

En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: HID: apple: validar el recuento de campos del informe de características para evitar la desreferencia de puntero NULL. Un dispositivo HID malicioso con la peculiaridad APPLE_MAGIC_BACKLIGHT puede activar una desreferencia de puntero NULL mientras el informe de características de potencia se conmuta y se envía al dispositivo en apple_magic_backlight_report_set(). Se espera que el informe de características de potencia tenga dos campos de datos, pero si el descriptor declara un campo, entonces acceder a field[1] y desreferenciarlo en apple_magic_backlight_report_set() se vuelve inválido ya que field[1] será NULL. Un ejemplo de un descriptor mínimo que puede causar el bloqueo es algo como lo siguiente, donde el informe con ID 3 (informe de potencia) solo hace referencia a un único campo de 1 byte. Cuando el núcleo hid analiza el descriptor, encontrará la etiqueta de característica final, asignará un hid_report (todos los miembros de field[] se pondrán a cero), creará una estructura de campo y la completará, aumentando el maxfield a 1. El acceso y la desreferencia a field[1] posteriores provocan el bloqueo. Página de uso (definida por el proveedor 0xFF00) Uso (0x0F) Recopilación (aplicación) ID de informe (1) Uso (0x01) Mínimo lógico (0) Máximo lógico (255) Tamaño de informe (8) Cantidad de informes (1) Característica (datos, variables, abs) Uso (0x02) Máximo lógico (32767) Tamaño de informe (16) Cantidad de informes (1) Característica (datos, variables, abs) ID de informe (3) Uso (0x03) Mínimo lógico (0) Máximo lógico (1) Tamaño de informe (8) Cantidad de informes (1) Característica (datos, variables, abs) Fin de recopilación Aquí vemos el splat de KASAN cuando el núcleo desreferencia el puntero NULL y se bloquea: [ 15.164723] Ups: fallo de protección general, probablemente para la dirección no canónica 0xdffffc0000000006: 0000 [#1] SMP KASAN NOPTI [ 15.165691] KASAN: null-ptr-deref en el rango [0x0000000000000030-0x0000000000000037] [ 15.165691] CPU: 0 UID: 0 PID: 10 Comm: kworker/0:1 No contaminado 6.15.0 #31 PREEMPT(voluntario) [ 15.165691] Nombre del hardware: PC estándar QEMU (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 01/04/2014 [ 15.165691] RIP: 0010:apple_magic_backlight_report_set+0xbf/0x210 [ 15.165691] Rastreo de llamadas: [ 15.165691] [ 15.165691] apple_probe+0x571/0xa20 [ 15.165691] hid_device_probe+0x2e2/0x6f0 [ 15.165691] really_probe+0x1ca/0x5c0 [ 15.165691] __driver_probe_device+0x24f/0x310 [ 15.165691] driver_probe_device+0x4a/0xd0 [ 15.165691] __device_attach_driver+0x169/0x220 [ 15.165691] bus_for_each_drv+0x118/0x1b0 [ 15.165691] __device_attach+0x1d5/0x380 [ 15.165691] device_initial_probe+0x12/0x20 [ 15.165691] bus_probe_device+0x13d/0x180 [ 15.165691] device_add+0xd87/0x1510 [...] Para solucionar este problema debemos validar el número de campos que tienen los reportes de retroiluminación y energía y si no tienen el número de campos requerido entonces abandonar.

References

Sources

SourceRecordLicence
CVE ListCVE-2025-38557 changed 2026-11-05CVE Terms of Use
NVDCVE-2025-38557 changed 2026-11-05Public domain