Skip to content

Conversation

ezhiltech
Copy link

PR Description:

Issue Addressed
This PR mitigates the security vulnerability CVE-2024-55587, which allows directory traversal attacks when extracting ZIP files using python-libarchive.

Fix Implemented:
Sanitized Filenames:

Introduced sanitize_filename() in zip.py to remove malicious path components like ../ and absolute paths.
Ensures extracted files remain within the intended directory.
Updated extract() and extractall():

Applied sanitize_filename() to prevent unsafe file extractions.
Raised ValueError if an unsafe path is detected.
Added Test Cases:

Unit tests in test_zip.py to validate:

Prevents directory traversal attacks, mitigating the security risk.
Ensures backward compatibility with existing safe extractions.
Improves overall security of ZipFile extraction methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant