Heap Buffer Overflow and Stack Overflow Vulnerability in HTSlib Library by Samtools
CVE-2026-31968
What is CVE-2026-31968?
The HTSlib library, used for handling bioinformatics file formats, exhibits a vulnerability stemming from inadequate validation within the VARINT and CONST encodings. Exploiting this vulnerability may permit an attacker to write beyond the bounds of allocated memory, leading to heap or stack overflow scenarios. This misallocation can cause unexpected behavior, including program crashes and data corruption. If a specially crafted file is opened, it could alter adjacent variable values or disrupt program control flow, potentially enabling arbitrary code execution. Victims should upgrade to versions 1.23.1, 1.22.2, or 1.21.1, which contain critical fixes to mitigate this issue.
Affected Version(s)
htslib < 1.21.1 < 1.21.1
htslib >= 1.22, < 1.22.2 < 1.22, 1.22.2
htslib = 1.23 = 1.23
