Stack-based Buffer Overflow Affecting samtools/htslib package, versions [,1.21.1)[1.22,1.22.2)[1.23,1.23.1)


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.47% (42nd percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-UNMANAGED-SAMTOOLSHTSLIB-15762295
  • published24 Mar 2026
  • disclosed18 Mar 2026
  • creditUnknown

Introduced: 18 Mar 2026

CVE-2026-31968  (opens in a new tab)
CWE-121  (opens in a new tab)

How to fix?

Upgrade samtools/htslib to version 1.21.1, 1.22.2, 1.23.1 or higher.

Overview

Affected versions of this package are vulnerable to Stack-based Buffer Overflow through incomplete validation of the context in which the VARINT and CONST encodings are used. An attacker can cause a program crash, overwrite data structures on the heap or stack, or alter the control flow of the program by supplying a specially crafted file.

CVSS Base Scores

version 4.0
version 3.1