CVE-2026-3087: Python shutil path traversal in ZIP extraction on Windows

CVE-2026-3087 · Severity: high · CVSS 7.5 · Published 2026-04-27

A vulnerability exists in the Python 'shutil' library, which is commonly used by developers to manage files and archives. When extracting a ZIP file on Windows, a specially crafted archive can place files in arbitrary locations on the computer instead of the intended folder. This could allow an attacker to overwrite sensitive system files or application data, potentially leading to system compromise.

Quick answers

Is CVE-2026-3087 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-3087 being exploited in the wild.
How severe is CVE-2026-3087?
High severity, with a CVSS score of 7.5, published 27 April 2026.
Which products and versions are affected?
Python Software Foundation Python up to 3.14.4, 3.15.0a1-3.15.0a8.
Is there a fix for CVE-2026-3087?
A patch was published on 2026-04-27: Patches committed to CPython repository Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-3087 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2026-3087?
Check whether anything you run is named in the advisory. 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

A path traversal vulnerability (CWE-22) exists in the `shutil.unpack_archive()` function within Python's standard library. When processing ZIP archives on Windows, the function fails to properly sanitize archive members that contain absolute Windows paths (e.g., starting with 'C:\\'). This allows an attacker to bypass the intended `extract_dir` and write files to arbitrary locations on the host filesystem. The root cause was the internal use of a custom extraction loop that did not leverage the built-in sanitization logic of `ZipFile.extractall()`. The fix involves migrating to `ZipFile.extractall()` to ensure proper path validation.

Affected products

  • Python Software Foundation Python up to 3.14.4, 3.15.0a1-3.15.0a8

Timeline

  • 2026-04-27: disclosed
  • 2026-04-27: patched: Patches committed to CPython repository
  • 2026-04-27: advisory

References

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