AI news, problem solutions & tool picks
DigestX

Problem Solutions

Five poisoned GGUF models on Hugging Face downloaded 2,428 times — check yours before you run one

· 4 min read

Photo via Pexels

A scan of all 3,273,389 public model repositories on Hugging Face, run on November 26, found five malicious GGUF models. They had been downloaded 2,428 times by November 27. Security researcher Root0ne published the findings that day through Malspark, together with a free scanner called gguf-radar. The models look ordinary. The poison is in two places most users never inspect: the chat template, and the bytes after the last tensor.

How the attack works

Every GGUF file carries a chat template — a small Jinja2 program stored under the metadata key tokenizer.chat_template. The runtime applies it to every prompt before the model reads it. Chat template poisoning abuses that template: the model answers normally, while the template quietly adds instructions the user never sees.

The second trick is specific to GGUF. Runtimes such as llama.cpp and LM Studio read only the byte ranges the file header points to. Bytes appended after the last tensor are never read, and no runtime warns about them. An attacker can park a whole Windows program there, and the model still loads and runs exactly as expected. Safetensors loaders, by contrast, refuse a file whose declared tensors do not fill it exactly — one reason the format is safer for downloads.

The two campaigns

Malspark names two operator clusters. The first, Mir2k, uploaded two 'uncensored' models on November 22 and 24: Huihui-Qwen3.5-9B-abliterated-GGUF (1,488 downloads) and Inkling-2-Mini-Uncensored-GGUF (458 downloads). Both carried a Windows remote access trojan named 'ollie' hidden after the last tensor — once as a plain program padded with about half a megabyte of filler, once compressed with raw Deflate so no file signature survives. On November 26, Mir2k rewrote both templates so the model opens every reply with a single PowerShell line. That line finds the largest .gguf file in the user profile, reads its last bytes, writes them to %TEMP%\d.exe and starts it.

The trojan itself is 11.47 MB, most of it a bundled Tor client that carries traffic to an onion service run by the operator. Malspark's static analysis says it exits if it detects VirtualBox, VMware or Sandboxie drivers, and persists through a scheduled task that runs every 10 minutes, two watchdog processes and registry keys.

The second cluster, timdedid, published three byte-identical copies of a Qwen3 1.7B model aimed at security users on November 21 and 22, plus a mirror on Ollama. Their downloads were smaller — 271, 136 and 75 — but their target is different: agents. A trigger phrase in the user's message makes the template insert a fake [SYSTEM DIRECTIVE] that orders an agent with shell access to download and run a script. The attack does not need the user to copy anything. It needs an agent that follows instructions from the conversation.

What happened after disclosure

Hugging Face has since disabled all five repositories, citing a breach of its content policy, and neither account shows any public model. But the counters kept rising until the takedown: together they read 2,807 downloads when checked on November 28, or 379 more than in the Malspark report. And when checked on Saturday, a copy of one model was still on Ollama's public library with its trap intact. Hugging Face counts downloads, not people, so the number of affected users is lower than or equal to the download count — but every download is a file sitting on someone's disk.

Check your downloads before you run one

The fix is a scan before you load. gguf-radar, the open-source tool Malspark released with the report, detects hostile templates and hidden bytes without running anything, and rebuilds a clean GGUF file with the model weights unchanged. Run it on any GGUF file you downloaded from Hugging Face or Ollama before you load it into llama.cpp, LM Studio or an agent harness.

If one of these models was downloaded, check your endpoints against the indicators in the report — Malspark publishes indicators, YARA rules and a MITRE mapping — and scan local .gguf files with gguf-radar. Never run a PowerShell line a model prints, and never pipe a line a model outputs into a shell. That is the exact step the Mir2k trap depends on: the model hands you the command, and you run it.

Prefer Safetensors builds where they exist, and treat models from new or unverified accounts with suspicion — Mir2k was a new account with French traces in its model card, system prompt, commit messages and malware strings. A model file is code that runs on your machine, even when it looks like weights.

Why agents are the real target

The timdedid campaign is the part that matters most for anyone running coding agents. A poisoned AGENTS.md file hijacks an agent through instructions in the workspace — a risk this site covered before. A poisoned model file goes one level deeper: the instructions come from the model itself, inside the conversation, where the agent is trained to trust them. An agent with shell access that follows a fake system directive will download and run a script without asking.

The two attacks share one lesson. The supply chain for local models is the file itself. Check it before you run it, the same way you would check a binary from an unknown publisher — because that is what it is.