Malicious Hugging Face Models: Pickle Code Execution
This is a standing risk, not a one-off bug: loading a pickle-based model from an untrusted repo is running that author's code, so check how your pipelines load third-party weights.
Must act: Teams and researchers that download PyTorch .bin/.pt/.pkl or Keras models from arbitrary Hugging Face accounts and load them with full pickle deserialization, especially on machines holding credentials.
Can relax: People who only load safetensors weights or models from organizations they trust, and who run PyTorch 2.6 or later with the default weights_only=True loading.
- Inventory where your code loads third-party models and which formats it uses.
- Prefer safetensors weights; refuse .bin/.pt/.pkl files from unknown authors.
- Upgrade to PyTorch 2.6 or later, or pass weights_only=True explicitly; never set weights_only=False on files you did not produce.