Downloads · 30 days
0
askeladd-k/modelscan-legacy-pt-bypass
modelscan-legacy-pt-bypass is a machine learning model from askeladd-k. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as cc-by-4.0.
Proof-of-concept legacy .pt file demonstrating that ModelScan's PyTorch scanner only inspects the first pickle record. Malicious globals in any record after the first (e.g., in the objectgraph record at index 3) bypas…
Downloads · 30 days
0
Access
Public
Updated May 12, 2026
Repo size
467 B
Likes
1
Public
Click a slice to open those files.
.py12.9 KB · 76%
From the Hugging Face model README
Proof-of-concept legacy .pt file demonstrating that ModelScan's PyTorch scanner only inspects the first pickle record. Malicious globals in any record after the first (e.g., in the object_graph record at index 3) bypass detection and execute under torch.load(weights_only=False).
This file is intentionally malicious for demonstration purposes. Do not load it on a system you care about. The payload writes a marker file R3_marker.txt containing the timestamp of execution.
See the huntr submission for the detailed Description.
The PoC file R3_v2_legacy_object_graph_exec.pt is stored via Git LFS. To fetch the actual 467-byte fixture (not the pointer):
git lfs install
git clone https://huggingface.co/askeladd-k/modelscan-legacy-pt-bypass poc
cd poc
git lfs pull
Or download R3_v2_legacy_object_graph_exec.pt directly from the HF repo's Files tab.
Tested with modelscan==0.8.8 and torch>=1.6. If torch>=2.6, the reproduction requires either:
TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD=1 set in the environment, ORweights_only=False passed explicitly to torch.load(...).This is because PyTorch 2.6.0 (2025-01-29) changed the default to weights_only=True, which blocks the malicious __builtin__ exec global. The submission's claim is precisely that ModelScan misses the malicious record AND the loader (in the unsafe configuration) executes it.
python -m venv venv
# Windows: . venv/Scripts/activate
# POSIX: . venv/bin/activate
pip install modelscan==0.8.8 torch
python repro.py
[build] wrote R3_v2_legacy_object_graph_exec.pt (467 bytes)
[scan] modelscan total_issues=0 (BYPASS confirmed)
[load] torch.load executed payload: R3_POC_EXECUTED marker present
This proof-of-concept was generated with AI-assisted analysis and manually verified in a clean environment. The fixture build script (build_poc.py) and the reproduction script (repro.py) are included for full transparency.