-
-
Notifications
You must be signed in to change notification settings - Fork 32.9k
Description
Tools/ssl/multissltests.py
suffers from a possible Path Traversal attack. The vulnerability allows for a crafted tarball to write an arbitrary file to a location outside of the intended build directory due to a lack of sanitization in the _unpack_src()
method's handling of tarball member names.
A comprehensive, self-contained PoC script was used to demonstrate the issue (and shared with the Python Security Response Team, henceforth PSRT), confirming the Path Traversal. The fix implemented in this PR ensures that each tarball member is manually extracted with a path check, preventing any file from escaping the designated directory. This approach provides a clear and robust solution to the issue.
As this is a test script, and not a production component, the PSRT has advised me to submitt it as a public enhancement. This fix ensures the integrity and robustness of the tool, by preventing an unprivileged file write that could lead to unexpected behavior.
I am submitting this enhancement to improve the overall quality of the CPython test suite. If necessary, I'm available to provide any additional information required for review.
PoC: https://github.com/ParzivalHack/PT-PoC.
Linked PRs
- gh-138158: Use the
"data"
tarfile extraction filter inTools/ssl/multissltests.py
#138147 - [3.14] gh-138158: Use the
"data"
tarfile extraction filter inTools/ssl/multissltests.py
(GH-138147) #138262 - [3.13] gh-138158: Use the
"data"
tarfile extraction filter inTools/ssl/multissltests.py
(GH-138147) #138263