CVE-2026-115791: Python gzip/tarfile/zipfile CLI module shadowing via sys.path

CVE-2026-115791 · Severity: info · Published 2026-11-10

Python's command-line decompression tools (gzip, tarfile, zipfile) extract files to the current directory where Python also searches for modules, allowing an attacker to place a malicious Python script (such as traceback.py) into an archive. If an error occurs during extraction, the malicious script can be executed, potentially leading to arbitrary code execution. This affects systems where users decompress untrusted archives using Python's CLI tools.

Technologies: Python Software Foundation CPython. Vendors: Python Software Foundation.

Quick answers

Is CVE-2026-115791 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-115791 being exploited in the wild.
How severe is CVE-2026-115791?
Informational severity, published 10 November 2026.
Which products and versions are affected?
Python Software Foundation CPython 3.11, 3.12, 3.13, 3.14, 3.15, 3.16.
Is there a fix for CVE-2026-115791?
A patch was published on 2026-11-09. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-115791 attacked?
It is attacked with local access, in a software library.
Am I affected by CVE-2026-115791?
Check whether you run Python Software Foundation CPython at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

Technical details

The vulnerability exists in Python's gzip, tarfile, and zipfile command-line interfaces, which add the current directory to sys.path (as sys.path[0]) when invoked via python -m MODULE. When decompressing archives to the current directory, a malicious Python script matching a standard library module name can shadow the legitimate module. If decompression then encounters an error and Python attempts to import a standard library module for error handling (e.g., traceback), the attacker's script executes instead. The fix removes sys.path[0] from these CLI contexts by introducing sys._path0 and calling runpy._remove_sys_path0() in the affected modules.

Affected products

  • Python Software Foundation CPython 3.11, 3.12, 3.13, 3.14, 3.15, 3.16

Timeline

  • 2026-11-09: disclosed
  • 2026-11-09: patched

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.