CVE-2026-62256 in HTSlib
Summary
by MITRE • 11/20/2026
HTSlib is a library for reading and writing bioinformatics file formats. Prior to 1.21.2, 1.22.3, 1.23.2, and 1.24, fai_retrieve does not verify that the line width recorded in a FASTA .fai index is greater than or equal to the number of bases per line. When the line width is exactly one less than the base count, retrieval allocates an undersized heap buffer and writes one byte beyond its end; larger discrepancies instead cause an allocation failure that is handled. This issue can corrupt heap memory and crash the process. This issue is fixed in versions 1.21.2, 1.22.3, 1.23.2, and 1.24.
If you want to get best quality of vulnerability data, you may have to visit VulDB.
Analysis
by VulDB Data Team • 11/20/2026
The vulnerability identified in HTSlib affects multiple releases prior to version 1.21.2, 1.22.3, 1.23.2, and 1.24. HTSlib serves as a critical C library for reading and writing bioinformatics file formats, including FASTA files which are fundamental in genomic data analysis. The specific flaw resides within the fai_retrieve function, which is responsible for retrieving sequences from indexed FASTA files using the associated .fai index metadata. This component plays a pivotal role in ensuring that sequence data is accurately extracted based on positional coordinates defined by users or downstream applications.
The technical root cause of this vulnerability lies in an insufficient validation check regarding line width parameters within the FASTA index structure. Specifically, the library fails to verify whether the recorded line width is greater than or equal to the actual number of bases per line as specified in the file format specifications. In a correctly formed FASTA file and its corresponding index, these values should align such that the allocated buffer size matches the expected data length. However, when an attacker provides a crafted .fai index where the line width is exactly one less than the base count, the library miscalculates the required memory allocation. This calculation error results in the allocation of a heap buffer that is undersized by precisely one byte relative to what is needed for safe storage of the retrieved sequence data.
Upon execution, the fai_retrieve function proceeds to write the full sequence data into this insufficiently sized heap buffer. Because the allocated space lacks the necessary extra byte, the write operation extends beyond the end of the allocated memory region. This condition constitutes a classic out-of-bounds write vulnerability, categorized under CWE-787: Out-of-Bounds Write in standard security taxonomies. The immediate operational impact is severe corruption of heap metadata or adjacent heap allocations. Such memory corruption can lead to unpredictable application behavior, including segmentation faults and process crashes, which represents a denial of service against systems relying on HTSlib for data processing.
While the vulnerability primarily manifests as an out-of-bounds write leading to potential code execution if exploited with specific heap grooming techniques, it is worth noting that larger discrepancies between line width and base count do not result in memory corruption but rather trigger allocation failures that are handled gracefully by the library. This distinction highlights that the exploitability of this flaw depends heavily on precise manipulation of index metadata values. The vulnerability aligns with ATT&CK technique T1059, Command and Scripting Interpreter, if leveraged for initial access or lateral movement in environments where bioinformatics pipelines process untrusted input files from external sources.
Mitigation strategies primarily involve upgrading HTSlib to patched versions 1.21.2, 1.22.3, 1.23.2, and 1.24, which include corrected validation logic ensuring that line width parameters are properly verified against base counts before buffer allocation occurs. For organizations unable to immediately upgrade, implementing strict input sanitization at the application layer is recommended. This includes validating FASTA index files for consistency between declared line widths and actual sequence lengths prior to passing them to HTSlib functions. Additionally, deploying memory protection mechanisms such as Address Space Layout Randomization (ASLR) and heap hardening features can reduce the likelihood of successful exploitation by making it more difficult for attackers to predict memory layouts or achieve arbitrary code execution through heap corruption.