· 7 min read

Five GGUF Models on Hugging Face Carried a Hidden Windows RAT and Were Downloaded 2,428 Times. The Trigger Is the Chat Template. Here Is the Check I'd Run Before Loading a Random Quant.

A security researcher publishing as Malspark scanned 3,273,389 public Hugging Face model repositories on November 26 and found five GGUF models built to get malware onto Windows machines. By November 27 those five had 2,428 downloads between them, and according to the post all five were still online. The trick does not exploit llama.cpp or Ollama. It uses a part of the model file most of us never read: the chat template.

A GGUF file ships a small program

Every GGUF file carries metadata, and one key in it, tokenizer.chat_template, holds a Jinja2 template. Your runtime runs that template on every prompt to wrap your messages in the format the model expects. It is text processing, and in C++ runtimes it runs in a restricted engine with no path to the operating system.

The template can still add words. A malicious one can insert a system message you never wrote, and the model will follow it like any other system prompt. That is the whole attack surface, and it turned out to be enough.

The two campaigns

The post describes two actors.

The first, under the account timdedid, uploaded three copies of a small Qwen3 model. When your latest message contains the words "What is," the template injects a fake system directive telling an agent with a PowerShell tool to download a script from a WordPress site and run it hidden. The researcher could not recover the second stage, so what it does is unknown.

The second, under Mir2k, is the nastier design. Two "abliterated" and "uncensored" models (one Qwen, one Inkling 2 Mini) carry an executable appended after the last tensor in the file. GGUF loaders only read the byte ranges the header points to, so the extra bytes are ignored and nothing warns you. On November 26 the template was changed to make the model begin every reply with a single PowerShell line. That line finds the .gguf on disk, reads the hidden bytes and writes them out as an .exe in your temp folder.

The payload, per the post's static analysis, is an 11.47 MB Windows program that bundles Tor, sets up persistence, steals saved passwords from Chrome, Edge and Brave, targets Phantom and MetaMask wallets, and mines Monero when the machine is idle. The two Mir2k models account for 1,946 of the 2,428 downloads.

Loading the model is not the infection

This matters, and the post's own headline blurs it. The title says "2400+ victims." The body says 2,428 downloads and notes that Hugging Face counts downloads, not people, so the number of affected users is that or lower. Nothing in the post shows how many people ran the command.

Nothing executes when you load these files. In the Mir2k case a person has to copy a PowerShell line out of a chat reply and run it. Commenters on Hacker News made the same point: chatting with a random model in a plain chat window is not dangerous by itself.

I'd still take it seriously, for two reasons. People who download "uncensored" coding models are often asking the model how to do something and pasting what comes back. And the timdedid variant does not need a person at all. If the model sits behind an agent with a shell tool and auto-approve turned on, the agent is the one who runs the command.

The checks I'd add

This is a single-source report, and the scanner comes from the same author as the research, so treat the tool's claims as self-reported. The checks below hold up either way.

Look at who uploaded it. All five malicious repos came from two accounts, and the names imitate popular fine-tunes. I'd pull quants from the original model author or a long-standing quantizer account, and I'd be most careful with the "abliterated" and "uncensored" category, where demand outruns trusted supply.

Read the template. Hugging Face shows the chat template in the model's file viewer. A legitimate template is role markers and loops. If you see PowerShell, a URL, a block of instructions or text in a language unrelated to the model, close the tab.

Pin your own template. llama.cpp can ignore the embedded template and use a file you reviewed:

llama-cli -m model.gguf --chat-template-file verified_qwen3.jinja

In Ollama, a TEMPLATE block in your Modelfile does the same job.

Scan the file. The researcher released gguf-radar under the MIT license. It parses the template without running it and reports bytes after the last tensor. The post shows these commands (see the repo's README for installation):

gguf-radar scan ./model.gguf
gguf-radar scan https://huggingface.co/owner/model
gguf-radar sanitize suspicious.gguf -o clean.gguf

Keep shell tools away from unvetted models. If you are trying a new local model inside a coding agent, turn off auto-approve for commands until you have run it for a while. Better, run it in a container or VM with no credentials mounted.

The honest take

Five bad files out of 226,310 GGUF repositories is a tiny rate, and this campaign only works on Windows. If you run local models on a Mac through a chat UI and never paste commands blind, your exposure to this specific attack is close to zero.

What I'd change is the assumption underneath. I used to think of a GGUF as data: big, inert, safe to pull from anyone. It is data plus a template that speaks in the system role, and that template can be edited after you first reviewed the repo, which is exactly what Mir2k did four days after upload. So I'd pin templates for any model that touches an agent, pull from accounts with history, and treat any command a model volunteers without being asked as hostile until I have read it line by line.

Author

Sources

Newsletter

The week, in one email.

The weekly summary of what happened and what it means for people who build alone. No spam, unsubscribe any time.

Form not showing? Subscribe on this page instead.

Related Posts