Skip to main content

Htslib CVE-2026-31965

| EUVDEUVD-2026-12934 MEDIUM
Out-of-bounds Read (CWE-125)
2026-03-18 GitHub_M
6.9
CVSS 4.0 · GitHub Advisory
View

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A06:2021 - Vulnerable and Outdated Components
ASVS 5.0
V15 - Secure Coding and Architecture Bounds checking, read limits
MITRE ATT&CK

1 technique across 1 tactic: Collection

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Impact

This vulnerability presents a moderate real-world risk with several mitigating and aggravating factors. The attack vector requires processing a maliciously crafted or corrupted CRAM file, which is typically an input validation scenario with low attack complexity. The availability of patched versions (1.23.1, 1.22.2, 1.21.1) and a confirmed fix commit (9cefb46453ad471e933b8212d4f45920524d3357) indicates active maintainer engagement, but CVSS scoring and EPSS data are unavailable, complicating automated risk quantification. CWE-125 out-of-bounds reads can lead to information disclosure (leaked heap/stack values) or denial of service (crashes), but not direct code execution. The dual nature of the impact—information leakage combined with potential crashes—and the fact that an error is reported after the reads suggest this is exploitable for information gathering but may not be weaponized for arbitrary code execution. The lack of public POC or KEV designation suggests this has not been actively exploited in the wild. Risk is elevated primarily for organizations processing untrusted CRAM files or running bioinformatics pipelines on user-supplied data.

Exploit ScenarioDerived

An attacker could craft a malicious CRAM file with an invalid reference ID field and provide it to a bioinformatics application using vulnerable HTSlib (e.g., via a genomics analysis pipeline, web service, or data repository). When the cram_decode_slice() function processes this file, it performs out-of-bounds reads before validating the reference ID, potentially leaking sensitive values from adjacent memory regions to the caller. While the function ultimately returns an error, the leaked information may be observable through error messages, return values, or side-channel timing. In less controlled scenarios, the out-of-bounds access could cause a segmentation fault, resulting in denial of service. No public POC is currently documented, but the vulnerability is sufficiently straightforward that a weaponized CRAM file could be generated by a moderately skilled attacker.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Mar 18, 2026

HTSlib contains an out-of-bounds read vulnerability in the cram_decode_slice() function that fails to validate the reference ID field early enough during CRAM file parsing, allowing two separate out-of-bounds reads before error detection. The vulnerability affects HTSlib versions prior to 1.23.1, 1.22.2, and 1.21.1, and can result in information disclosure through leaked memory values or application crashes when processing malicious or corrupted CRAM bioinformatics files. While the function reports an error after the reads occur, the window for exploitation exists and the practical impact depends on memory layout and application context.

RemediationAI

Upgrade HTSlib to version 1.23.1, 1.22.2, or 1.21.1 or later, depending on your currently deployed branch. The fix is confirmed in commit 9cefb46453ad471e933b8212d4f45920524d3357 available at https://github.com/samtools/htslib/commit/9cefb46453ad471e933b8212d4f45920524d3357. For applications and pipelines that depend on HTSlib (such as SAMtools), ensure all downstream tools are updated to versions that include the patched library. No functional workaround exists for this issue per the vendor statement, so patching is the only mitigation. Prioritize upgrading in environments that process CRAM files from untrusted sources or in multi-tenant bioinformatics platforms.

Affected VersionsENISA

htslib 1.22, < 1.22.2
htslib = 1.23
htslib < 1.21.1

Affected Packages

euvd htslib fix: 1.21.1, 1.22.2

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in euvd

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

HTSlib (samtools:htslib per CPE specification cpe:2.3:a:samtools:htslib) is a widely-used C library for parsing bioinformatics file formats including BAM, SAM, and CRAM. CRAM is a compressed columnar format designed for DNA sequence alignment data storage and transmission. The vulnerability resides in the cram_decode_slice() function, which processes individual slices within CRAM records. The root cause is classified under CWE-125 (Out-of-bounds Read), where the reference ID field validation occurs too late in the processing pipeline. This allows the code to perform two memory reads using an unvalidated reference ID value as an array index before the validation check occurs, creating a classic time-of-check-time-of-use (TOCTOU) style vulnerability in data format parsing.

Know when Htslib gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

GitHub Advisory PRIMARY 6.9 MEDIUM
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:L/SC:N/SI:N/SA:N
Red Hat 5.6 MEDIUM

Primary rating from GitHub Advisory.

