Vulnerability · Published Mar 18, 2026 · Assigned by GitHub_M

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

High 8.8

In plain English

A high-severity heap buffer overflow in htslib from samtools. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.4% (higher than 33% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 4.0)8.8High
Exploit odds (30 days)0.4%top 67.5% of all CVEs
Exploited in the wildNo reportsCISA SSVC: none
Attack toolingNoneno public tooling known

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.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
Debian:12htslibno fix listedDEBIAN-CVE-2026-31962
Debian:13htslibno fix listedDEBIAN-CVE-2026-31962
Debian:14htslib1.24-2DEBIAN-CVE-2026-31962
Ubuntu:22.04:LTShtslibno fix listedUBUNTU-CVE-2026-31962
Ubuntu:24.04:LTShtslibno fix listedUBUNTU-CVE-2026-31962
Ubuntu:25.10htslibno fix listedUBUNTU-CVE-2026-31962
Ubuntu:26.04:LTShtslibno fix listedUBUNTU-CVE-2026-31962
Ubuntu:26.10htslibno fix listedUBUNTU-CVE-2026-31962

Affected products (as reported)

VendorProductVersions
samtools htslib < 1.21.1>= 1.22, < 1.22.2= 1.23

Weakness: CWE-122, CWE-125, CWE-129, CWE-787 · Vector: CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:H/VA:L/SC:N/SI:N/SA:N

References