CVE-2026-31972 samtools mpileup has use-after-free leading to an invalid read

Medium 6.9 Published Updated

An attacker can trigger a use-after-free in samtools mpileup, potentially leaking program state or causing a crash.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
None listed

What is CVE-2026-31972?

CVE-2026-31972 is a medium-severity use after free vulnerability in samtools, published on 18 Mar 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

SAMtools is a program for reading, manipulating and writing bioinformatics file formats. The `mpileup` command outputs DNA sequences that have been aligned against a known reference. On each output line it writes the reference position, optionally the reference DNA base at that position (obtained from a separate file) and all of the DNA bases that aligned to that position. As the output is ordered by position, reference data that is no longer needed is discarded once it has been printed out. Under certain conditions the data could be discarded too early, leading to an attempt to read from a pointer to freed memory. This bug may allow information about program state to be leaked. It may also cause a program crash through an attempt to access invalid memory. This bug is fixed in versions 1.21.1 and 1.22. There is no workaround for this issue.

Weakness: CWE-416

Which versions are affected by CVE-2026-31972?

It affects 1 product.

Products include Samtools Samtools.

How do I fix CVE-2026-31972?

No fix has been published for CVE-2026-31972 yet. Limit exposure of the affected software until one is available.

Upgrade to the fixed version. These bugs are found with fuzzing and sanitisers and avoided by memory-safe languages. More about Use after free.

Is CVE-2026-31972 being exploited?

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

Sources

Also known as DEBIAN-CVE-2026-31972, GHSA-72c8-4jf3-f27p, UBUNTU-CVE-2026-31972.

Is CVE-2026-31972 in your software?

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

Check your SBOMs for free