Detect mailcap.findmatch pickle payloads#346
Open
massy-o wants to merge 1 commit into
Open
Conversation
massy-o
commented
May 14, 2026
| return mailcap.findmatch, (caps, "text/plain") | ||
|
|
||
|
|
||
| def test_scan_flags_mailcap_findmatch(tmp_path) -> None: |
Author
There was a problem hiding this comment.
Self-review: this uses the public ModelScan().scan() path instead of importing the pickle scanner directly, so the regression follows the same path users hit from the CLI/API.
massy-o
commented
May 14, 2026
| "pdb": "*", | ||
| "shutil": "*", | ||
| "asyncio": "*", | ||
| "mailcap": [ |
Author
There was a problem hiding this comment.
Self-review: this keeps the fix scoped to the specific stdlib gadget observed in the PoC. mailcap.findmatch can execute a mailcap test command through os.system(), so it belongs with the CRITICAL pickle globals.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mailcap.findmatchto the unsafe pickle globals listModelScanWhy
mailcap.findmatchcan execute a matching mailcap entrytestcommand viaos.system(). Without this entry, a pickle payload using that callable can scan cleanly even though unpickling can execute shell behavior.Testing
uv run --with-editable . --with pytest pytest tests/test_pickle_unsafe_globals.py