The Agent That Robbed Itself: an AI-Driven Hugging Face Malware Campaign Leaks Its Own Operator A Hugging Face account created at 02:43:52 UTC on November 24 published a model named `llama-3.2-1b-tuned` whose `.bin` files were about 2.5 KB each instead of the 2+ GB a real 1B model requires, hiding a credential stealer that exfiltrates stolen secrets through Hugging Face itself, according to the investigation. The first set of stolen secrets belonged to the attacker: an autonomous AI agent called ARTEX that built the model, tested it on itself, and published its own keys, then kept adapting its packaging over the next five hours while the payload stayed the same. Hugging Face has disabled every repo in the campaign following the report. On the morning of November 24, a brand-new Hugging Face account published a model called llama-3.2-1b-tuned . The model card promised a fine-tuned 1B instruct model. The files told a different story: every .bin was about 2.5 KB, while a real 1B model weighs more than two gigabytes. What we found inside was a credential stealer with three different ways to run, which sends its loot out through Hugging Face itself. But the most interesting part was not the malware. It was the first set of stolen secrets, which turned out to belong to the attacker: an autonomous AI agent called ARTEX that built the model, tested it on itself, and published its own keys in the process. Over the next five hours the same agent kept adapting its packaging to slip past detection, while the payload underneath stayed the same. Following our report, Hugging Face has disabled every repo in the campaign. This post follows the investigation one question at a time. What is hiding in a 2.5 KB Llama? what-is-hiding-in-a-25-kb-llama The account behind the model, hfusr5488184 display name "Li Wei" , was created at 02:43:52 UTC , 22 minutes before the repo. It belongs to a one-member organization called probeorg9x7y2 "Probe Org" , and its model card is a single line: llama-3.2-1b-tuned Fine-tuned 1B instruct model merge of sft + dpo . The repo as Hugging Face showed it before it was disabled: under akashdutta1030 , with commits still signed "Li Wei" and both loot files in plain sight. Hugging Face's scanner flags only the two pickle files as unsafe. The Python modules and the chat template show no warning at all. Without real weights, the files are clearly not there to run inference. They are there to run code. The first hint is in config.json , where auto map sends AutoConfig , AutoModel and AutoModelForCausalLM to attacker-supplied Python files: Anyone who calls from pretrained ..., trust remote code=True on this repo imports configuration evil.py before a single tensor is read. And that is only the first of three doors into the same room. The same payload also sits inside both .bin files as a malicious pickle, and the chat template tries a third way in through Jinja. So what does the payload actually do once one of those doors opens? What happens when you load it? what-happens-when-you-load-it The moment the module is imported, it collects everything a cloud or ML workload tends to keep within reach. It reads the environment of the container's first process /proc/1/environ , often richer than the current process's own , its own environment, and the Kubernetes service-account token and namespace if they exist. It then runs a short round of reconnaissance: who it is running as, which processes are alive, what is mounted, how traffic is routed, and whether the host has GPUs. Under the hood: the collector loot reads eight files and runs seven commands, including nvidia-smi -L to fingerprint GPU hosts. The result is one JSON object, about 16 KB on a typical container. The pickle door delivers the exact same code. pytorch model.bin is a malicious pickle whose only job is GLOBAL builtin exec followed by REDUCE over the payload source. The chat template takes a different approach: it tries four classic Jinja sandbox escapes to run id , env and cat /proc/1/environ and render the output straight into the prompt. Under the hood: the pickle and template doors The final pytorch model.bin uses PyTorch's pre-1.6 legacy serialization : several pickles back to back the magic number 0x1950a86a20f9469cfc6c , protocol version 1001 , a sys info dict and then the malicious one. A ZIP-format copy sits next to it as pytorch model zip.bin . Both formats are blocked by torch.load weights only=True , the default since PyTorch 2.6. They still work against older stacks, code that passes weights only=False , and anything that calls pickle.load directly. pytorch model zip.bin is not a name transformers loads by itself, which hints at a target that loads every .bin in a repo. transformers renders chat templates in ImmutableSandboxedEnvironment , which blocks these escapes. Inference servers that render templates with plain Jinja do not. Collecting secrets is the easy part, though. Getting them out of a locked-down ML environment is harder. So where does the loot go? Where does the stolen data go? where-does-the-stolen-data-go Back to Hugging Face. The payload base64-encodes the collected JSON and commits it, as a new file called loot-