CVE-2024-53214
JSON

7.8high

vfio/pci: Properly hide first-in-list PCIe extended capability

Severity
7.8high CVSS:3.1 by Linux
Exploit likelihood
0.26% (higher than 18% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
Linux

Description

In the Linux kernel, the following vulnerability has been resolved: vfio/pci: Properly hide first-in-list PCIe extended capability There are cases where a PCIe extended capability should be hidden from the user. For example, an unknown capability (i.e., capability with ID greater than PCI_EXT_CAP_ID_MAX) or a capability that is intentionally chosen to be hidden from the user. Hiding a capability is done by virtualizing and modifying the 'Next Capability Offset' field of the previous capability so it points to the capability after the one that should be hidden. The special case where the first capability in the list should be hidden is handled differently because there is no previous capability that can be modified. In this case, the capability ID and version are zeroed while leaving the next pointer intact. This hides the capability and leaves an anchor for the rest of the capability list. However, today, hiding the first capability in the list is not done properly if the capability is unknown, as struct vfio_pci_core_device->pci_config_map is set to the capability ID during initialization but the capability ID is not properly checked later when used in vfio_config_do_rw(). This leads to the following warning [1] and to an out-of-bounds access to ecap_perms array. Fix it by checking cap_id in vfio_config_do_rw(), and if it is greater than PCI_EXT_CAP_ID_MAX, use an alternative struct perm_bits for direct read only access instead of the ecap_perms array. Note that this is safe since the above is the only case where cap_id can exceed PCI_EXT_CAP_ID_MAX (except for the special capabilities, which are already checked before). [1] WARNING: CPU: 118 PID: 5329 at drivers/vfio/pci/vfio_pci_config.c:1900 vfio_pci_config_rw+0x395/0x430 [vfio_pci_core] CPU: 118 UID: 0 PID: 5329 Comm: simx-qemu-syste Not tainted 6.12.0+ #1 (snip) Call Trace: <TASK> ? show_regs+0x69/0x80 ? __warn+0x8d/0x140 ? vfio_pci_config_rw+0x395/0x430 [vfio_pci_core] ? report_bug+0x18f/0x1a0 ? handle_bug+0x63/0xa0 ? exc_invalid_op+0x19/0x70 ? asm_exc_invalid_op+0x1b/0x20 ? vfio_pci_config_rw+0x395/0x430 [vfio_pci_core] ? vfio_pci_config_rw+0x244/0x430 [vfio_pci_core] vfio_pci_rw+0x101/0x1b0 [vfio_pci_core] vfio_pci_core_read+0x1d/0x30 [vfio_pci_core] vfio_device_fops_read+0x27/0x40 [vfio] vfs_read+0xbd/0x340 ? vfio_device_fops_unl_ioctl+0xbb/0x740 [vfio] ? __rseq_handle_notify_resume+0xa4/0x4b0 __x64_sys_pread64+0x96/0xc0 x64_sys_call+0x1c3d/0x20d0 do_syscall_64+0x4d/0x120 entry_SYSCALL_64_after_hwframe+0x76/0x7e

Affected

Product or packageVersionsReported by
Linux Linuxfrom 89e1f7d4c66d85f42c3d52ea3866eb10cadf6153 before 4464e5aa3aa4574063640f1082f7d7e323af8eb4, from 89e1f7d4c66d85f42c3d52ea3866eb10cadf6153 before 7d121f66b67921fb3b95e0ea9856bfba53733e91, from 89e1f7d4c66d85f42c3d52ea3866eb10cadf6153 before 0918f5643fc6c3f7801f4a22397d2cc09ba99207, from 89e1f7d4c66d85f42c3d52ea3866eb10cadf6153 before 9567bd34aa3b986736c290c5bcba47e0182ac47a, from 89e1f7d4c66d85f42c3d52ea3866eb10cadf6153 before 6c6502d944168cbd7e03a4a08ad6488f78d73485, from 89e1f7d4c66d85f42c3d52ea3866eb10cadf6153 before 06f2fcf49854ad05a09d09e0dbee6544fff04695, from 89e1f7d4c66d85f42c3d52ea3866eb10cadf6153 before 949bee8065a85a5c6607c624dc05b5bc17119699, from 89e1f7d4c66d85f42c3d52ea3866eb10cadf6153 before 1ef195178fb552478eb2587df4ad3be14ef76507 and 2 more
Not affected: before 3.6, from 4.19.325 up to 4.19.*, from 5.4.287 up to 5.4.*, from 5.10.231 up to 5.10.*, from 5.15.174 up to 5.15.*, from 6.1.120 up to 6.1.*
CVE List
linux linux_kernelfrom 3.6 before 4.19.325, from 4.20 before 5.4.287, from 5.5 before 5.10.231, from 5.11 before 5.15.174, from 5.16 before 6.1.120, from 6.2 before 6.6.64, from 6.7 before 6.11.11, from 6.12 before 6.12.2NVD

All scores

Linux7.8high CVSS:3.1CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
CISA-ADP7.8high CVSS:3.1CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
NVD7.8high CVSS:3.1CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Classification

CWE-129

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

What each source says

CVE List

In the Linux kernel, the following vulnerability has been resolved: vfio/pci: Properly hide first-in-list PCIe extended capability There are cases where a PCIe extended capability should be hidden from the user. For example, an unknown capability (i.e., capability with ID greater than PCI_EXT_CAP_ID_MAX) or a capability that is intentionally chosen to be hidden from the user. Hiding a capability is done by virtualizing and modifying the 'Next Capability Offset' field of the previous capability so it points to the capability after the one that should be hidden. The special case where the first capability in the list should be hidden is handled differently because there is no previous capability that can be modified. In this case, the capability ID and version are zeroed while leaving the next pointer intact. This hides the capability and leaves an anchor for the rest of the capability list. However, today, hiding the first capability in the list is not done properly if the capability is unknown, as struct vfio_pci_core_device->pci_config_map is set to the capability ID during initialization but the capability ID is not properly checked later when used in vfio_config_do_rw(). This leads to the following warning [1] and to an out-of-bounds access to ecap_perms array. Fix it by checking cap_id in vfio_config_do_rw(), and if it is greater than PCI_EXT_CAP_ID_MAX, use an alternative struct perm_bits for direct read only access instead of the ecap_perms array. Note that this is safe since the above is the only case where cap_id can exceed PCI_EXT_CAP_ID_MAX (except for the special capabilities, which are already checked before). [1] WARNING: CPU: 118 PID: 5329 at drivers/vfio/pci/vfio_pci_config.c:1900 vfio_pci_config_rw+0x395/0x430 [vfio_pci_core] CPU: 118 UID: 0 PID: 5329 Comm: simx-qemu-syste Not tainted 6.12.0+ #1 (snip) Call Trace: <TASK> ? show_regs+0x69/0x80 ? __warn+0x8d/0x140 ? vfio_pci_config_rw+0x395/0x430 [vfio_pci_core] ? report_bug+0x18f/0x1a0 ? handle_bug+0x63/0xa0 ? exc_invalid_op+0x19/0x70 ? asm_exc_invalid_op+0x1b/0x20 ? vfio_pci_config_rw+0x395/0x430 [vfio_pci_core] ? vfio_pci_config_rw+0x244/0x430 [vfio_pci_core] vfio_pci_rw+0x101/0x1b0 [vfio_pci_core] vfio_pci_core_read+0x1d/0x30 [vfio_pci_core] vfio_device_fops_read+0x27/0x40 [vfio] vfs_read+0xbd/0x340 ? vfio_device_fops_unl_ioctl+0xbb/0x740 [vfio] ? __rseq_handle_notify_resume+0xa4/0x4b0 __x64_sys_pread64+0x96/0xc0 x64_sys_call+0x1c3d/0x20d0 do_syscall_64+0x4d/0x120 entry_SYSCALL_64_after_hwframe+0x76/0x7e

NVD (es)

En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: vfio/pci: Ocultar correctamente la primera capacidad extendida PCIe de la lista Hay casos en los que una capacidad extendida PCIe debería estar oculta al usuario. Por ejemplo, una capacidad desconocida (es decir, una capacidad con un ID mayor que PCI_EXT_CAP_ID_MAX) o una capacidad que se elige intencionalmente para que esté oculta al usuario. Para ocultar una capacidad, se virtualiza y modifica el campo "Next Capability Offset" de la capacidad anterior para que apunte a la capacidad después de la que debería estar oculta. El caso especial en el que la primera capacidad de la lista debería estar oculta se gestiona de forma diferente porque no hay ninguna capacidad anterior que pueda modificarse. En este caso, el ID y la versión de la capacidad se ponen a cero mientras que el siguiente puntero queda intacto. Esto oculta la capacidad y deja un ancla para el resto de la lista de capacidades. Sin embargo, hoy en día, ocultar la primera capacidad en la lista no se hace correctamente si la capacidad es desconocida, ya que struct vfio_pci_core_device-&gt;pci_config_map se establece en el ID de capacidad durante la inicialización, pero el ID de capacidad no se verifica correctamente más tarde cuando se usa en vfio_config_do_rw(). Esto lleva a la siguiente advertencia [1] y a un acceso fuera de los límites a la matriz ecap_perms. Arréglelo verificando cap_id en vfio_config_do_rw(), y si es mayor que PCI_EXT_CAP_ID_MAX, use un struct perm_bits alternativo para acceso directo de solo lectura en lugar de la matriz ecap_perms. Tenga en cuenta que esto es seguro ya que el anterior es el único caso en el que cap_id puede superar a PCI_EXT_CAP_ID_MAX (excepto para las capacidades especiales, que ya se verificaron antes). [1] ADVERTENCIA: CPU: 118 PID: 5329 en drivers/vfio/pci/vfio_pci_config.c:1900 vfio_pci_config_rw+0x395/0x430 [vfio_pci_core] CPU: 118 UID: 0 PID: 5329 Comm: simx-qemu-syste No contaminado 6.12.0+ #1 (fragmento) Seguimiento de llamadas: ? show_regs+0x69/0x80 ? __warn+0x8d/0x140 ? vfio_pci_config_rw+0x395/0x430 [vfio_pci_core] ? report_bug+0x18f/0x1a0 ? handle_bug+0x63/0xa0 ? vfio_pci_config_rw+0x395/0x430 [núcleo vfio_pci] vfio_pci_rw+0x244/0x430 [núcleo vfio_pci] vfio_pci_rw+0x101/0x1b0 [núcleo vfio_pci] vfio_pci_core_read+0x1d/0x30 [núcleo vfio_pci] vfio_device_fops_read+0x27/0x40 [vfio] vfs_read+0xbd/0x340 ? vfio_device_fops_unl_ioctl+0xbb/0x740 [vfio] ? __rseq_handle_notify_resume+0xa4/0x4b0 __x64_sys_pread64+0x96/0xc0 x64_sys_call+0x1c3d/0x20d0 do_syscall_64+0x4d/0x120 entry_SYSCALL_64_after_hwframe+0x76/0x7e

References

https://git.kernel.org/stable/c/4464e5aa3aa4574063640f1082f7d7e323af8eb4patch
https://git.kernel.org/stable/c/7d121f66b67921fb3b95e0ea9856bfba53733e91patch
https://git.kernel.org/stable/c/0918f5643fc6c3f7801f4a22397d2cc09ba99207patch
https://git.kernel.org/stable/c/9567bd34aa3b986736c290c5bcba47e0182ac47apatch
https://git.kernel.org/stable/c/6c6502d944168cbd7e03a4a08ad6488f78d73485patch
https://git.kernel.org/stable/c/06f2fcf49854ad05a09d09e0dbee6544fff04695patch
https://git.kernel.org/stable/c/949bee8065a85a5c6607c624dc05b5bc17119699patch
https://git.kernel.org/stable/c/1ef195178fb552478eb2587df4ad3be14ef76507patch
https://git.kernel.org/stable/c/fe4bf8d0b6716a423b16495d55b35d3fe515905dpatch
https://lists.debian.org/debian-lts-announce/2025/03/msg00001.html
https://lists.debian.org/debian-lts-announce/2025/03/msg00002.html

Sources

SourceRecordLicence
CVE ListCVE-2024-53214 changed 2026-08-05CVE Terms of Use
NVDCVE-2024-53214 changed 2026-06-17Public domain