Join the Cyber Forum: Threat Intel on May 12, 2026 to learn how AI is reshaping threat defense.Join the Virtual Cyber Forum: Threat IntelRegister Now
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2026-31970

CVE-2026-31970: Htslib Buffer Overflow Vulnerability

CVE-2026-31970 is a buffer overflow vulnerability in Htslib affecting GZI file loading that can lead to heap corruption and potential code execution. This article covers the technical details, affected versions, and mitigation.

Published: March 20, 2026

CVE-2026-31970 Overview

CVE-2026-31970 is a heap buffer overflow vulnerability in HTSlib, a widely-used library for reading and writing bioinformatics file formats. The vulnerability exists in the GZI (GZIP index) file loading function bgzf_index_load_hfile(), where an integer overflow can be triggered during index processing. This flaw allows attackers to cause an under-sized or zero-sized buffer allocation, followed by out-of-bounds memory writes that corrupt heap structures.

GZI files are used to index block-compressed GZIP (BGZF) files in bioinformatics workflows. When processing a maliciously crafted .gzi file, the vulnerable function writes sixteen zero bytes to the incorrectly-sized buffer, and depending on the overflow result, may attempt to load additional file data into the buffer as well. While the function eventually fails due to record count mismatches, the heap corruption has already occurred by this point.

Critical Impact

Successful exploitation of this vulnerability can lead to program crashes, data corruption, and potentially arbitrary code execution through heap manipulation when processing malicious GZI index files.

Affected Products

  • HTSlib versions prior to 1.21.1
  • HTSlib versions 1.22.x prior to 1.22.2
  • HTSlib version 1.23 (prior to 1.23.1)

Discovery Timeline

  • 2026-03-18 - CVE-2026-31970 published to NVD
  • 2026-03-19 - Last updated in NVD database

Technical Details for CVE-2026-31970

Vulnerability Analysis

The vulnerability is classified as CWE-122 (Heap-based Buffer Overflow) and resides in the bgzf_index_load_hfile() function within HTSlib's BGZF handling code. When loading a GZI index file, the function reads a 64-bit unsigned integer (uint64_t) value that specifies the number of index entries. This value is then used to calculate the buffer size needed for storing index structures.

The root issue is that the multiplication of the entry count by sizeof(bgzidx1_t) can overflow, resulting in a much smaller buffer being allocated than required. The function then proceeds to write data to this undersized buffer, causing heap memory corruption. While the operation eventually fails when the expected record count doesn't match, the damage to heap structures has already been done.

The network attack vector requires user interaction—specifically, a user must open or process a maliciously crafted GZI file. This is particularly concerning in bioinformatics environments where researchers may process data from various external sources, including public genomic databases.

Root Cause

The root cause is the lack of integer overflow validation when calculating buffer sizes in bgzf_index_load_hfile(). The function reads an untrusted 64-bit value from the file and uses it directly in size calculations without verifying that the resulting allocation size doesn't wrap around due to integer overflow. When x is a sufficiently large value, the expression (x + 1) * sizeof(bgzidx1_t) overflows, producing a small or zero value that leads to an inadequate memory allocation.

Attack Vector

An attacker can exploit this vulnerability by crafting a malicious .gzi index file containing a specially chosen 64-bit value designed to trigger the integer overflow. The attack requires user interaction—the victim must process the malicious file using a vulnerable version of HTSlib or an application that depends on it (such as samtools, bcftools, or other bioinformatics tools).

The attack flow is:

  1. Attacker creates a malicious GZI file with an oversized entry count value
  2. Victim attempts to load the GZI file using a vulnerable HTSlib version
  3. Integer overflow occurs during buffer size calculation
  4. Undersized heap buffer is allocated
  5. Data is written beyond buffer boundaries, corrupting heap structures
  6. Potential for arbitrary code execution through heap exploitation techniques
c
     if (fp->idx == NULL) goto fail;
     uint64_t x;
     if (hread_uint64(&x, idx) < 0) goto fail;
