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 — gh-138158: Use the `"data"` tarfile extraction filter in `Tools/ssl/multissltests.py` by ParzivalHack · Pull Request #138147 · python/cpython Conversation
|
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Reverted the unrelated whitespace changes
|
I have made the requested changes; please review again |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks for making the requested changes! @AA-Turner: please review the changes made to this pull request. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This PR overcomplicates a script that is already complex. The URLs are safe as they are hardcoded. I don't think we need to worry about this kind of attack, unless upstream is affected (namely official openssl, libressl or aws-lc repositories).
Has this PR been generated by AI?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Whatever we choose to do, an issue should be opened first. However, I don't think such change is needed, but to be on the perfectly safe side, we could just specify the filter in extractall.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Remove additional whitespace Co-authored-by: Stan Ulbrych <[email protected]>
This commit refactors the _unpack_src function to use the filter='data' argument in tarfile.extractall(). This change addresses the path traversal vulnerability more robustly, as suggested during code review. It also improves code clarity and removes the need for manual path validation checks.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Using the data filter seems harmless. I agree with Ben (& the PSRT) though that there is no practical 'vulnerability' here, so this is largely a change for theoretical purposes. As such, I'm +0; will leave to someone else to decide to merge.
A
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I thought about this a lot, because I originally didn't want un-necessary churn, even if it's helpful. However, it's actually possible for the user to skip the download part and directly specify a directory where the lib sources are. So, assuming that this directory is untrusted, it's entirely possible to have a bad archive out there. The attack surface is really small as this requires executing the script in a non-standard way, but I think it's a legitimate improvement. I need to test it locally though, (or @ParzivalHack, could you check that this effectively prevents the PT attack and share your PoC please?). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Hey @picnixz, I've put together a small (but detailed) repo with the PoC script, including a README.md that shows a side-by-side comparison of the vulnerable and patched outcomes. You can check it out here: https://github.com/ParzivalHack/PT-PoC Lmk if there's anything else I can do👍 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Thank you for the PoC. Actually, I just looked at the docs for tarfile, but apparently, the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
No worries. And i was running everything with Python 3.13.3👍 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
So that's the reason why it's vulnerable. However, as I mentioned on the issue, if someone is using Python 3.13 and below for PYTHON_FOR_REGEN, then they could suffer from this so I'm ok with this change. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Hey @picnixz, Thanks again for the opportunity to contribute :) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
multissltests"data" tarfile extraction filter in Tools/ssl/multissltests.py
|
Thanks @ParzivalHack for the PR, and @picnixz for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…/ssl/multissltests.py` (pythonGH-138147) The `Tools/ssl/multissltests.py` script may extract a possibly untrusted tarball. Since the script does not necessarily use Python 3.14 or later (where the `"data"` filter became the default `tarfile` extraction filter), the user may theoretically suffer from a path traversal attack. Although the script should not be used in production and usually relies on downloading trusted sources, the `"data"` extraction filter is now explicitly used wherever relevant. (cherry picked from commit 31d3836) Co-authored-by: Tommaso Bona <[email protected]>
…/ssl/multissltests.py` (pythonGH-138147) The `Tools/ssl/multissltests.py` script may extract a possibly untrusted tarball. Since the script does not necessarily use Python 3.14 or later (where the `"data"` filter became the default `tarfile` extraction filter), the user may theoretically suffer from a path traversal attack. Although the script should not be used in production and usually relies on downloading trusted sources, the `"data"` extraction filter is now explicitly used wherever relevant. (cherry picked from commit 31d3836) Co-authored-by: Tommaso Bona <[email protected]>
|
GH-138262 is a backport of this pull request to the 3.14 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
GH-138263 is a backport of this pull request to the 3.13 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…s/ssl/multissltests.py` (GH-138147) (#138263) gh-138158: Use the `"data"` tarfile extraction filter in `Tools/ssl/multissltests.py` (GH-138147) The `Tools/ssl/multissltests.py` script may extract a possibly untrusted tarball. Since the script does not necessarily use Python 3.14 or later (where the `"data"` filter became the default `tarfile` extraction filter), the user may theoretically suffer from a path traversal attack. Although the script should not be used in production and usually relies on downloading trusted sources, the `"data"` extraction filter is now explicitly used wherever relevant. (cherry picked from commit 31d3836) Co-authored-by: Tommaso Bona <[email protected]>
…s/ssl/multissltests.py` (GH-138147) (#138262) Co-authored-by: Tommaso Bona <[email protected]>
… `Tools/ssl/multissltests.py` (pythonGH-138147) (python#138262) Co-authored-by: Tommaso Bona <[email protected]>
…/ssl/multissltests.py` (python#138147) The `Tools/ssl/multissltests.py` script may extract a possibly untrusted tarball. Since the script does not necessarily use Python 3.14 or later (where the `"data"` filter became the default `tarfile` extraction filter), the user may theoretically suffer from a path traversal attack. Although the script should not be used in production and usually relies on downloading trusted sources, the `"data"` extraction filter is now explicitly used wherever relevant.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.