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

High 7.8 Published Updated

A missing bounds check in the Linux kernel's libata-sff driver allows out-of-bounds writes, potentially leading to memory corruption and privilege escalation.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Local or same network only
Victim action needed
Not needed
Fix
Available

What is CVE-2025-21738?

CVE-2025-21738 is a high-severity memory corruption vulnerability in Linux kernel, published on 27 Feb 2025. It can only be exploited from the same machine or local network, with no action from the victim.

Official 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.

Which versions are affected by CVE-2025-21738?

It affects 1 product.

Linux distribution packages (1)
kernel-livepatch-SLE15-SP5_Update_35 SUSE:Linux Enterprise Live Patching 15 SP5All versions2-150500.2.1

Products include Linux kernel.

How do I fix CVE-2025-21738?

Apply the vendor's patch.

Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.

Is CVE-2025-21738 being exploited?

There is no known exploitation of CVE-2025-21738 in the wild and no public exploit code.

All Linux kernel vulnerabilities

Sources

Also known as AZL-68973, BELL-CVE-2025-21738, DEBIAN-CVE-2025-21738, GHSA-f4r5-w3wm-c5g6, ROOT-OS-DEBIAN-11-CVE-2025-21738, ROOT-OS-UBUNTU-2204-CVE-2025-21738 and 3 more.

Is CVE-2025-21738 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free