+    if (x >= ((SIZE_MAX < UINT64_MAX ? SIZE_MAX : UINT64_MAX)
+              / sizeof(bgzidx1_t) / 2))
+        goto fail;
 
     fp->idx->noffs = fp->idx->moffs = x + 1;
     fp->idx->offs  = (bgzidx1_t*) malloc(fp->idx->moffs*sizeof(bgzidx1_t));

Source: GitHub Commit Details

The patch adds an overflow check that validates the value of x before using it in size calculations. It ensures that the subsequent multiplication cannot overflow by comparing x against a computed maximum safe value based on SIZE_MAX and the structure size.

Detection Methods for CVE-2026-31970

Indicators of Compromise

  • Unexpected crashes in applications using HTSlib when processing GZI files
  • Segmentation faults or memory access violations in bgzf_index_load_hfile() function
  • Core dumps showing heap corruption patterns in processes using samtools, bcftools, or other HTSlib-dependent applications
  • Anomalously large values in GZI file headers when inspecting file contents

Detection Strategies

  • Monitor for process crashes in bioinformatics applications with heap corruption signatures
  • Implement file integrity checks on GZI files from external sources before processing
  • Deploy memory safety tools (AddressSanitizer, Valgrind) in development/testing environments to detect heap overflows
  • Use static analysis tools to identify HTSlib version dependencies in your software stack

Monitoring Recommendations

  • Audit systems for installed HTSlib versions using package managers (dpkg -l, rpm -qa, or similar)
  • Monitor bioinformatics pipelines for unexpected failures when processing indexed BGZF files
  • Implement logging for GZI file processing operations to identify suspicious activity
  • Track HTSlib library usage across containers and virtual environments in research infrastructure

How to Mitigate CVE-2026-31970

Immediate Actions Required

  • Update HTSlib to version 1.23.1, 1.22.2, or 1.21.1 (depending on your version branch)
  • Rebuild any statically-linked applications that include HTSlib
  • Audit and remove untrusted .gzi index files from systems processing bioinformatics data
  • Restrict processing of GZI files to those from trusted, verified sources only

Patch Information

HTSlib maintainers have released patched versions addressing this vulnerability. The fix adds an overflow check in bgzf_index_load_hfile() that validates the index entry count before performing size calculations. The security patch is available in the GitHub commit with commit hash 6dd0d7d0e9e7e2e173a28969e624db8bc8bb5828. Organizations should upgrade to HTSlib 1.23.1, 1.22.2, or 1.21.1 as appropriate for their environment.

For additional details, refer to the GitHub Security Advisory.

Workarounds

  • Discard any .gzi index files from untrusted sources before processing
  • Recreate GZI index files locally using the bgzip -r option on trusted BGZF files
  • Implement input validation to check GZI file header values before passing to HTSlib functions
  • Isolate bioinformatics processing in sandboxed environments to limit exploitation impact
bash
# Regenerate GZI index files from trusted sources
# Remove untrusted .gzi files and recreate them locally
rm untrusted_file.gz.gzi
bgzip -r trusted_file.gz

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeBuffer Overflow

  • Vendor/TechHtslib

  • SeverityHIGH

  • CVSS Score7.1

  • EPSS Probability0.04%

  • Known ExploitedNo
  • CVSS Vector
  • 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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityHigh
  • AvailabilityLow
  • CWE References
  • CWE-122
  • Technical References
  • Openwall OSS Security Post
  • Vendor Resources
  • GitHub Commit Details

  • GitHub Security Advisory
  • Related CVEs
  • CVE-2026-31968: Htslib Buffer Overflow Vulnerability

  • CVE-2026-31962: Htslib CRAM Buffer Overflow Vulnerability

  • CVE-2026-31963: Htslib CRAM Buffer Overflow Vulnerability

  • CVE-2026-31969: HTSlib Buffer Overflow Vulnerability
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English