CVE-2026-31970 Details
Description
HTSlib is a library for reading and writing bioinformatics file formats. GZI files are used to index block-compressed GZIP [BGZF] files. In the GZI loading function, `bgzf_index_load_hfile()`, it was possible to trigger an integer overflow, leading to an under- or zero-sized buffer being allocated to store the index. Sixteen zero bytes would then be written to this buffer, and, depending on the result of the overflow the rest of the file may also be loaded into the buffer as well. If the function did attempt to load the data, it would eventually fail due to not reading the expected number of records, and then try to free the overflowed heap buffer. 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. The easiest work-around is to discard any `.gzi` index files from untrusted sources, and use the `bgzip -r` option to recreate them.
A heap buffer overflow vulnerability has been identified in HTSlib, a library for handling bioinformatics file formats. This issue arises in versions of HTSlib through 1.21, 1.22, and 1.23.1, within the GZI loading function 'bgzf_index_load_hfile()'. The vulnerability is triggered by an integer overflow that leads to an under- or zero-sized buffer being allocated for the index. Consequently, the function writes sixteen zero bytes to this buffer, and depending on the overflow's outcome, may also load additional data from the file into the buffer. If the function attempts to process this data, it can fail to read the expected number of records, leading to an attempt to free the improperly allocated heap buffer. This exploitation can cause the program to crash or overwrite data and heap structures in unexpected ways, potentially allowing for arbitrary code execution.
HTSlib versions 1.21.1, 1.22.2, and 1.23.1 include fixes for this vulnerability. Users are also advised to discard any '.gzi' index files from untrusted sources and use the 'bgzip -r' option to recreate them.
Metrics
CVSS 4.0 Severity and Vector Strings:
CVSS 3.x Severity and Vector Strings:
No data available for CVSS Version 2.0 on this CVE.
CISA-ADP
Assessed Mar 18, 2026References to Advisories, Solutions, and Tools
By selecting these links, you will be leaving this site. These are references gathered from the official CVE record and are not endorsed by Volerion.
| URL | Source(s) | Tag(s) |
|---|---|---|
| http://www.openwall.com/lists/oss-security/2026/03/18/9 | CVE | Mailing ListThird Party Advisory |
| https://github.com/samtools/htslib/commit/6dd0d7d0e9e7e2e173a28969e624db8bc8bb5828 | [email protected] | Patch |
| https://github.com/samtools/htslib/security/advisories/GHSA-p345-84hx-fq6q | [email protected] | MitigationPatchVendor Advisory |
Weakness Enumeration
| CWE-ID | CWE Name | Source |
|---|---|---|
| CWE-122 | Heap-based Buffer Overflow | [email protected] |
| CWE-1284 | Improper Validation of Specified Quantity in Input | [email protected] |
| CWE-131 | Incorrect Calculation of Buffer Size | [email protected] |
| CWE-190 | Integer Overflow or Wraparound | [email protected] |
| CWE-787 | Out-of-bounds Write | [email protected] |
Affected Products
| Product | Versions |
|---|---|
| htslib htslib | < 1.21 >= 1.22, < 1.22.2 1.23 |
CPE
Remediation
| |
Change History
5 change records found show changes
| Date | Action | Recorded By |
|---|---|---|
| Jun 17, 2026 | CVE Modified | [email protected] |
| Jun 17, 2026 | CVE Modified | CISA-ADP |
| Mar 19, 2026 | Initial Analysis | [email protected] |
| Mar 19, 2026 | CVE Modified | CVE |
| Mar 18, 2026 | New CVE Received | [email protected] |