CVSS VectorGitHub Advisory

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
None
Privileges Required
None
User Interaction
None
Vulnerable system: Confidentiality
Low
Vulnerable system: Integrity
None
Vulnerable system: Availability
Low
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

Lifecycle Timeline

2
Patch released
Mar 31, 2026 - 21:13 nvd
Patch available
CVE Published
Mar 18, 2026 - 18:50 nvd
MEDIUM 6.9

DescriptionGitHub Advisory

HTSlib is a library for reading and writing bioinformatics file formats. CRAM is a compressed format which stores DNA sequence alignment data. In the cram_decode_slice() function called while reading CRAM records, validation of the reference id field occurred too late, allowing two out of bounds reads to occur before the invalid data was detected. The bug does allow two values to be leaked to the caller, however as the function reports an error it may be difficult to exploit them. It is also possible that the program will crash due to trying 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.

Executive ViewAI

Why It Matters

Organizations using HTSlib should be aware of notable risk from CVE-2026-31965, a out-of-bounds read vulnerability rated CVSS 6.9. Exploitation could cause memory corruption or application crashes. Organizations should apply vendor updates when available and monitor for exploitation.

Business Impact: Moderate
Compensating Controls

Apply vendor patch. If patching is delayed: enable ASLR/DEP, apply network segmentation.

Threat Intelligence Overview

EPSS Score
0.0%
Top 87% exploitable
Data Quality
7 sources
Confidence: High

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
Yes

Priority Score

34
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +34
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

A buffer overflow occurs when a program writes more data to a memory buffer than it was allocated to hold, causing the excess data to spill into adjacent memory regions.

Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.

Denial of Service attacks render applications or systems unavailable by overwhelming resources or triggering failure conditions.

Related Vulnerabilities in HTSlib CRAM Decoder Buffer Underread

View all 3

More in Htslib

View all
CVE-2018-13843 HIGH POC
7.5 Jul 10

An issue has been found in HTSlib 1.8. Rated high severity (CVSS 7.5), this vulnerability is remotely exploitable, no au

CVE-2017-1000206 CRITICAL
9.8 Nov 17

samtools htslib library version 1.4.0 and earlier is vulnerable to buffer overflow in the CRAM rANS codec resulting in p

CVE-2018-13845 CRITICAL
9.8 Jul 10

An issue has been found in HTSlib 1.8. Rated critical severity (CVSS 9.8), this vulnerability is remotely exploitable, n

CVE-2026-31963 HIGH
8.8 Mar 18

HTSlib contains a heap buffer overflow vulnerability in its CRAM decoder caused by an out-by-one error when validating f

CVE-2026-31962 HIGH
8.8 Mar 18

HTSlib versions prior to 1.23.1, 1.22.2, and 1.21.1 contain a heap buffer overflow vulnerability in the cram_decode_seq(

CVE-2026-31968 HIGH
8.8 Mar 18

HTSlib contains a buffer overflow vulnerability in its CRAM format decoder affecting the VARINT and CONST encoding handl

CVE-2026-62258 HIGH
8.8 Nov 19

Stack-based buffer overflow in HTSlib's CRAM decoder affects all releases before 1.21.2, 1.22.3, 1.23.2, and 1.24: a cra

CVE-2026-62257 HIGH
8.8 Nov 19

Heap out-of-bounds read and write in HTSlib's experimental CRAM v4 XPACK and XRLE decoders allows a remote, unauthentica

CVE-2026-63390 HIGH
8.8 Nov 19

Heap buffer overflow in HTSlib's BCF reader allows an attacker-crafted BCF file to corrupt heap memory when opened by an

CVE-2018-14329 MEDIUM POC
4.7 Jul 17

In HTSlib 1.8, a race condition in cram/cram_io.c might allow local users to overwrite arbitrary files via a symlink att

CVE-2018-13844 HIGH
7.5 Jul 10

An issue has been found in HTSlib 1.8. Rated high severity (CVSS 7.5), this vulnerability is remotely exploitable, no au

CVE-2026-31971 HIGH
7.1 Mar 18

HTSlib, a widely-used bioinformatics library for reading and writing sequence alignment formats, contains a critical buf

Vendor StatusVendor

Debian

htslib
Release Status Fixed Version Urgency
bullseye vulnerable 1.11-4 -
bookworm vulnerable 1.16+ds-3 -
trixie vulnerable 1.21+ds-1 -
forky, sid vulnerable 1.22.1+ds2-1 -
(unstable) fixed (unfixed) -

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy