trust_remote_code. Its policy scan should ban unsafe serialization formats like pickle for untrusted sources and prefer safe formats such as safetensors or ONNX before any notebook, CI job, or inference service loads the artifact.JFrog's 2024 research showed that malicious Hugging Face models can turn ordinary model loading into code execution. The observed PyTorch payload used pickle deserialization to start a reverse shell, which means the defensive boundary cannot be only "do we trust this model name?" It has to cover model provenance, unsafe format blocking, isolated loading, and outbound network control.
torch.load() can invoke pickle object reconstruction hooks, allowing attacker-controlled Python to run and start a shell connection to an external host.trust_remote_code. Its policy scan should ban unsafe serialization formats like pickle for untrusted sources and prefer safe formats such as safetensors or ONNX before any notebook, CI job, or inference service loads the artifact.safetensors or ONNX for third-party models.This case is old enough to be a pattern, not just a headline. A model repository can look like data, but the loader may treat parts of it like code. AIDEFEND maps cleanly here: prove model provenance, block unsafe formats and loader behavior, isolate first execution, restrict egress, and keep a dependency map so model-hub warnings become actionable incident scope.