Don't load Hugging Face models with trust_remote_code blindly

JFrog: a fake 'llama-3.2-1b-tuned' on Hugging Face stole cloud credentials on load, built and re-packaged by an AI agent · Security incident · JFrog Security Research · jfrog · Nov 24, 2026

What happened

JFrog says a new Hugging Face account published 'llama-3.2-1b-tuned' on 24 November with about 2.5 KB .bin files instead of real weights. Loading it with trust_remote_code=True, unpickling the files, or rendering its chat template ran a credential stealer that read environment variables and Kubernetes tokens and uploaded them back to Hugging Face. The operator's own AI agent leaked its keys; Hugging Face disabled every repo in the campaign.

How to prevent it

Only load models from publishers you trust, prefer safetensors over pickle .bin files, leave trust_remote_code off unless you've read the code, and load new models in a container with no cloud credentials.

Fix prompt for your own AI tool

Copy this into your own AI tool (Cursor, Lovable, Claude Code, Bolt…). It's general guidance written by us. Review what the AI suggests before applying it.

My app or scripts download models from Hugging Face. Help me load them safely. 1) Find every from_pretrained, pipeline or model download in my code and list which repos and publishers they use. 2) Flag any call with trust_remote_code=True and any model that ships pickle files (.bin, .pt, .pkl) instead of safetensors. 3) Suggest pinning each model to a specific commit and checking the file sizes match a real model. 4) Show me how to run first-time model loads in a container without my cloud keys or tokens. Don't change anything until I've approved your plan. Never ask me to paste API keys, passwords or .env contents; tell me where to check them myself.

Why this keeps happening: dependencies, plugins & mcp servers

AI tools suggest packages, editor extensions and MCP servers by name, and attackers publish look-alike or hijacked versions that steal keys or run code on install.

A quick checklist before you ship

More on this: every dependencies, plugins & mcp servers story and our related guide.

Tools involved

Hugging Face stories, Transformers stories, Llama stories

Related stories

Source: original post on JFrog Security Research ↗. Summarised in our own words; numbers are as stated by the source. Browse all stories.

The Honest Build. Real stories, not hype.

Every week: real stories of what building with AI actually took, the one lesson worth keeping, and the security slip-ups to avoid. Free, unsubscribe anytime. Weekly, every Friday.