Skip to main content

Htslib CVE-2026-31970

| EUVDEUVD-2026-12946 HIGH
Heap-based Buffer Overflow (CWE-122)
2026-03-18 GitHub_M
7.1
CVSS 4.0 · GitHub Advisory
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Craft malicious GZI index file
  2. Delivery
    Submit to bgzf_index_load_hfile() function
  3. Exploit
    Trigger integer overflow in buffer allocation
  4. Execution
    Write zeros past buffer bounds
  5. Impact
    Corrupt process memory

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A06:2021 - Vulnerable and Outdated Components
ASVS 5.0
V15 - Secure Coding and Architecture Heap buffer bounds checking
MITRE ATT&CK

1 technique across 1 tactic: Execution

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

Exploitation Conditions

Victim must open a crafted GZI file (BGZF index file) in an application using HTSlib library. Remote unauthenticated attacker sends malicious .gzi file; victim interaction required to load it into HTSlib-dependent bioinformatics software.

Impact

While CVSS and EPSS scores are not available in the provided intelligence, the risk profile is objectively high based on multiple signals: the vulnerability permits remote code execution (tagged as RCE), requires only user interaction (opening a file) with no elevated privileges, affects a foundational bioinformatics library used across research institutions and clinical laboratories, and impacts a chain of dependent tools that rely on HTSlib. The attack complexity is low—an attacker merely needs to craft a malicious .gzi file and socially engineer its opening. The technical impact is severe (code execution potential), and the automatable nature of exploit delivery via email or file-sharing systems elevates practical risk. However, the requirement for user interaction and the availability of a documented workaround (discarding untrusted .gzi files) slightly mitigate urgency compared to network-exploitable RCE vulnerabilities.

Exploit ScenarioDerived

An attacker crafts a malicious .gzi index file with a crafted header that triggers integer overflow in the buffer allocation calculation, resulting in a zero or undersized heap buffer. The attacker distributes this file alongside a legitimate-looking BAM or BGZF file through a research data repository, collaboration platform, or email. When a researcher or automated pipeline opens the files in an application linked to vulnerable HTSlib (e.g., SAMtools for variant calling), the library loads the malicious .gzi file, triggering the heap overflow and corrupting adjacent heap structures or achieving code execution in the context of the calling process. While no public proof-of-concept has been documented, the straightforward nature of the integer overflow and low attack complexity make exploitation feasible.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.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 versions prior to 1.23.1, 1.22.2, and 1.21.1 contain a heap buffer overflow vulnerability in the GZI index loading function bgzf_index_load_hfile(). An integer overflow during buffer allocation allows attackers to craft malicious .gzi files that trigger heap memory corruption, potentially leading to denial of service, data corruption, or remote code execution when a user opens the compromised file. No evidence of active exploitation in the wild has been reported, but the vulnerability is demonstrable and patch availability is confirmed.

RemediationAI

Upgrade HTSlib to version 1.23.1, 1.22.2, or 1.21.1 or later depending on the release branch in use (https://github.com/samtools/htslib/commit/6dd0d7d0e9e7e2e173a28969e624db8bc8bb5828 contains the fix). For immediate mitigation without patching, discard any .gzi index files from untrusted sources and regenerate them locally using bgzip -r on trusted BAM or BGZF files; this prevents loading of malicious index files. Organizations should prioritize patching given the RCE potential, and conduct inventory of dependent tools (SAMtools, BCFtools, etc.) to ensure consistent version updates across the HTSlib ecosystem.

Affected VersionsENISA

htslib = 1.23
htslib 1.22, < 1.22.2
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 is a widely-used C library for reading and writing bioinformatics file formats including SAM, BAM, CRAM, VCF, and BCF files. GZI files are companion index files for BGZF (block-compressed GZIP) compressed data, enabling efficient random access without decompressing entire files. The vulnerability exists in the GZI loading mechanism where an integer overflow in buffer size calculation (CWE-122: Heap-based Buffer Overflow) causes undersized or zero-length heap buffers to be allocated. The code then attempts to write 16 zero bytes followed by index records into this inadequately sized buffer, causing heap memory corruption. The affected CPE is cpe:2.3:a:samtools:htslib:*:*:*:*:*:*:*:* for versions below the patched releases.

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 7.1 HIGH
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:H/VA:L/SC:N/SI:N/SA:N

Primary rating from GitHub Advisory · only source for this CVE.

CVSS VectorGitHub Advisory

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
None
Privileges Required
None
User Interaction
Passive
Vulnerable system: Confidentiality
None
Vulnerable system: Integrity
High
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 - 19:53 nvd
HIGH 7.1

DescriptionGitHub Advisory

HTSlib is a library for reading and writing bioinformatics file formats. GZI files are used to index block-compressed GZIP [BGZF] files. In the GZI loading function, bgzf_index_load_hfile(), it was possible to trigger an integer overflow, leading to an under- or zero-sized buffer being allocated to store the index. Sixteen zero bytes would then be written to this buffer, and, depending on the result of the overflow the rest of the file may also be loaded into the buffer as well. If the function did attempt to load the data, it would eventually fail due to not reading the expected number of records, and then try to free the overflowed heap buffer. 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. The easiest work-around is to discard any .gzi index files from untrusted sources, and use the bgzip -r option to recreate them.

Executive ViewAI

Why It Matters

Organizations using HTSlib face moderate risk from CVE-2026-31970, a heap-based buffer overflow vulnerability rated CVSS 7.1. Exploitation could allow attackers to corrupt memory, crash the application, or potentially execute arbitrary code. Organizations should apply vendor updates when available and consider compensating controls in the interim.

Business Impact: Moderate
Compensating Controls

Apply vendor patch. If immediate patching is not feasible: (1) Enable ASLR and DEP where available; (2) Implement network segmentation; (3) Monitor for exploitation indicators.

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 HIGH
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.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
No

Priority Score

36
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +36
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.

A heap overflow occurs when a program writes data beyond the bounds of a buffer allocated in the heap memory region.

Integer overflow occurs when an arithmetic operation produces a result that exceeds the maximum value a given integer type can store.

Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.

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

Related Vulnerabilities in HTSlib Memory Corruption Vulnerabilities

View all 4

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-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

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