HTSlib: Heap write overflow in HTSlib CRAM index handling
- State
- Published
- Severity
- 7.1 High
- Published
- Nov 19, 2026
- Updated
- Nov 19, 2026
- Reserved
- Jul 13, 2026
Description
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, cram_index_load does not verify that the number of reference sequences in a CRAM .crai index does not exceed the CRAM header reference count. A malformed index can drive unbounded index-array allocation, and when the number of references in the index is within two of INT_MAX, the growth calculation can wrap, read beyond a heap buffer, and use the resulting value as a pointer for an unchecked memory write. Any region query can trigger the flaw, causing denial of service or memory corruption. This issue is fixed in versions 1.21.2, 1.22.3, 1.23.2, and 1.24.
| Product | Versions |
|---|---|
| htslib samtools | < 1.21.2 Affected>= 1.22.0, < 1.22.3 Affected>= 1.23.0, < 1.23.2 Affected |
| CVSS | Score | How It's Reached | Source |
|---|---|---|---|
| 4.0 | 7.1 High | GitHub_M |
Weaknesses
References
- https://github.com/samtools/htslib/security/advisories/GHSA-28r7-prwc-hf5c
- https://github.com/samtools/htslib/pull/2029
- https://github.com/samtools/htslib/commit/08fbbceefdfac073e768c1fce593181ca7379222
- https://github.com/samtools/htslib/commit/57e1a0763c9a5f34a1d1ab9deb3a3ad2bd8fe11d
- https://github.com/samtools/htslib/commit/8a2394e63c9bdd758cc6a7de04c5e2ee7acc8e65
- https://github.com/samtools/htslib/commit/924e21755d0b5db7a33f1920d20c0e441667d22f
- https://github.com/samtools/htslib/releases/tag/1.21.2
- https://github.com/samtools/htslib/releases/tag/1.22.3
- https://github.com/samtools/htslib/releases/tag/1.23.2
- https://github.com/samtools/htslib/releases/tag/1.24
Every record here comes from the CVE Program's CVE List. © 1999-2026 The MITRE Corporation. CVE is a registered trademark of The MITRE Corporation. The records are reproduced under the CVE Program terms of use.