Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

CVE-2026-31966: CWE-125: Out-of-bounds Read in samtools htslib

0
Medium
VulnerabilityCVE-2026-31966cvecve-2026-31966cwe-125cwe-129
Published: Wed Mar 18 2026 (03/18/2026, 18:58:47 UTC)
Source: CVE Database V5
Vendor/Project: samtools
Product: htslib

Description

HTSlib is a library for reading and writing bioinformatics file formats. CRAM is a compressed format which stores DNA sequence alignment data. As one method of removing redundant data, CRAM uses reference-based compression so that instead of storing the full sequence for each alignment record it stores a location in an external reference sequence along with a list of differences to the reference at that location as a sequence of "features". When decoding CRAM records, the reference data is stored in a char array, and parts matching the alignment record sequence are copied over as necessary. Due to insufficient validation of the feature data series, it was possible to make the `cram_decode_seq()` function copy data from either before the start, or after the end of the stored reference either into the buffer used to store the output sequence for the cram record, or into the buffer used to build the SAM `MD` tag. This allowed arbitrary data to be leaked to the calling function. This bug may allow information about program state to be leaked. It may also cause a program crash through an attempt 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.

AI-Powered Analysis

AILast updated: 03/18/2026, 19:58:11 UTC

Technical Analysis

HTSlib is a widely used C library for reading and writing high-throughput sequencing data formats, including CRAM, a compressed format for DNA sequence alignments. CRAM achieves compression by storing differences relative to an external reference sequence rather than full sequences. During decoding, the reference sequence is loaded into a character array, and the function cram_decode_seq() reconstructs the aligned sequence by copying segments from this reference based on a series of 'features' that describe differences. The vulnerability (CWE-125: Out-of-bounds Read) occurs because cram_decode_seq() does not sufficiently validate the feature data indices, allowing it to read memory before the start or beyond the end of the reference buffer. This out-of-bounds read can cause two main issues: leaking arbitrary memory contents to the caller (potentially exposing sensitive program state information) and causing program crashes due to invalid memory access. The flaw affects htslib versions prior to 1.21.1, versions between 1.22 and 1.22.2, and version 1.23. Fixed versions have been released (1.21.1, 1.22.2, and 1.23.1). The vulnerability can be triggered by processing maliciously crafted CRAM files, requiring no authentication or user interaction, and can be exploited remotely if such files are processed. The CVSS 4.0 score is 6.9, reflecting medium severity with network attack vector, low complexity, and no privileges or user interaction required. No known exploits have been reported in the wild, and no workarounds exist other than upgrading to patched versions.

Potential Impact

The primary impact of CVE-2026-31966 is the potential leakage of arbitrary memory contents from the vulnerable application processing CRAM files. This could expose sensitive information about the program's internal state or data in memory, which might aid attackers in further exploitation or reconnaissance. Additionally, the out-of-bounds read can cause application crashes, leading to denial of service in bioinformatics pipelines relying on htslib. Since htslib is a foundational library used in many bioinformatics tools and workflows worldwide, this vulnerability could disrupt critical genomic data processing, affecting research, clinical diagnostics, and pharmaceutical development. The lack of authentication or user interaction requirements means that any system processing untrusted CRAM files is at risk. While no remote code execution is indicated, the information disclosure and stability impacts can be significant in sensitive environments handling genomic data.

Mitigation Recommendations

The only effective mitigation is to upgrade htslib to a fixed version: 1.21.1, 1.22.2, or 1.23.1 or later. Organizations should audit their bioinformatics pipelines and tools to identify usage of vulnerable htslib versions and update accordingly. Additionally, implement strict input validation and filtering to ensure only trusted CRAM files are processed, reducing exposure to crafted malicious files. Employ sandboxing or containerization for bioinformatics tools to limit the impact of potential crashes or memory leaks. Monitor logs and application behavior for crashes or anomalies that could indicate exploitation attempts. Since no workaround exists, patch management and supply chain verification are critical. Finally, maintain awareness of updates from samtools and related projects for any further advisories.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Data Version
5.2
Assigner Short Name
GitHub_M
Date Reserved
2026-03-10T15:40:10.484Z
Cvss Version
4.0
State
PUBLISHED

Threat ID: 69bb0078771bdb1749c07558

Added to database: 3/18/2026, 7:43:52 PM

Last enriched: 3/18/2026, 7:58:11 PM

Last updated: 3/18/2026, 8:45:55 PM

Views: 5

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need more coverage?

Upgrade to Pro Console in Console -> Billing for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses