pytorch / torchx

TorchX is a universal job launcher for PyTorch applications. TorchX is designed to have fast iteration time for training/research and support for E2E production ML pipelines when you're ready.
https://pytorch.org/torchx
Other
306 stars 98 forks source link

Zip Slip Vulnerability on Torchx Examples #879

Open aydinnyunus opened 2 months ago

aydinnyunus commented 2 months ago

🐛 Bug

Zip Slip is a widespread arbitrary file overwrite critical vulnerability, which typically results in remote command execution

https://github.com/pytorch/torchx/blob/main/torchx/examples/apps/lightning/data.py#L147

Module (check all that applies):

To Reproduce

Steps to reproduce the behavior:

I created simple PoC

import tarfile

tar_path = "zip-slip.tar"
data_path = "output"
print(f"extracting {tar_path} to {data_path}...")
with tarfile.open(tar_path, mode="r") as f:
    f.extractall(data_path)

Expected behavior

If file contains malicious extract path it should be sanitized or gives error

latest torchx