Hugging Face Malware Campaign Leaks Its AI Operator

A new case of Hugging Face malware shows an AI agent making a very human mistake. On the morning of Nov. 24, a freshly created account posted a model named llama-3.2-1b-tuned. Its card promised a fine-tuned 1B instruct model, but every .bin file weighed about 2.5 KB, where a real model of that size runs past two gigabytes. Inside was a credential stealer, and the first secrets it collected belonged to its own author.

A model with no weights

The account, hfusr5488184 with the display name “Li Wei,” was created at 02:43:52 UTC, 22 minutes before the repo went up. It belongs to a one-member organization called probeorg9x7y2. The model card is a single line.

The files were built to run code, not inference. In config.json, the auto_map entry points AutoConfig, AutoModel and AutoModelForCausalLM at attacker-supplied Python. Anyone loading the repo with trust_remote_code=True imports configuration_evil.py before any tensor is read.

The repository's file listing on Hugging Face, after the account rename
Image: research.jfrog.com

Three entry points

Loading the repo with trust_remote_code=True was the first trigger, but the same code was planted in two more places.

  • Remote code: Python modules referenced in the config run as soon as they are imported.
  • Pickle files: both .bin files contain a pickle that calls exec on the payload. PyTorch’s default since 2.6, torch.load(weights_only=True), refuses them. Older stacks and code that sets weights_only=False do not.
  • Chat template: it tries four known Jinja sandbox escapes to run id, env and cat /proc/1/environ. The transformers library renders templates in a sandbox that stops this, but inference servers using plain Jinja would not.

Only the two pickle files tripped Hugging Face’s scanner. The Python modules and the template passed without a warning.

config.json auto_map
Image: research.jfrog.com

What it collects

On import, the payload gathers what cloud and ML workloads keep nearby: the environment of the container’s first process, its own environment, and any Kubernetes service-account token and namespace. It then runs short reconnaissance to learn who it is, which processes are alive, what is mounted, how traffic is routed and whether the host has GPUs. The result is one JSON object of about 16 KB on a typical container.

loot() collector
Image: research.jfrog.com

Exfiltration through the Hub

There is no outside server in this design. The payload encodes its JSON and writes it as a new file into the attacker’s own repo through the Hub’s commit API, using a write token baked into the code. That is tidy for an attacker. Nothing needs hosting, storage is free and versioned, and the only destination is huggingface.co, which ML environments must reach to fetch models.

It is also the flaw. Because the repo is public, anything it receives is public too.

The victim was the author

The payload first fired 14 seconds after the model files were uploaded, and a 16 KB loot file appeared that no person had pushed. Three seconds later the file was replaced by a one-line test pointing at /app/data/tasks/61/ihfprep2. Soon after, a commit introduced a NOEXFIL switch to silence the payload. Nobody builds a kill switch like that for a real victim.

The loot’s environment variables traced back to the container’s first process, /app/start.sh, which launches a binary named artex. Its process list showed one-line shell commands that write a file, run it and read the output, the pattern of an agent’s shell tool. Two fixes arrived within seventy seconds. Commit messages read like a task log: “legacy torch format payload” and a ticket-style marker, RCE43861. The evidence indicates that ARTEX, an LLM-driven agent, built the model as a work item and tested it on its own host.

Across the next five hours it kept repackaging the files to evade detection while the core payload stayed unchanged.

What to do now

Hugging Face has disabled every repository in the campaign. Teams that load community models should avoid trust_remote_code=True unless they have read the code, keep PyTorch current, use safe weight formats and render chat templates only in sandboxed environments. Anyone who loaded llama-3.2-1b-tuned should rotate every secret on that machine.

Source: research.jfrog.com

Written by

Saksham Bhargava

Saksham Bhargava runs Alteroid and has been writing about consumer technology for over five years, covering iPhone, Android, Windows, AI tools and gaming. With an MCA and six years of hands-on web development experience, he tests the features he writes about on his own devices and focuses on clear, practical guides that solve real problems. Away from the screen, he enjoys travelling to places most tourists skip.