# CVE-2026-31963: HTSlib CRAM reader has heap buffer overflow due to improper validation of input

- Severity: High 8.8 (CVSS:4.0, scored by GitHub_M) `CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:L/SC:N/SI:N/SA:N`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.41%, higher than 37% of CVEs (2026-12-01)
- Published: 2026-03-18T18:22:58.440Z
- Modified: 2026-06-17T10:34:51.040Z
- Weaknesses: CWE-122, CWE-129, CWE-787
- SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial
- Assigned by: GitHub_M

## Description

HTSlib is a library for reading and writing bioinformatics file formats. CRAM is a compressed format which stores DNA sequence alignment data. As one method of removing redundant data, CRAM uses reference-based compression so that instead of storing the full sequence for each alignment record it stores a location in an external reference sequence along with a list of differences to the reference at that location as a sequence of "features". When decoding these features, an out-by-one error in a test for CRAM features that appear beyond the extent of the CRAM record sequence could result in an invalid write of one attacker-controlled byte beyond the end of a 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. There is no workaround for this issue.

(As written by CVE List.)

## Affected

- samtools htslib: < 1.21.1; >= 1.22, < 1.22.2; = 1.23
- htslib htslib: before 1.21.1; from 1.22 before 1.22.2; 1.23

## Every score

- GitHub_M: CVSS:4.0 8.8 High `CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:L/SC:N/SI:N/SA:N`
- NVD: CVSS:3.1 8.1 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H`

## References

- <https://github.com/samtools/htslib/security/advisories/GHSA-qgqh-h2q9-7w3c> (patch, vendor-advisory)
- <https://github.com/samtools/htslib/commit/8bcc9907be0f945ddc31796d64f078fa05456acd> (patch)

## Sources

- CVE List: [CVE-2026-31963](https://www.cve.org/CVERecord?id=CVE-2026-31963), CVE Terms of Use, modified 2026-03-18
- NVD: [CVE-2026-31963](https://nvd.nist.gov/vuln/detail/CVE-2026-31963), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2026-31963 · Whole record: https://cve.day/CVE-2026-31963.json · Rebuilt by cve.day 2026-11-25T22:59:16.132Z
