Skip to content
Heist/ feed
Back to feed
HighFix available

htslib — security advisory

Type: advisorySources: OSVAdvisory ID: DEBIAN-CVE-2026-31970

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.

Products
htslib
Affected versions
1.16+ds-3, 1.17+ds-0+exp1, 1.17+ds-1, 1.18+ds-0+exp1, 1.18+ds-1, 1.19+ds-0+exp0, 1.19+ds-1, 1.19+ds-1+exp1, 1.19+ds-1.1, 1.20+ds-1, 1.20+ds-2, 1.21+ds-0+exp1, 1.21+ds-0+exp2, 1.21+ds-1, 1.22.1+ds-1, 1.22.1+ds-2, 1.22.1+ds2-1, 1.24-1, 1.24-2, 1.24-3
Fixed versions
1.24-2
CVEs
CVE-2026-31970
Confirmed fixed CVEs
Not specified
Updated in this feed
31 Oct 2026, 08:20 UTC · Revision 1

Source evidence

DEBIAN-CVE-2026-31970

core-osv · Original source

Published 18 Mar 2026, 20:16 UTC

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.

osv:DEBIAN-CVE-2026-31970

htslib

Fixed versions: Not specified

htslib

Fixed versions: Not specified

htslib

Fixed versions: 1.24-2

Complete source record
{
  "id": "7e949673b921983266545c294d59e045a734f23d30eafc31111333e944327bcf",
  "url": "https://osv.dev/vulnerability/DEBIAN-CVE-2026-31970",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "DEBIAN-CVE-2026-31970",
    "summary": "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.",
    "evidence": "osv:DEBIAN-CVE-2026-31970",
    "products": [
      {
        "name": {
          "value": "htslib",
          "evidence": "/affected/0/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": [
          {
            "value": "1.16+ds-3",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "1.17+ds-0+exp1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "1.17+ds-1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "1.18+ds-0+exp1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "1.18+ds-1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "1.19+ds-0+exp0",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "1.19+ds-1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "1.19+ds-1+exp1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "1.19+ds-1.1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "1.20+ds-1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "1.20+ds-2",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "1.21+ds-0+exp1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "1.21+ds-0+exp2",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "1.21+ds-1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "1.22.1+ds-1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "1.22.1+ds-2",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "1.22.1+ds2-1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "1.24-1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "1.24-2",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "1.24-3",
            "evidence": "/affected/0/versions"
          }
        ]
      },
      {
        "name": {
          "value": "htslib",
          "evidence": "/affected/1/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": [
          {
            "value": "1.21+ds-1",
            "evidence": "/affected/1/versions"
          },
          {
            "value": "1.22.1+ds-1",
            "evidence": "/affected/1/versions"
          },
          {
            "value": "1.22.1+ds-2",
            "evidence": "/affected/1/versions"
          },
          {
            "value": "1.22.1+ds2-1",
            "evidence": "/affected/1/versions"
          },
          {
            "value": "1.24-1",
            "evidence": "/affected/1/versions"
          },
          {
            "value": "1.24-2",
            "evidence": "/affected/1/versions"
          },
          {
            "value": "1.24-3",
            "evidence": "/affected/1/versions"
          }
        ]
      },
      {
        "name": {
          "value": "htslib",
          "evidence": "/affected/2/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "1.24-2",
            "evidence": "/affected/2/ranges"
          }
        ],
        "affected_versions": [
          {
            "value": "1.21+ds-1",
            "evidence": "/affected/2/versions"
          },
          {
            "value": "1.22.1+ds-1",
            "evidence": "/affected/2/versions"
          },
          {
            "value": "1.22.1+ds-2",
            "evidence": "/affected/2/versions"
          },
          {
            "value": "1.22.1+ds2-1",
            "evidence": "/affected/2/versions"
          },
          {
            "value": "1.24-1",
            "evidence": "/affected/2/versions"
          }
        ]
      }
    ],
    "severity": "high",
    "structured": {
      "id": "DEBIAN-CVE-2026-31970",
      "aliases": [
        "DEBIAN-CVE-2026-31970"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                }
              ]
            }
          ],
          "package": {
            "name": "htslib",
            "purl": "pkg:deb/debian/htslib?arch=source&distro=bookworm",
            "ecosystem": "Debian:12"
          },
          "versions": [
            "1.16+ds-3",
            "1.17+ds-0+exp1",
            "1.17+ds-1",
            "1.18+ds-0+exp1",
            "1.18+ds-1",
            "1.19+ds-0+exp0",
            "1.19+ds-1",
            "1.19+ds-1+exp1",
            "1.19+ds-1.1",
            "1.20+ds-1",
            "1.20+ds-2",
            "1.21+ds-0+exp1",
            "1.21+ds-0+exp2",
            "1.21+ds-1",
            "1.22.1+ds-1",
            "1.22.1+ds-2",
            "1.22.1+ds2-1",
            "1.24-1",
            "1.24-2",
            "1.24-3"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/debian-osv/debian-cve-osv/DEBIAN-CVE-2026-31970.json"
          },
          "ecosystem_specific": {
            "urgency": "not yet assigned"
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                }
              ]
            }
          ],
          "package": {
            "name": "htslib",
            "purl": "pkg:deb/debian/htslib?arch=source&distro=trixie",
            "ecosystem": "Debian:13"
          },
          "versions": [
            "1.21+ds-1",
            "1.22.1+ds-1",
            "1.22.1+ds-2",
            "1.22.1+ds2-1",
            "1.24-1",
            "1.24-2",
            "1.24-3"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/debian-osv/debian-cve-osv/DEBIAN-CVE-2026-31970.json"
          },
          "ecosystem_specific": {
            "urgency": "not yet assigned"
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "1.24-2"
                }
              ]
            }
          ],
          "package": {
            "name": "htslib",
            "purl": "pkg:deb/debian/htslib?arch=source&distro=forky",
            "ecosystem": "Debian:14"
          },
          "versions": [
            "1.21+ds-1",
            "1.22.1+ds-1",
            "1.22.1+ds-2",
            "1.22.1+ds2-1",
            "1.24-1"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/debian-osv/debian-cve-osv/DEBIAN-CVE-2026-31970.json"
          },
          "ecosystem_specific": {
            "urgency": "not yet assigned"
          }
        }
      ],
      "modified": "2026-10-19T17:00:07.078905619Z",
      "provider": "osv",
      "upstream": [
        "CVE-2026-31970"
      ],
      "references": [
        "https://security-tracker.debian.org/tracker/CVE-2026-31970"
      ]
    },
    "related_cves": [
      {
        "value": "CVE-2026-31970",
        "evidence": "/upstream"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 375442,
  "published_at": "2026-03-18T20:16:21.98+00:00"
}