Skip to main content
VulnerabilityPublished

CVE-2026-31968: samtools htslib · Stack-based Buffer Overflow

Affects samtools htslibSource CVE Database V5

0
Compare

Not known to be exploited · CVSS 8.8 High : upgrade to 1.22.2 or 1.21.1 soon.

Data as of 29 Oct 2026, 19:04 UTC

CVSS 4.0 base score
8.8High
How severe the flaw is on the 0–10 CVSS scale.
EPSS
0.4% chance of exploitation in 30 days – higher than 36% 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:N/VI:H/VA:L/SC:N/SI:N/SA:N

Exploitation evidence

  1. Disclosed: evidence found.

    CVE published 18 Mar 2026

  2. Detectable: no evidence on record.

    No public nuclei template indexed

  3. Weaponized: no evidence on record.

    No public exploit code indexed in Metasploit or Exploit-DB

  4. Exploited in the wild: no evidence on record.

    Not in CISA KEV and no source reports exploitation

  5. Observed by OffSeq 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

ProductAffectedFixed in
samtoolshtslibAffected
  • <1.21.1
  • >=1.22 <1.22.2
  • =1.23
Fixed in
  • 1.22.2
  • 1.21.1
GitHubsamtools/htslibpkg:github/samtools/htslibOther threatsAffected
  • <1.21.1
  • =1.23
Fixed in
  • 1.21.1

Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.

AI-suggested

Organizations should immediately upgrade HTSlib to versions 1.21.1, 1.22.2, 1.23.1, or later, where the vulnerability is patched. Since no workaround exists, patching is the only effective mitigation. Additionally, implement strict input validation and sandboxing for applications processing CRAM files to limit the impact of malformed inputs. Employ runtime protections such as stack canaries, address space layout randomization (ASLR), and control flow integrity (CFI) to reduce exploitation likelihood. Monitor bioinformatics pipelines for abnormal crashes or behavior that may indicate exploitation attempts. Restrict network exposure of services that process untrusted genomic data files and enforce strict access controls. Maintain up-to-date threat intelligence feeds to detect emerging exploits targeting this vulnerability. Finally, conduct security audits and fuzz testing on bioinformatics software to proactively identify similar memory corruption issues.

Description

HTSlib is a library for reading and writing bioinformatics file formats. CRAM is a compressed format which stores DNA sequence alignment data using a variety of encodings and compression methods. For the `VARINT` and `CONST` encodings, incomplete validation of the context in which the encodings were used could result in up to eight bytes being written beyond the end of a heap allocation, or up to eight bytes being written to the location of a one byte variable on the stack, possibly causing the values to adjacent variables to change unexpectedly. Depending on the data stream this could result either in a heap buffer overflow or a stack overflow. If a user opens a file crafted to exploit this issue it could lead to the program crashing, overwriting of data structures on the heap or stack in ways not expected by the program, or changing the control flow of 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.

References

Community reviews

Loading reviews…