CVE-2026-31966: samtools htslib · Out-of-bounds Read
Affects samtools htslibSource CVE Database V5
Not known to be exploited · CVSS 6.9 Medium : upgrade to 1.22.2 or 1.21.1 when convenient.
Data as of 29 Oct 2026, 19:04 UTC
- EPSS
- 0.5% chance of exploitation in 30 days – higher than 45% of CVEsExploit Prediction Scoring System: the likelihood attackers will use this flaw soon.
- Patch
- Available – fixed in 1.22.2, 1.21.1
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:L/SC:N/SI:N/SA:NExploitation evidence
Disclosed: evidence found.
CVE published 18 Mar 2026
Detectable: no evidence on record.
No public nuclei template indexed
Weaponized: no evidence on record.
No public exploit code indexed in Metasploit or Exploit-DB
Exploited in the wildExploited: no evidence on record.
Not in CISA KEV and no source reports exploitation
Observed by OffSeq MirageSeen by Mirage: no evidence on record.
No attack traffic recorded by OffSeq Mirage sensors
A missing step is not evidence of safety. Sources: cve.org (opens in a new tab), the Metasploit, Exploit-DB and nuclei-templates index as of 29 Oct 2026.
What to do
Upgrade htslib to 1.22.2 or 1.21.1; samtools/htslib to 1.21.1.
Affected software
| Product | Affected | Fixed in |
|---|---|---|
| samtoolshtslib | Affected
| Fixed in
|
GitHubsamtools/htslibpkg:github/samtools/htslibOther threats | Affected
| Fixed in
|
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
AI-suggested
The only effective mitigation is to upgrade htslib to a fixed version: 1.21.1, 1.22.2, or 1.23.1 or later. Organizations should audit their bioinformatics pipelines and tools to identify usage of vulnerable htslib versions and update accordingly. Additionally, implement strict input validation and filtering to ensure only trusted CRAM files are processed, reducing exposure to crafted malicious files. Employ sandboxing or containerization for bioinformatics tools to limit the impact of potential crashes or memory leaks. Monitor logs and application behavior for crashes or anomalies that could indicate exploitation attempts. Since no workaround exists, patch management and supply chain verification are critical. Finally, maintain awareness of updates from samtools and related projects for any further advisories.
Description
HTSlib is a library for reading and writing bioinformatics file formats. CRAM is a compressed format which stores DNA sequence alignment data. As one method of removing redundant data, CRAM uses reference-based compression so that instead of storing the full sequence for each alignment record it stores a location in an external reference sequence along with a list of differences to the reference at that location as a sequence of "features". When decoding CRAM records, the reference data is stored in a char array, and parts matching the alignment record sequence are copied over as necessary. Due to insufficient validation of the feature data series, it was possible to make the `cram_decode_seq()` function copy data from either before the start, or after the end of the stored reference either into the buffer used to store the output sequence for the cram record, or into the buffer used to build the SAM `MD` tag. This allowed arbitrary data to be leaked to the calling function. 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. Versions 1.23.1, 1.22.2 and 1.21.1 include fixes for this issue. There is no workaround for this issue.
References
- github.com/samtools/htslib/security/advisories/GHSA-5cj8-mj52-8vp3 (opens in a new tab)
- github.com/samtools/htslib/commit/22ec5230ef95769ab009420da69568c7e530af28 (opens in a new tab)
- github.com/samtools/htslib/commit/2a45eb129d703ad27f9fabc8169f0e94d3c69fa3 (opens in a new tab)
- github.com/samtools/htslib/commit/4a5ef25eb1fb3d64438103316fffe423b2c3f5f4 (opens in a new tab)