The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
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
    • 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-31968

CVE-2026-31968: Htslib Buffer Overflow Vulnerability

CVE-2026-31968 is a buffer overflow flaw in Htslib that affects CRAM file processing, allowing heap or stack corruption and potential code execution. This article covers technical details, affected versions, and patches.

Published: March 20, 2026

CVE-2026-31968 Overview

CVE-2026-31968 is a high-severity buffer overflow vulnerability in HTSlib, a widely-used C library for reading and writing high-throughput sequencing data formats in bioinformatics applications. The vulnerability exists in the CRAM file format parser, specifically in the handling of VARINT and CONST encodings. Due to incomplete validation of the context in which these encodings are used, attackers can trigger memory corruption that could lead to arbitrary code execution.

Critical Impact

A maliciously crafted CRAM file can cause heap or stack buffer overflows, potentially enabling arbitrary code execution when processed by applications using vulnerable HTSlib versions.

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 CVE-2026-31968 published to NVD
  • 2026-03-19 - Last updated in NVD database

Technical Details for CVE-2026-31968

Vulnerability Analysis

The vulnerability resides in the CRAM codec implementation within cram/cram_codecs.c. CRAM is a compressed format designed for storing DNA sequence alignment data, utilizing various encodings and compression methods for efficiency. The VARINT_UNSIGNED and VARINT_SIGNED codecs failed to properly validate the option parameter that determines which decode function should be used.

In the vulnerable code path, the codec selection logic used a simple ternary operator that only checked for E_INT, defaulting to long-type decoders for any other value. This lack of strict validation meant that unexpected option values could result in incorrect decoder assignment, leading to mismatched data type handling. When processing malformed input, up to eight bytes could be written beyond the end of a heap allocation, or eight bytes could be written to a one-byte stack variable location, corrupting adjacent memory.

Root Cause

The root cause is insufficient input validation in the codec initialization logic. The original implementation assumed only valid option values (E_INT or E_LONG variants) would be passed to the varint codec setup functions. Without explicit validation, unexpected option values would still be processed, potentially pairing incompatible decode functions with data buffers of incorrect sizes. This represents CWE-121 (Stack-based Buffer Overflow) where the overflow condition stems from improper bounds checking during codec configuration.

Attack Vector

The attack vector is network-based, requiring no privileges or user interaction beyond opening a malicious file. An attacker crafts a specially formed CRAM file containing malformed codec option values within the compression header. When a victim application using HTSlib opens this file, the parser processes the malformed encoding specification, triggering the buffer overflow condition.

The exploitation path involves:

  1. Creating a CRAM file with manipulated codec option fields in the compression block
  2. Distributing the malicious file (via email, shared storage, or research data repositories)
  3. Victim application processes the file using a vulnerable HTSlib version
  4. Memory corruption occurs during codec initialization
  5. Depending on heap/stack layout, attacker gains control flow manipulation or crashes the application
c
// Security patch in cram/cram_codecs.c - Improve option checking for varint and const codecs
    // does not change.
    switch(codec) {
    case E_VARINT_UNSIGNED:
-        c->decode = (option == E_INT)
-            ? cram_varint_decode_int
-            : cram_varint_decode_long;
+        if (option == E_INT || option == E_SINT)
+            c->decode = cram_varint_decode_int;
+        else if (option == E_LONG || option == E_SLONG)
+            c->decode = cram_varint_decode_long;
+        else
+            goto malformed;
        break;
    case E_VARINT_SIGNED:
-        c->decode = (option == E_INT)
-            ? cram_varint_decode_sint
-            : cram_varint_decode_slong;
+        if (option == E_INT || option == E_SINT)
+            c->decode = cram_varint_decode_sint;
+        else if (option == E_LONG || option == E_SLONG)
+            c->decode = cram_varint_decode_slong;
+        else
+            goto malformed;
        break;
    default:
-        return NULL;
+        goto malformed;
    }

    c->free   = cram_varint_decode_free;

Source: GitHub Commit Changes

Detection Methods for CVE-2026-31968

Indicators of Compromise

  • Unexpected crashes in bioinformatics applications processing CRAM files with stack traces pointing to cram_codecs.c or varint decode functions
  • Anomalous CRAM files with unusual or invalid codec option values in compression headers
  • Memory corruption indicators such as heap canary violations or stack smashing detected errors
  • Application core dumps indicating buffer overflows during file parsing operations

Detection Strategies

  • Deploy file integrity monitoring on CRAM file storage locations to identify potentially malicious file modifications
  • Implement runtime memory protection tools (AddressSanitizer, Valgrind) in development and testing environments to catch overflow conditions
  • Monitor application logs for segmentation faults or memory access violations during CRAM file processing
  • Use static analysis tools to identify HTSlib version dependencies across your software inventory

Monitoring Recommendations

  • Enable enhanced logging for bioinformatics pipeline applications to capture file processing failures
  • Configure endpoint detection to alert on application crashes associated with HTSlib-dependent processes
  • Implement network monitoring for CRAM file transfers from untrusted sources
  • Set up vulnerability scanning to track HTSlib versions deployed across research infrastructure

How to Mitigate CVE-2026-31968

Immediate Actions Required

  • Upgrade HTSlib to patched versions: 1.23.1, 1.22.2, or 1.21.1 immediately
  • Audit systems to identify all applications and pipelines using HTSlib
  • Restrict processing of CRAM files from untrusted sources until patching is complete
  • Rebuild dependent applications (samtools, bcftools, etc.) against the patched HTSlib version

Patch Information

The HTSlib maintainers have released security patches in versions 1.23.1, 1.22.2, and 1.21.1. The fix adds explicit validation of the option parameter in varint and const codec initialization, rejecting invalid option values by jumping to a malformed error handler rather than proceeding with potentially dangerous decoder assignments. The patch is available via the GitHub Security Advisory GHSA-cgcm-c9r2-p57j and the patch commit.

Workarounds

  • There is no workaround available for this vulnerability according to the vendor advisory
  • The only mitigation is upgrading to a patched HTSlib version
  • Consider temporarily disabling CRAM file support if your workflows can use alternative formats (BAM/SAM) until patching is complete
bash
# Verify installed HTSlib version and upgrade
# Check current version
htsfile --version

# Update via package manager (example for conda)
conda update -c bioconda htslib

# Or compile from patched source
git clone https://github.com/samtools/htslib.git
cd htslib
git checkout 1.23.1
make && make install

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 Score8.8

  • EPSS Probability0.02%

  • Known ExploitedNo
  • CVSS Vector
  • 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/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
  • IntegrityNone
  • AvailabilityLow
  • CWE References
  • CWE-121
  • Vendor Resources
  • GitHub Commit Changes

  • GitHub Security Advisory GHSA-cgcm-c9r2-p57j
  • Related CVEs
  • CVE-2026-31962: Htslib CRAM Buffer Overflow Vulnerability

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

  • CVE-2026-31969: HTSlib Buffer Overflow Vulnerability

  • CVE-2026-31970: 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