CVE-2026-3087

shutil.unpack_archive() doesn't check for Windows absolute paths in ZIPs

Published Apr 27, 2026 CVSS 4.0 · 6 Medium EPSS < 1% KEV · Not listed
Description
If `shutil.unpack_archive()` is given a ZIP archive with an absolute Windows path containing a drive (`C:\\...`) then the archive will be extracted outside the target directory which is different than other operating systems. Only Windows is affected by this vulnerability.

Analysis

AI-generated

Technical impact

shutil.unpack_archive() extracts the contents of a ZIP file into a target directory, but when the archive contains an absolute Windows path that starts with a drive letter, the function ignores the target directory and writes files wherever the path points. This behavior enables an attacker to overwrite or create files outside the intended extraction area, effectively a directory traversal vulnerability (CWE‑22).

Affected Systems

All CPython releases that include the standard library function shutil.unpack_archive() are vulnerable on Windows. The flaw is specific to the Windows platform; other operating systems correctly enforce the target directory. Exact versions are not listed, so any CPython installation on Windows that calls unpack_archive to extract ZIP archives should be treated as affected until a patch is applied.

Risk and Exploitability

The CVSS score of 6 indicates medium severity, and the vulnerability is not listed in the CISA KEV catalog. Exploitation requires supply of a malicious ZIP file to code that calls unpack_archive, making the attack vector local or user‑controlled. An attacker could place files on the system, potentially overwriting existing files or writing malicious payloads to unintended locations.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade to the latest CPython release that incorporates the patch for this issue
  • Replace calls to shutil.unpack_archive with a custom extraction routine that validates or sanitizes each archive entry, rejecting absolute Windows paths that begin with a drive letter or a root slash
  • If an upgrade or replacement is not immediately possible, limit unpacking to a secured directory and explicitly check each path component before extraction to ensure it stays within the designated target

Generated by OpenCVE AI on April 28, 2026 at 12:50 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
CPEs cpe:2.3:a:python:python:3.15.0:alpha_1:*:*:*:*:*:*
cpe:2.3:a:python:python:3.15.0:alpha_2:*:*:*:*:*:*
cpe:2.3:a:python:python:3.15.0:alpha_3:*:*:*:*:*:*
cpe:2.3:a:python:python:3.15.0:alpha_4:*:*:*:*:*:*
cpe:2.3:a:python:python:3.15.0:alpha_5:*:*:*:*:*:*
cpe:2.3:a:python:python:3.15.0:alpha_6:*:*:*:*:*:*
cpe:2.3:a:python:python:3.15.0:alpha_7:*:*:*:*:*:*
cpe:2.3:a:python:python:3.15.0:alpha_8:*:*:*:*:*:*
cpe:2.3:a:python:python:3.15.0:alpha1:*:*:*:*:*:*
cpe:2.3:a:python:python:3.15.0:alpha2:*:*:*:*:*:*
cpe:2.3:a:python:python:3.15.0:alpha3:*:*:*:*:*:*
cpe:2.3:a:python:python:3.15.0:alpha4:*:*:*:*:*:*
cpe:2.3:a:python:python:3.15.0:alpha5:*:*:*:*:*:*
cpe:2.3:a:python:python:3.15.0:alpha6:*:*:*:*:*:*
cpe:2.3:a:python:python:3.15.0:alpha7:*:*:*:*:*:*
cpe:2.3:a:python:python:3.15.0:alpha8:*:*:*:*:*:*
Type Values Removed Values Added
First Time appeared Microsoft
Microsoft windows
Python python
CPEs cpe:2.3:a:python:python:*:*:*:*:*:*:*:*
cpe:2.3:a:python:python:3.15.0:alpha_1:*:*:*:*:*:*
cpe:2.3:a:python:python:3.15.0:alpha_2:*:*:*:*:*:*
cpe:2.3:a:python:python:3.15.0:alpha_3:*:*:*:*:*:*
cpe:2.3:a:python:python:3.15.0:alpha_4:*:*:*:*:*:*
cpe:2.3:a:python:python:3.15.0:alpha_5:*:*:*:*:*:*
cpe:2.3:a:python:python:3.15.0:alpha_6:*:*:*:*:*:*
cpe:2.3:a:python:python:3.15.0:alpha_7:*:*:*:*:*:*
cpe:2.3:a:python:python:3.15.0:alpha_8:*:*:*:*:*:*
cpe:2.3:o:microsoft:windows:-:*:*:*:*:*:*:*
Vendors & Products Microsoft
Microsoft windows
Python python
Metrics cvssV3_1

{'score': 7.5, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N'}

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Python
Python cpython
Vendors & Products Python
Python cpython
Type Values Removed Values Added
Description If `shutil.unpack_archive()` is given a ZIP archive with an absolute Windows path containing a drive (`C:\\...`) then the archive will be extracted outside the target directory which is different than other operating systems. Only Windows is affected by this vulnerability.
Title shutil.unpack_archive() doesn't check for Windows absolute paths in ZIPs
Weaknesses CWE-22
References
Metrics cvssV4_0

{'score': 6, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N'}

Weaknesses
  • CWE-22

    Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

Sources

Status
PUBLISHED
Assigner
PSF
Published
Updated
Aug 13, 2026, 12:28 AM
Reserved
Feb 23, 2026, 11:14 PM
Status
Modified
Published
Apr 27, 2026, 9:16 PM
Modified
Oct 26, 2026, 9:10 PM