Downloads · 30 days
0
th3-j0k3r/modelscan-joblib-cprofile-bypass
modelscan-joblib-cprofile-bypass is a machine learning model from th3-j0k3r. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Proof-of-concept for a Huntr Model File Format report.
Downloads · 30 days
0
Access
Public
Updated Jun 21, 2026
Repo size
128 B
Likes
0
Public
Click a slice to open those files.
.py2.7 KB · 47%
From the Hugging Face model README
.joblib via cProfile.run gadgetProof-of-concept for a Huntr Model File Format report.
model.joblib runs code on joblib.load() while ModelScan reports it clean.
The malicious __reduce__ uses cProfile.run — a code-executing stdlib callable that is
not on ModelScan's PickleUnsafeOpScan denylist — and hides the command in a string
argument the scanner never inspects.
model.joblib — the PoC model file (benign payload: writes modelscan_poc_executed.txt)exploit.py — builds the model, scans it with ModelScan, loads it, prints the resultpip install joblib modelscan
# 1) scanner says it is safe:
modelscan -p model.joblib # -> No issues found! 🎉
# 2) loading it executes code:
python -c "import joblib; joblib.load('model.joblib')"
ls modelscan_poc_executed.txt # marker proves code ran on load
# or run everything at once:
python exploit.py # -> No issues found (BYPASS) + CODE EXECUTED
ModelScan is used to gate untrusted models in MLOps pipelines / model hubs. This file passes the scan as clean yet achieves arbitrary code execution on load — defeating the control. Verified on modelscan 0.8.6 / joblib 1.5.3.
The payload here is benign (writes a marker file). Swap the command in exploit.py to confirm
real command execution.