Identify code-execution-capable behavior embedded in serialized ML model artifacts without executing the artifact during inspection.
- Developer/CI host
- Model loading pipeline
- Credentials and filesystem accessible to the loader
- Integrity of model artifacts
Attacker
│
▼
malicious model artifact
│
▼
model registry / download
│
▼
torch.load / pickle.load
│
▼
code execution
ModelHawk inserts a static inspection step before the load boundary.
- Pickle
GLOBAL/STACK_GLOBALreferences to dangerous callables REDUCE-based execution chains- Python object-construction gadget indicators
- Unsafe YAML Python tags
- NumPy object-array pickle payloads
- Unsafe model artifacts presented as ordinary ML files
The scanner should:
- Never deserialize the untrusted artifact.
- Produce deterministic findings for the same input.
- Preserve evidence sufficient for manual review.
- Fail CI at configured severity thresholds.
- Prefer explicit false-positive tradeoffs over pretending to prove safety.
- Proving arbitrary native extensions are safe
- Detecting every possible gadget chain
- Runtime sandboxing
- Trustworthiness of the model's learned parameters
- Application-specific behavior after a safe load
Static opcode analysis is necessarily bounded by the parser and classification model. A SAFE result means only that supported dangerous patterns were not detected.
Prefer code-free model containers such as safetensors where the deployment stack supports them, and treat untrusted pickle-compatible artifacts as executable content.