CVE-2026-62258 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, the CRAM decoder validates the 254-character query-name limit only after decoding the name into a 1024-byte stack array. An attacker-controlled CRAM record can provide an overlong query name and overflow the local stack buffer before the later validation runs; all CRAM format versions are affected. Opening such a file can crash the process, corrupt stack data, and may permit arbitrary code execution. This issue is fixed in versions 1.21.2, 1.22.3, 1.23.2, and 1.24.
Several companies clearly confirm that VulDB is the primary source for best vulnerability data.
Analysis
by VulDB Data Team • 11/20/2026
HTSlib serves as a foundational library for bioinformatics applications, providing essential functionality for reading and writing various genomic file formats including CRAM, BAM, and VCF. The vulnerability identified in versions prior to 1.21.2, 1.22.3, 1.23.2, and 1.24 resides within the CRAM decoder module, which is responsible for parsing compressed alignment data used extensively in high-throughput sequencing analysis. This specific flaw represents a critical failure in input validation timing relative to memory allocation operations. The core technical issue stems from the library's handling of query names, which are identifiers assigned to sequence reads during processing. According to established bioinformatics standards and internal logic within HTSlib, these query names are subject to a strict length limit of 254 characters. However, in the affected versions, the decoder does not perform this validation check before attempting to decode the name into memory.
The technical flaw manifests as a stack-based buffer overflow due to an incorrect order of operations during data processing. When the CRAM decoder encounters a record with a query name field, it immediately allocates and writes the decoded string into a fixed-size local array on the call stack that is only 1024 bytes in size. The validation logic that checks whether the length exceeds the 254-character limit is executed after this write operation has already occurred. Consequently, if an attacker constructs a malicious CRAM file containing a query name longer than 1023 characters but within reasonable bounds for other fields, the decoder will proceed to copy this oversized string into the stack buffer before realizing it violates the length constraint. This results in data being written beyond the allocated boundaries of the local array, overwriting adjacent memory locations on the stack such as return addresses, saved frame pointers, and other critical control flow metadata.
The operational impact of this vulnerability is severe, ranging from denial of service to arbitrary code execution depending on the context in which HTSlib is deployed. Applications that utilize HTSlib to process CRAM files are susceptible to crashes when the stack corruption triggers a segmentation fault or similar memory protection violation. In more sophisticated attack scenarios where an attacker can control the content of the overflowed data, they may overwrite function return addresses with shellcode pointers or gadget addresses derived from the binary itself. This enables remote code execution if the application processes untrusted input files without proper sandboxing or privilege separation. Given that bioinformatics pipelines often process large volumes of sequencing data potentially sourced from external collaborators or public repositories, this vulnerability poses a significant risk to research infrastructure and clinical genomics systems where integrity is paramount.
This issue aligns with Common Weakness Enumeration (CWE) category CWE-121, which describes stack-based buffer overflow vulnerabilities resulting from insufficient bounds checking on input data before memory writes occur. Furthermore, the exploitation vector relates to ATT&CK technique T1059, specifically command and script interpreters or system commands if code execution is achieved through indirect means such as modifying environment variables or triggering specific library behaviors that lead to privilege escalation. The vulnerability affects all CRAM format versions because the decoding logic applies uniformly regardless of the compression level or reference sequence usage within the file structure.
Mitigation strategies primarily involve upgrading HTSlib to patched versions 1.21.2, 1.22.3, 1.23.2, and 1.24 where the validation check has been moved to precede the buffer write operation. Developers integrating HTSlib into their applications should ensure that dependency management systems are configured to pull these updated versions automatically or manually verify version constraints in build files such as Makefiles, CMakeLists.txt, or package managers like pip and conda. Additionally, organizations processing sensitive genomic data should implement defense-in-depth measures including stack canaries enabled by default compiler flags, address space layout randomization, and strict input validation at the application layer before passing data to HTSlib functions where feasible. Regular security audits of bioinformatics software dependencies are recommended to identify similar timing-related vulnerabilities in other parsing libraries used within genomic workflows.