fix(polygraphy): use weights_only=True in torch.load to prevent RCE#4728
Open
tailingy wants to merge 1 commit intoNVIDIA:mainfrom
Open
fix(polygraphy): use weights_only=True in torch.load to prevent RCE#4728tailingy wants to merge 1 commit intoNVIDIA:mainfrom
tailingy wants to merge 1 commit intoNVIDIA:mainfrom
Conversation
…ia pickle deserialization Passing weights_only=True to torch.load() restricts deserialization to tensor data only, blocking arbitrary pickle-based code execution. Fixes NVBugs #5934574 - [PSIRT] Arbitrary Code Execution via unsafe torch.load() in Polygraphy JSON deserialization.
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
polygraphy/json/serde.pytorch.load(infile)was called withoutweights_only=True, allowing maliciously crafted Polygraphy JSON files to execute arbitrary code via Python'spicklemoduleweights_only=Truetotorch.load(), restricting deserialization to tensor data onlyChange
Impact
An attacker who can supply a crafted Polygraphy JSON file (e.g. via the CLI or Python API) can execute arbitrary code in the victim's process context. This enables data exfiltration, privilege escalation, and other attacks.
Compatibility
weights_only=Truehas been supported since PyTorch 1.13, which is already the minimum version declared by Polygraphy (torch>=1.13.0). No compatibility issues expected.References
🤖 Generated with Claude Code