Description
HTSlib through 1.24 contains a heap out-of-bounds write and read vulnerability in bgzf_index_load_hfile() in bgzf.c that allows attackers to corrupt heap memory by supplying a crafted .gzi index entry count. A count of 0xFFFFFFFF truncates noffs to zero, causing writes past a malloc(0) buffer and an offs[-1] read in bgzf_useek(), resulting in heap corruption or crashes in tools like samtools and bcftools.
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| samtools | htslib | ≤ 1.24 | — |
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 14 | htslib | No fix yet | — |
| Debian 13 | htslib | No fix yet | — |
| Debian 12 | htslib | No fix yet | — |
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 26.10 | htslib | No fix yet | — |
| Ubuntu 26.04 LTS | htslib | No fix yet | — |
| Ubuntu 24.04 LTS | htslib | No fix yet | — |
| Ubuntu 22.04 LTS | htslib | No fix yet | — |
| Ubuntu 20.04 LTS | htslib | No fix yet | — |
Show 3 more (older releases, extended support, other products)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu Pro 18.04 LTS | htslib | No fix yet | — |
| Ubuntu Pro 16.04 LTS | htslib | No fix yet | — |
| Ubuntu Pro 14.04 LTS | htslib | No fix yet | — |
References
- Pull Request #2057 issue-tracking patch
- Patch Commit patch
- https://github.com/samtools/htslib product
- https://github.com/samtools/htslib/blob/1.24/bgzf.c#L2504 technical-description
- https://hackmd.io/@haindpwn/htslib-bgzf-gzi-int-truncation-oob third-party-advisory
- https://github.com/samtools/htslib/issues/2113 issue-tracking
- VulnCheck Advisory: HTSlib through 1.24 Heap Out-of-Bounds Write via Truncated .gzi Index Count third-party-advisory