On November 24, a file claiming to be a fine-tuned small Llama model appeared on Hugging Face, an AI model-sharing site. In an investigation published that same day, security firm JFrog said the file was not a real model but a fake designed to steal credentials. After researchers reported it, Hugging Face disabled repositories associated with the campaign. 1
To run AI on your own computer or server, you may download and load model files distributed by someone else. It is easy to think of these files as nothing more than numerical data needed to generate answers, but depending on the file format and loading settings, they can also run code. In this case, there were three ways in—and an unexpected moment when the creator exposed their own secrets while testing the model. 2, 1
The identity of the 2.5 KB model
The first repository was named “llama-3.2-1b-tuned” and described as a fine-tuned model. Model weights are a collection of numbers containing the results of training, and the file size was suspicious. According to JFrog, a real model with 1 billion parameters is over 2 GB, while the files in this repository, .bin, were only about 2.5 KB each. Instead of weights that could generate answers, researchers found code designed to steal information. 1
Image source · research.jfrog.com
When the code ran, it read values stored in the environment where the program was running, along with the environment information available to the container’s first process. A container is an environment for running programs in isolation. If cloud service account tokens were present, it collected those too, and checked the running processes and their associated repositories, network paths, and whether a GPU was available. Such environment information can contain API keys or credentials—the keys to accessing services. 1, 2
The collected information was set to be sent not to an unfamiliar external server, but to the attacker’s repository on Hugging Face. It used a write token hidden in the code to upload the data as a new file. JFrog explained that in an environment allowed to connect to Hugging Face to download a model, the same route could also be used for data exfiltration. However, because the initial repository was public, anything uploaded there was public too—a weakness in the scheme. 1
Three doors in the loading process
The first door was Python code supplied alongside the model. The configuration file instructed the program loading the model to use code provided by the attacker. If users allowed remote code to be trusted by setting trust_remote_code=True, that code could be loaded and run before the weights were even read. As its name suggests, this option allows external code to execute; it is not the same as simply downloading a model file. 1
Image source · research.jfrog.com
The second door was pickle inside the .bin file. Pickle is a format for storing Python objects and restoring them later, and it can include actions to run during restoration. This fake file was configured to run information-stealing code when restored. If a model-reading function opened it in an unsafe way, the code could run before a user entered a single prompt. 1, 2
The conditions matter. According to JFrog, the two types of pickle files used in this case are blocked by torch.load(weights_only=True). This setting has been the default since PyTorch 2.6. Older environments, code that specifies weights_only=False, or code that restores pickle files directly may still be affected. If a tool opens every .bin file in a repository in bulk, even files that a regular model loader would not automatically read could pose a problem. 1
The third door was the chat template. This is a format for structuring the conversation passed to a model, and the template in this case included an attempt to run system commands and insert environment information into the conversation input. JFrog explained that Transformers’ restricted template execution environment blocks this escape attempt, but a server that processes templates with ordinary Jinja and without such restrictions would not. In other words, the three paths would not work the same way in every installation. 1
The creator’s key exposed during testing
The first information collected belonged not to an outside victim, but to the creator. As of November 24 UTC, a collection file was created 14 seconds after the model files were uploaded, then overwritten with test content three seconds later. A second collection from the same device followed, and soon after, a setting was added to disable external transmission during testing. Based on the file paths and edit history, JFrog concluded that the creator had tested the code in their own development environment. 1
Image source · research.jfrog.com
The collected environment variables and process records revealed the runtime environment of an AI agent called ARTEX. An agent is a program that can use tools while performing assigned tasks. JFrog said it had high confidence that the malicious model was created, uploaded, and tested as part of ARTEX’s tasks. In the process, API keys and database credentials from the agent’s environment, as well as its task list, were uploaded to a public repository, the company said. 1
That does not mean the agent independently decided every part of the attack. JFrog said the records alone did not show how much a person directed the process or how much the AI chose autonomously, and that the person who gave the instructions had not been identified. 1
A second model with no weights
Later, the same account uploaded small test repositories targeting the process of loading a tokenizer—a tool that splits text into units a model can process. Some tests checked invalid file formats or sizes, while others examined how the system responded depending on whether remote code was allowed. JFrog interpreted this as probing the behavior of a specific service that accepts external model repositories, rather than randomly targeting individuals. 1
Almost five hours after the tokenizer tests, at 08:19 UTC, the same account under a new name published “mistral-7b-utterance.” This time, there were no weights at all. The repository contained a configuration file, a tokenizer sourced from elsewhere, and two Python files containing malicious code. According to JFrog, in a path that allows remote code execution, the configuration and code are loaded before the weights, so the attack code could run even without a model capable of producing proper answers. 1
Image source · research.jfrog.com
This also means that checking only file formats may not be enough to assess an entire repository. In a research note published in March, the Cloud Security Alliance recommended using safetensors, a weights-only format, instead of executable pickle files; checking the provenance of model files and whether they have been changed; and limiting external communications and permissions in the runtime environment. However, converting weights to safetensors does not automatically make separately enabled remote code or templates safe. 2, 1
Conclusion
Model files are not always malicious, but, as this case shows, executable code can be embedded in the loading process. When installing local AI, check not only where the download comes from, but also whether remote code execution is allowed and what settings are used to open older pickle files. The settings applied before a model starts answering can be the boundary that protects the secrets on your computer. 1
Have you ever checked a file’s source or whether remote code is allowed when installing a model?
References
- The Agent That Robbed Itself: an AI-Driven Hugging Face Malware Campaign Leaks Its Own Operator - JFrog Security Research · research.jfrog.com↩
- Model Poisoning: Credential Exfiltration in Self-Hosted LLM Deployments · labs.cloudsecurityalliance.org↩








