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