CVE-2026-31962: HTSlib CRAM reader has heap buffer overflow due to improper validation of input
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 cramdecodeseq() 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.
Affected Software
Remediation
Event History
Frequently Asked Questions
What is the severity of CVE-2026-31962?
CVE-2026-31962 is classified as a high severity vulnerability due to the potential for a heap buffer overflow.
How do I fix CVE-2026-31962?
To fix CVE-2026-31962, update HTSlib to version 1.21.2 or later to address the buffer overflow issue.
What impact does CVE-2026-31962 pose on HTSlib users?
CVE-2026-31962 can lead to remote code execution or application crashes if exploited, affecting users handling DNA sequence alignment data.
Which versions of HTSlib are affected by CVE-2026-31962?
HTSlib versions up to and including 1.21.1 are affected by CVE-2026-31962.
Is there a risk of data loss associated with CVE-2026-31962?
Yes, exploitation of CVE-2026-31962 could potentially lead to data corruption or loss during processing.