xiaoyaoes commited on
Commit
447aa80
·
verified ·
1 Parent(s): eae09c2

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +56 -0
README.md ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: mlflow
3
+ tags:
4
+ - security-research
5
+ - modelscan-bypass
6
+ - copyreg
7
+ - ext2
8
+ - pickle-registry
9
+ - rce
10
+ ---
11
+
12
+ # ModelScan EXT2 Opcode Bypass — RCE via Pickle Extension Registry
13
+
14
+ ## Summary
15
+
16
+ ModelScan's pickle scanner only inspects **GLOBAL**, **INST**, and **STACK_GLOBAL** opcodes to detect dangerous module/function references. It completely ignores **EXT1**, **EXT2**, and **EXT4** opcodes.
17
+
18
+ This MLflow model uses `copyreg.add_extension()` to register `os.system` in pickle's extension registry, then loads it via the **EXT2** opcode — which ModelScan never examines. The result: arbitrary OS command execution with zero detection.
19
+
20
+ ## Attack Chain
21
+
22
+ 1. `copyreg.add_extension('os', 'system', 31337)` registers os.system under external code 31337
23
+ 2. `EXT2 31337` opcode loads os.system from the registry — **invisible to ModelScan**
24
+ 3. REDUCE calls `os.system('cmd')` — command executed
25
+
26
+ ## Why ModelScan Fails
27
+
28
+ ModelScan analyzes only three opcode types:
29
+ - `GLOBAL` → `module\nname\n`
30
+ - `INST` → `module\nname\n`
31
+ - `STACK_GLOBAL` → walks backwards for string operands
32
+
33
+ **EXT1, EXT2, and EXT4 opcodes are completely absent from the scanner code.** The dangerous `os.system` reference is loaded through the extension registry and never appears as a module/name pair in the opcode stream.
34
+
35
+ ## Verification
36
+
37
+ ```bash
38
+ # ModelScan says CLEAN
39
+ modelscan -p model.pkl
40
+ # Output: No issues found! 🎉
41
+
42
+ # pickle.load() triggers RCE
43
+ python3 -c "
44
+ import pickle
45
+ with open('model.pkl', 'rb') as f:
46
+ pickle.load(f)
47
+ "
48
+ # Output: EXT2_PWNED
49
+ ```
50
+
51
+ ## Impact
52
+
53
+ - **Severity**: Critical (CVSS 9.8)
54
+ - **Novel technique**: Not covered in any known CVE, GHSA, or security advisory
55
+ - Remote, no auth needed, no user interaction
56
+ - Scissors past all unsafe_globals restrictions