-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Heap buffer overflow due to wrong loop condition in torch::jit::unpickler #103667
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
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/103667
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 7595ae5: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
albanD
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure to grasp this. Given the index is incremented by 2 every time, this shouldn't change anything?
Are you providing a malformed blob to the jit::load function?
cc @malfet
The loop condition checks that The bug was found by fuzzing jit::load function. |
|
But if we assume that the input is a multiple of 2 (which I guess is an assumption here as otherwise it would be an invalid serialized object), this cannot happen? |
|
Yes, if input is a multiple of 2 this works corrects. But this assumption is not declared here, so I think there should be either assert or correct loop condition. |
|
I think adding the right |
53591ac to
1185874
Compare
albanD
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge failedReason: 1 jobs have failed, first few of them are: trunk / linux-focal-rocm5.4.2-py3.8 / test (default, 1, 3, linux.rocm.gpu) Details for Dev Infra teamRaised by workflow job |
|
@pytorchbot rebase -s |
|
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
|
Successfully rebased |
1185874 to
7595ae5
Compare
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Hi!
I've been fuzzing different pytorch modules with with sydr-fuzz, and found a heap buffer overflow error that occures by incorrect loop condition in torch::jit::unpickler.cpp. This bug was found in several fuzzing targets: it can be triggered by
torch::jit::load()method when loading a .pt model and bytorch::distributed::rpc::deserializeRequest()method in RPC module.All found errors could be reproduced with provided docker: Dockerfile.
PoC for deserealizeRequest():
crash-0722408578cd2f26593b5a01e26d2a078d3dc5f6.zip
PoC for load():
crash-2bd32e496811fb06de24a2bb720dc6490218009f.zip