ModelScan Joblib Bypass β 3 Pickle-Based RCE Techniques
Three novel techniques that bypass modelscan's pickle scanner in JOBLIB format.
Bypass Summary
| # | Technique | Module | unsafe_globals? | Modelscan |
|---|---|---|---|---|
| 1 | PyDLL PyRun_SimpleString | ctypes.PyDLL |
NO | No issues |
| 2 | importlib + methodcaller | importlib, operator.methodcaller |
NO | No issues |
| 3 | code.InteractiveInterpreter | code.InteractiveInterpreter |
NO | No issues |
PoC Files
exploit_pydll.joblibβ Usesctypes.PyDLL(None).PyRun_SimpleString()to execute arbitrary Python via CPython C APIexploit_importlib.joblibβ Usesimportlib.import_module('os')+operator.methodcaller('system', cmd)for shell RCEexploit_code_interpreter.joblibβ Usescode.InteractiveInterpreter().runsource()to execute arbitrary Python
Verification
modelscan scan -p exploit_pydll.joblib
# -> "No issues found!"
Why They Work
modelscan's unsafe_globals blocklist does NOT include:
ctypesβ PyDLL/PyRun_SimpleStringimportlibβ import_moduleoperator.methodcaller(onlyattrgetteris blocked)codeβ InteractiveInterpreter
All three are standard library modules that can achieve full RCE.
Inference Providers NEW
This model isn't deployed by any Inference Provider. π Ask for provider support