CVE-2025-21738
JSON

7.8high

ata: libata-sff: Ensure that we cannot write outside the allocated buffer

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

Description

In the Linux kernel, the following vulnerability has been resolved: ata: libata-sff: Ensure that we cannot write outside the allocated buffer reveliofuzzing reported that a SCSI_IOCTL_SEND_COMMAND ioctl with out_len set to 0xd42, SCSI command set to ATA_16 PASS-THROUGH, ATA command set to ATA_NOP, and protocol set to ATA_PROT_PIO, can cause ata_pio_sector() to write outside the allocated buffer, overwriting random memory. While a ATA device is supposed to abort a ATA_NOP command, there does seem to be a bug either in libata-sff or QEMU, where either this status is not set, or the status is cleared before read by ata_sff_hsm_move(). Anyway, that is most likely a separate bug. Looking at __atapi_pio_bytes(), it already has a safety check to ensure that __atapi_pio_bytes() cannot write outside the allocated buffer. Add a similar check to ata_pio_sector(), such that also ata_pio_sector() cannot write outside the allocated buffer.

Affected

Product or packageVersionsReported by
Linux Linuxfrom 5a5dbd18a7496ed403f6f54bb20c955c65482fa5 before a8f8cf87059ed1905c2a5c72f8b39a4f57b11b4c, from 5a5dbd18a7496ed403f6f54bb20c955c65482fa5 before d5e6e3000309359eae2a17117aa6e3c44897bf6c, from 5a5dbd18a7496ed403f6f54bb20c955c65482fa5 before 0dd5aade301a10f4b329fa7454fdcc2518741902, from 5a5dbd18a7496ed403f6f54bb20c955c65482fa5 before 0a17a9944b8d89ef03946121241870ac53ddaf45, from 5a5dbd18a7496ed403f6f54bb20c955c65482fa5 before 6e74e53b34b6dec5a50e1404e2680852ec6768d2, 2.6.22
Not affected: before 2.6.22, from 6.1.129 up to 6.1.*, from 6.6.78 up to 6.6.*, from 6.12.14 up to 6.12.*, from 6.13.3 up to 6.13.*, from 6.14 up to *
CVE List
linux linux_kernelbefore 6.1.129, from 6.2 before 6.6.78, from 6.7 before 6.12.14, from 6.13 before 6.13.3NVD

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
NVD5.5medium CVSS:3.1CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H

What each source says

CVE List

In the Linux kernel, the following vulnerability has been resolved: ata: libata-sff: Ensure that we cannot write outside the allocated buffer reveliofuzzing reported that a SCSI_IOCTL_SEND_COMMAND ioctl with out_len set to 0xd42, SCSI command set to ATA_16 PASS-THROUGH, ATA command set to ATA_NOP, and protocol set to ATA_PROT_PIO, can cause ata_pio_sector() to write outside the allocated buffer, overwriting random memory. While a ATA device is supposed to abort a ATA_NOP command, there does seem to be a bug either in libata-sff or QEMU, where either this status is not set, or the status is cleared before read by ata_sff_hsm_move(). Anyway, that is most likely a separate bug. Looking at __atapi_pio_bytes(), it already has a safety check to ensure that __atapi_pio_bytes() cannot write outside the allocated buffer. Add a similar check to ata_pio_sector(), such that also ata_pio_sector() cannot write outside the allocated buffer.

NVD (es)

En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: ata: libata-sff: Asegúrese de que no podamos escribir fuera del búfer asignado reveliofuzzing informó que un ioctl SCSI_IOCTL_SEND_COMMAND con out_len establecido en 0xd42, comando SCSI establecido en ATA_16 PASS-THROUGH, comando ATA establecido en ATA_NOP y protocolo establecido en ATA_PROT_PIO, puede hacer que ata_pio_sector() escriba fuera del búfer asignado, sobrescribiendo memoria aleatoria. Si bien se supone que un dispositivo ATA debe abortar un comando ATA_NOP, parece haber un error en libata-sff o QEMU, donde este estado no está establecido o el estado se borra antes de la lectura por ata_sff_hsm_move(). De todos modos, es muy probable que se trate de un error separado. Si analizamos __atapi_pio_bytes(), veremos que ya tiene una comprobación de seguridad para garantizar que __atapi_pio_bytes() no pueda escribir fuera del búfer asignado. Agreguemos una comprobación similar a ata_pio_sector(), de modo que ata_pio_sector() tampoco pueda escribir fuera del búfer asignado.

References

Sources

SourceRecordLicence
CVE ListCVE-2025-21738 changed 2026-10-15CVE Terms of Use
NVDCVE-2025-21738 changed 2026-10-15Public domain