CVE-2026-31972
Received Received - Intake
Use-After-Free in SAMtools mpileup Causes Information Leak and Crash

Publication date: 2026-03-18

Last updated on: 2026-03-19

Assigner: GitHub, Inc.

Description
SAMtools is a program for reading, manipulating and writing bioinformatics file formats. The `mpileup` command outputs DNA sequences that have been aligned against a known reference. On each output line it writes the reference position, optionally the reference DNA base at that position (obtained from a separate file) and all of the DNA bases that aligned to that position. As the output is ordered by position, reference data that is no longer needed is discarded once it has been printed out. Under certain conditions the data could be discarded too early, leading to an attempt to read from a pointer to freed memory. This bug may allow information about program state to be leaked. It may also cause a program crash through an attempt to access invalid memory. This bug is fixed in versions 1.21.1 and 1.22. There is no workaround for this issue.
CVSS Scores
EPSS Scores
Probability:
Percentile:
Meta Information
Published
2026-03-18
Last Modified
2026-03-19
Generated
2026-05-07
AI Q&A
2026-03-18
EPSS Evaluated
2026-05-05
NVD
EUVD
Affected Vendors & Products
Showing 1 associated CPE
Vendor Product Version / Range
samtools samtools to 1.21.1 (exc)
Helpful Resources
Exploitability
CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-416 The product reuses or references memory after it has been freed. At some point afterward, the memory may be allocated again and saved in another pointer, while the original pointer references a location somewhere within the new allocation. Any operations using the original pointer are no longer valid because the memory "belongs" to the code that operates on the new pointer.
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?

[{'type': 'paragraph', 'content': 'CVE-2026-31972 is a use-after-free vulnerability in the `mpileup` command of SAMtools, a bioinformatics tool used for processing DNA sequence alignment data. The vulnerability occurs because SAMtools prematurely discards reference data after printing it, which leads to attempts to read from memory that has already been freed.'}, {'type': 'paragraph', 'content': "This invalid memory access can cause the program to crash or leak information about the program's internal state. The issue affects SAMtools versions up to 1.21 and is fixed in versions 1.21.1 and 1.22."}, {'type': 'paragraph', 'content': 'The vulnerability can be exploited remotely without any privileges or user interaction, and it has a moderate severity with a CVSS v4 base score of 6.9.'}] [1]


How can this vulnerability impact me? :

[{'type': 'paragraph', 'content': 'This vulnerability can impact you by causing the SAMtools program to crash unexpectedly due to invalid memory access.'}, {'type': 'paragraph', 'content': "Additionally, it may lead to leakage of information about the program's internal state, which could potentially expose sensitive data processed by SAMtools."}, {'type': 'paragraph', 'content': 'Since the vulnerability can be exploited remotely without any privileges or user interaction, it poses a risk to systems running vulnerable versions of SAMtools, especially in automated or remote bioinformatics workflows.'}] [1]


How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:

I don't know


How can this vulnerability be detected on my network or system? Can you suggest some commands?

This vulnerability is a use-after-free bug in the mpileup command of SAMtools versions up to 1.21. It may cause program crashes or leak information about program state when processing DNA sequence alignments.

Detection involves identifying if your system is running a vulnerable version of SAMtools (version 1.21 or earlier) and if the mpileup command is used.

Since the issue manifests as crashes or memory errors during mpileup execution, you can detect it by running mpileup on representative data and monitoring for crashes or memory errors.

  • Check SAMtools version: `samtools --version`
  • Run mpileup on test data and observe for crashes or abnormal termination.
  • Use memory debugging tools such as AddressSanitizer or Valgrind to detect use-after-free errors when running mpileup.

What immediate steps should I take to mitigate this vulnerability?

There is no workaround for this vulnerability.

The immediate and recommended mitigation is to update SAMtools to a fixed version, specifically version 1.21.1 or later.

Updating to these versions resolves the use-after-free bug by properly handling reference caching in the mpileup command.


Ask Our AI Assistant
Need more information? Ask your question to get an AI reply (Powered by our expertise)
0/70
EPSS Chart