xiaoyaoes commited on
Commit
059b5c6
·
verified ·
1 Parent(s): fae6d4d

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +53 -0
README.md ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: mlflow
3
+ tags:
4
+ - security-research
5
+ - modelscan-bypass
6
+ - importlib
7
+ - methodcaller
8
+ - rce
9
+ ---
10
+
11
+ # ModelScan importlib + methodcaller Bypass — RCE via importlib.import_module & operator.methodcaller
12
+
13
+ ## Summary
14
+
15
+ ModelScan's pickle scanner blocks `os.*`, `sys.*`, `subprocess.*`, `builtins.*` in its `unsafe_globals` denylist. However, **`importlib.import_module`** and **`operator.methodcaller`** are NOT blocked.
16
+
17
+ This MLflow model contains a malicious pickle that imports `os` at RUNTIME (through `importlib.import_module`) and calls `os.system()` (through `operator.methodcaller`). ModelScan sees only clean opcodes and reports zero issues.
18
+
19
+ ## Attack Chain
20
+
21
+ The pickle bytecode uses only two STACK_GLOBAL opcodes:
22
+
23
+ 1. `importlib.import_module('os')` → Returns the os module at runtime
24
+ 2. `operator.methodcaller('system', 'command')` → Creates a callable that calls os.system()
25
+
26
+ Deserialization: `operator.methodcaller('system', 'cmd')(importlib.import_module('os'))` → `os.system('cmd')`
27
+
28
+ ## Why It Works
29
+
30
+ - `importlib` is NOT in modelscan's unsafe_globals at all
31
+ - `operator.methodcaller` is NOT blocked (only `operator.attrgetter` is)
32
+ - The dangerous `os.system` never appears in pickle opcodes — it's constructed at runtime
33
+
34
+ ## Verify
35
+
36
+ ```bash
37
+ # 1. ModelScan says CLEAN
38
+ modelscan -p model.pkl
39
+ # Output: No issues found! 🎉
40
+
41
+ # 2. MLflow load triggers RCE
42
+ python3 -c "
43
+ import mlflow.pyfunc
44
+ model = mlflow.pyfunc.load_model('.')
45
+ # os.system() executes before load_model returns
46
+ "
47
+ ```
48
+
49
+ ## Impact
50
+
51
+ - **Severity**: Critical (CVSS 9.8)
52
+ - **Affected**: All pickle-based formats scanned by ModelScan
53
+ - Remote, no auth needed, no user interaction
Free AI Image Generator No sign-up. Instant results. Open Now