Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement safe deserialization #128

Closed
wants to merge 1 commit into from

Conversation

knottb
Copy link
Contributor

@knottb knottb commented May 27, 2020

Summary:
Python's pickle package is susceptible to RCE attacks in deserialization (using pickle.loads()).

This diff implements a restriced Unpickler that checks input classes for loaded objects / functions, and rejects them if they are not within a "safe set".

Also allows users to register new safe types that can be sent as objects.

Also updated objects send / recv / broadcast tests to communicate several types of safe standard / custom objects, and tests that invalid objects are rejected.

This is a 2nd attempt at D21574976, which I plan to abandon since it does not allow torch tensors to be communicated.

Differential Revision: D21745034

Summary:
Python's pickle package is susceptible to RCE attacks in deserialization (using `pickle.loads()`).

This diff implements a restriced Unpickler that checks input classes for loaded objects / functions, and rejects them if they are not within a "safe set".

Also allows users to register new safe types that can be sent as objects.

Also updated objects send / recv / broadcast tests to communicate several types of safe standard / custom objects, and tests that invalid objects are rejected.

This is a 2nd attempt at D21574976, which I plan to abandon since it does not allow torch tensors to be communicated.

Differential Revision: D21745034

fbshipit-source-id: 9e7e38cbd8a2d5059cf04d1a945a0efd05a8bf58
@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported labels May 27, 2020
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D21745034

facebook-github-bot pushed a commit that referenced this pull request Jun 10, 2020
Summary:
Pull Request resolved: #128

Pull Request resolved: fairinternal/CrypTen#208

Python's pickle package is susceptible to RCE attacks in deserialization (using `pickle.loads()`).

This diff implements a restriced Unpickler that checks input classes for loaded objects / functions, and rejects them if they are not within a "safe set".

Also allows users to register new safe types that can be sent as objects.

Also updated objects send / recv / broadcast tests to communicate several types of safe standard / custom objects, and tests that invalid objects are rejected.

This is a 2nd attempt at D21574976, which I plan to abandon since it does not allow torch tensors to be communicated.

Reviewed By: Cictrone

Differential Revision: D21745034

fbshipit-source-id: 560c69a14e05c8e126b0e5fbac77bb80210e296b
tanjuntao pushed a commit to tanjuntao/CrypTen that referenced this pull request Nov 27, 2023
Summary:
Pull Request resolved: fairinternal/CrypTen#128

Fix syntax error

Reviewed By: vshobha

Differential Revision: D17840642

fbshipit-source-id: 66018c4f8d8014b19e9ef4bcee1f6c956aaf3bec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants