ModelScan Bypass PoC: pydoc.pipepager
Summary
This model file demonstrates a bypass of ProtectAI's modelscan scanner (v0.7.6).
The file passes modelscan with "No issues found" but executes arbitrary shell commands when loaded via pickle.loads() or torch.load().
Technique
- Module:
pydoc - Function:
pydoc.pipepager(text, cmd) - Mechanism:
pydoc.pipepagerinternally callssubprocess.Popen(cmd, shell=True), enabling arbitrary command execution - Why it bypasses: The
pydocmodule is not in modelscan'sunsafe_globalsblocklist
Verification
# Step 1: Scan with modelscan โ reports 0 issues
modelscan scan -p pytorch_model.bin
# Step 2: Load with pickle โ executes shell command
python3 -c "
import pickle, zipfile
with zipfile.ZipFile('pytorch_model.bin') as zf:
pickle.loads(zf.read('archive/data.pkl'))
"
Impact
Full remote code execution (RCE) on any system that loads this model file using pickle-based deserialization.
Disclosure
Reported via Huntr MFV program (ProtectAI).
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐ Ask for provider support