|
| 1 | +# ModelHawk Threat Model |
| 2 | + |
| 3 | +## Security objective |
| 4 | + |
| 5 | +Identify code-execution-capable behavior embedded in serialized ML model artifacts without executing the artifact during inspection. |
| 6 | + |
| 7 | +## Assets |
| 8 | + |
| 9 | +- Developer/CI host |
| 10 | +- Model loading pipeline |
| 11 | +- Credentials and filesystem accessible to the loader |
| 12 | +- Integrity of model artifacts |
| 13 | + |
| 14 | +## Attack path |
| 15 | + |
| 16 | +``` |
| 17 | +Attacker |
| 18 | + │ |
| 19 | + ▼ |
| 20 | +malicious model artifact |
| 21 | + │ |
| 22 | + ▼ |
| 23 | +model registry / download |
| 24 | + │ |
| 25 | + ▼ |
| 26 | +torch.load / pickle.load |
| 27 | + │ |
| 28 | + ▼ |
| 29 | +code execution |
| 30 | +``` |
| 31 | + |
| 32 | +ModelHawk inserts a static inspection step before the load boundary. |
| 33 | + |
| 34 | +## Threats in scope |
| 35 | + |
| 36 | +- Pickle `GLOBAL` / `STACK_GLOBAL` references to dangerous callables |
| 37 | +- `REDUCE`-based execution chains |
| 38 | +- Python object-construction gadget indicators |
| 39 | +- Unsafe YAML Python tags |
| 40 | +- NumPy object-array pickle payloads |
| 41 | +- Unsafe model artifacts presented as ordinary ML files |
| 42 | + |
| 43 | +## Security properties |
| 44 | + |
| 45 | +The scanner should: |
| 46 | + |
| 47 | +1. Never deserialize the untrusted artifact. |
| 48 | +2. Produce deterministic findings for the same input. |
| 49 | +3. Preserve evidence sufficient for manual review. |
| 50 | +4. Fail CI at configured severity thresholds. |
| 51 | +5. Prefer explicit false-positive tradeoffs over pretending to prove safety. |
| 52 | + |
| 53 | +## Out of scope |
| 54 | + |
| 55 | +- Proving arbitrary native extensions are safe |
| 56 | +- Detecting every possible gadget chain |
| 57 | +- Runtime sandboxing |
| 58 | +- Trustworthiness of the model's learned parameters |
| 59 | +- Application-specific behavior after a safe load |
| 60 | + |
| 61 | +## Key limitation |
| 62 | + |
| 63 | +Static opcode analysis is necessarily bounded by the parser and classification model. A SAFE result means only that supported dangerous patterns were not detected. |
| 64 | + |
| 65 | +## Defensive recommendation |
| 66 | + |
| 67 | +Prefer code-free model containers such as safetensors where the deployment stack supports them, and treat untrusted pickle-compatible artifacts as executable content. |
0 commit comments