CVE-2026-31962 HTSlib CRAM reader has heap buffer overflow due to improper validation of input

High 8.8 Published Updated

A heap buffer overflow in HTSlib's CRAM reader allows attackers to execute arbitrary code or crash the application by providing a maliciously crafted file.

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

What is CVE-2026-31962?

CVE-2026-31962 is a high-severity memory corruption vulnerability in samtools htslib, published on 18 Mar 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

HTSlib is a library for reading and writing bioinformatics file formats. CRAM is a compressed format which stores DNA sequence alignment data. While most alignment records store DNA sequence and quality values, the format also allows them to omit this data in certain cases to save space. Due to some quirks of the CRAM format, it is necessary to handle these records carefully as they will actually store data that needs to be consumed and then discarded. Unfortunately the `cram_decode_seq()` did not handle this correctly in some cases. Where this happened it could result in reading a single byte from beyond the end of a heap allocation, followed by writing a single attacker-controlled byte to the same location. Exploiting this bug causes a heap buffer overflow. If a user opens a file crafted to exploit this issue, it could lead to the program crashing, or overwriting of data and heap structures in ways not expected by the program. It may be possible to use this to obtain arbitrary code execution. Versions 1.23.1, 1.22.2 and 1.21.1 include fixes for this issue. There is no workaround for this issue.

Weakness: CWE-787, CWE-129, CWE-125, CWE-122

Which versions are affected by CVE-2026-31962?

It affects 1 product.

Products include Htslib Htslib.

How do I fix CVE-2026-31962?

Upgrade to a fixed version.

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

Is CVE-2026-31962 being exploited?

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

Sources

Also known as DEBIAN-CVE-2026-31962, GHSA-xxmp-v7h3-gpwp, OESA-2026-2547, OESA-2026-2757, OESA-2026-3491, UBUNTU-CVE-2026-31962.

Is CVE-2026-31962 in your software?

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

Check your SBOMs for free