GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — shutil.unpack_archive() on Windows writes outside extract_dir for ZIP entries with drive-prefixed names · Issue #146581 · python/cpython Closed Labels 3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.13only security fixesonly security fixes3.14bugs and security fixesbugs and security fixes3.15bugs and security fixesbugs and security fixesOS-windowsstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-securityA security issueA security issue DescriptionBug reportBug description:SummaryI found a Windows-specific issue in In On Windows, such names are joined into a drive-qualified path and can escape the intended extraction directory. As a result, a crafted ZIP archive can cause files to be written outside Affected component
ImpactA crafted ZIP archive can cause an arbitrary file write outside Trigger condition
Tested environmentI reproduced this on Windows with Python 3.12.8. Minimal reproductionI attached a minimal repro script:
The repro creates a ZIP archive containing an entry like: D:/shutil_outside_min.txt and then calls: shutil.unpack_archive(str(zip_path), str(extract_dir)) Root cause For comparison, zipfile's own extraction logic strips drive information before extraction, but shutil._unpack_zipfile() does not. Expected behavior Actual behavior Additional context I also attached a short write-up: vuln_shutil_unpack_archive_zip_windows_drive_path.md shutil_unpack_archive_zip_windows_drive_path_min.zip CPython versions tested on:CPython main branch, 3.14 Operating systems tested on:Windows Linked PRs
Activity
MetadataMetadataAssigneesLabels3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.13only security fixesonly security fixes3.14bugs and security fixesbugs and security fixes3.15bugs and security fixesbugs and security fixesOS-windowsstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-securityA security issueA security issue Projects
MilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |