Downloads · 30 days
0
liamramsey/modelscan-torchpackage-bypass-poc
modelscan-torchpackage-bypass-poc is a machine learning model from liamramsey. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Security research PoC for the huntr.com Model File Format bounty program. Benign marker payload only (writes /tmp/POC2PWNEDtorchpackage). No destructive or network behavior.
Downloads · 30 days
0
Access
Public
Updated Jun 3, 2026
Repo size
3.4 KB
Likes
0
Public
Click a slice to open those files.
.pt1.7 KB · 29%
From the Hugging Face model README
Security research PoC for the huntr.com Model File Format bounty program.
Benign marker payload only (writes /tmp/POC2_PWNED_torch_package). No destructive or network behavior.
malicious.pt is a torch.package archive. torch.package serializes Python module source into the
.pt. When loaded with the normal public API PackageImporter(file).load_pickle(pkg, resource), the importer
calls compile() + exec() on the interned source, so a top-level statement in the packaged .py runs at
load time. Protect AI ModelScan (v0.8.6) only disassembles pickle bytecode and explicitly skips the
.py source files, so it reports "No issues found!" on this live-RCE file.
pip install torch==2.8.0 modelscan==0.8.6
# 1) it executes on load:
python -c "from torch.package import PackageImporter; PackageImporter('malicious.pt').load_pickle('data','model.pkl'); print(open('/tmp/POC2_PWNED_torch_package').read())"
# -> prints PWNED_torch_package...
# 2) but the scanner says clean:
modelscan -p malicious.pt # -> "No issues found!"
modelscan -p malicious.pt --show-skipped # -> the payload .py is "skipped"
The identical os.system payload placed in the pickle (via __reduce__) inside a torch.package archive
IS flagged CRITICAL by ModelScan — proving the bypass is the interned-source exec path, not the payload.
See build_poc.py.