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-31962: CWE-122: Heap-based Buffer Overflow in samtools htslib

0
High
Published: Wed Mar 18 2026 (03/18/2026, 18:08:26 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. While most alignment records store DNA sequence and quality values, the format also allows them to omit this data in certain cases to save space. Due to some quirks of the CRAM format, it is necessary to handle these records carefully as they will actually store data that needs to be consumed and then discarded. Unfortunately the `cram_decode_seq()` did not handle this correctly in some cases. Where this happened it could result in reading a single byte from beyond the end of a heap allocation, followed by writing a single attacker-controlled byte to the same location. 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. There is no workaround for this issue.

AI-Powered Analysis

AILast updated: 03/18/2026, 19:13:15 UTC

Technical Analysis

HTSlib is a widely used C library for reading and writing bioinformatics file formats such as BAM, SAM, and CRAM, which store DNA sequence alignment data. CRAM is a compressed format that can omit DNA sequence and quality values in certain records to save space. Due to the format's quirks, the cram_decode_seq() function must carefully handle these records, consuming and discarding data appropriately. In vulnerable versions of htslib, cram_decode_seq() incorrectly processes these records, leading to reading one byte beyond the allocated heap buffer and subsequently writing a single attacker-controlled byte to that out-of-bounds location. This results in a heap-based buffer overflow (CWE-122), which can corrupt heap metadata or adjacent memory structures. Such corruption can cause program crashes or be leveraged by attackers to execute arbitrary code remotely without authentication or user interaction. The vulnerability affects multiple versions of htslib, specifically versions before 1.21.1, versions from 1.22 up to but not including 1.22.2, and version 1.23. The issue was fixed in versions 1.21.1, 1.22.2, and 1.23.1. No workarounds exist, and no known exploits have been reported in the wild as of publication. The CVSS 4.0 base score is 8.8, reflecting high severity due to network attack vector, no required privileges or user interaction, and potential for high impact on integrity and availability. The vulnerability is tagged with multiple CWEs related to buffer overflows and improper memory handling (CWE-122, CWE-125, CWE-129, CWE-787).

Potential Impact

This vulnerability poses a significant risk to organizations that use htslib for processing genomic data, including research institutions, healthcare providers, pharmaceutical companies, and bioinformatics service providers. Exploitation can lead to denial of service via program crashes, data corruption affecting the integrity of critical genomic datasets, and potentially remote code execution, which could allow attackers to execute arbitrary commands or implant malware within systems handling sensitive genetic information. Given the increasing reliance on genomic data for personalized medicine and research, compromise of these systems could have severe consequences including loss of data confidentiality, disruption of research workflows, and damage to organizational reputation. The lack of required authentication or user interaction lowers the barrier for exploitation, increasing the urgency for patching. Although no exploits are known in the wild yet, the public disclosure and high severity score suggest attackers may develop exploits soon, especially targeting organizations with high-value genomic data.

Mitigation Recommendations

Organizations should immediately identify and inventory all systems and applications using htslib versions prior to 1.21.1, between 1.22 and 1.22.2, or version 1.23. They must upgrade to the fixed versions 1.21.1, 1.22.2, or 1.23.1 as soon as possible. Since no workarounds exist, patching is the only effective mitigation. Additionally, organizations should implement strict input validation and sandboxing for processes handling untrusted CRAM files to limit potential damage from exploitation. Monitoring and logging of applications processing genomic data should be enhanced to detect abnormal crashes or suspicious behavior indicative of exploitation attempts. Network segmentation and access controls should be applied to restrict exposure of vulnerable services. Finally, organizations should keep abreast of threat intelligence updates for any emerging exploits targeting this vulnerability and be prepared to deploy incident response measures if exploitation is detected.

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.483Z
Cvss Version
4.0
State
PUBLISHED

Threat ID: 69baf5d2771bdb1749bce2b9

Added to database: 3/18/2026, 6:58:26 PM

Last enriched: 3/18/2026, 7:13:15 PM

Last updated: 3/18/2026, 8:01:34 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