Skip to content

[3.11] gh-146581: Fix vulnerability in shutil.unpack_archive() for ZIP files on Windows (GH-146591) - #149071

Merged
pablogsal merged 1 commit into
python:3.11from
serhiy-storchaka:backport-fc829e8-3.11
Aug 9, 2026
Merged

[3.11] gh-146581: Fix vulnerability in shutil.unpack_archive() for ZIP files on Windows (GH-146591)#149071
pablogsal merged 1 commit into
python:3.11from
serhiy-storchaka:backport-fc829e8-3.11

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Apr 27, 2026

Copy link
Copy Markdown
Member

Use ZipFile.extractall() to sanitize file names and extract files.

Files with invalid names (e.g. absolute paths) are now skipped.

Files containing ".." in the name are no longer skipped.

(cherry picked from commit fc829e8)

… files on Windows (pythonGH-146591)

Use ZipFile.extractall() to sanitize file names and extract files.

Files with invalid names (e.g. absolute paths) are now skipped.

Files containing ".." in the name are no longer skipped.

(cherry picked from commit fc829e8)
@serhiy-storchaka

Copy link
Copy Markdown
Member Author

Ping. Merging this PR is needed for backport to 3.10.

@pablogsal
pablogsal merged commit 7ef7dd0 into python:3.11 Aug 9, 2026
25 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Aug 9, 2026

Copy link
Copy Markdown

GH-155440 is a backport of this pull request to the 3.10 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.10 only security fixes label Aug 9, 2026
pablogsal pushed a commit that referenced this pull request Aug 10, 2026
…P files on Windows (GH-146591) (GH-149071) (#155440)

[3.11] gh-146581: Fix vulnerability in shutil.unpack_archive() for ZIP files on Windows (GH-146591) (GH-149071)

gh-146581: Fix vulnerability in shutil.unpack_archive() for ZIP files on Windows (GH-146591)

Use ZipFile.extractall() to sanitize file names and extract files.

Files with invalid names (e.g. absolute paths) are now skipped.

Files containing ".." in the name are no longer skipped.
(cherry picked from commit 7ef7dd0)


(cherry picked from commit fc829e8)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type-security A security issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants