Poisoned GGUF models on Hugging Face hid a password-stealing trojan and targeted AI agents


On this page
A security researcher scanned every public model repository on Hugging Face and found five that were built to infect the people, or the AI agents, using them. Düzgün, the researcher behind Malspark, scanned 3,273,389 repositories on 26 November and published the results on 27 November. The five came from two accounts, Mir2k and timdedid, and had been downloaded 2,428 times. Hugging Face counts downloads, not people, so the number of affected users is at most that.
All five are GGUF files, the format most people use to run models locally with tools such as llama.cpp, LM Studio and Ollama. Both campaigns abused the chat template, a small program inside the file that the runtime applies to every conversation. The model still answers normally, so nothing looks wrong.
Campaign 1: Mir2k hid a trojan in the model file
A GGUF file’s header says exactly where the model data ends. Runtimes read only that far, so anything appended after the last tensor is never loaded and never triggers a warning. Mir2k used that gap to carry a whole Windows program.
The account uploaded Huihui-Qwen3.5-9B-abliterated-GGUF on 22 November and Inkling-2-Mini-Uncensored-GGUF on 24 November, both with the program already inside and with clean templates. On 26 November it rewrote both templates, then rewrote them again nine hours later. The new templates add a hidden system message, in French, telling the model to open every reply with one PowerShell line.
That line doesn’t run by itself. A user has to copy and run it. If they
do, it finds the largest .gguf file in their profile, reads the hidden
bytes from its end, writes them to %TEMP%\d.exe and starts the program.
The second model carried the same program compressed, so it had no
recognisable file signature.
Mir2k also created 12 empty repositories on 22 November, named after
expected releases such as Qwen4-27B, DeepSeek-V4 and gemma-4-27b,
apparently ready to be filled when those models appear.
What ollie does
The program, called ollie, is an 11.47 MB Windows remote access trojan. Most of that is a bundled copy of Tor. According to Malspark’s analysis, it:
- exits if it detects VirtualBox, VMware or Sandboxie, or usernames such as “sandbox” or “malware”;
- runs every 10 minutes from a scheduled task, with two watchdog processes;
- marks its process as critical, so killing it crashes Windows;
- sends saved passwords from Chrome, Edge and Brave to its operator over a Tor onion service, though it can’t decrypt Chrome’s newer app-bound encrypted entries;
- targets the Phantom and MetaMask wallet extensions;
- logs keystrokes and the clipboard, takes screenshots, streams the screen and captures the webcam;
- mines Monero over Tor when the machine is idle.
It keeps its files in a folder named ollie under AppData\Roaming,
close enough to Ollama to look familiar.
Campaign 2: timdedid aimed at coding agents
The timdedid account published three identical copies of a small Qwen3
1.7B model on 21 and 22 November, aimed at security users, plus an Ollama
mirror called timdedid/qwen3-1.7b-cyber. Each template is the official
Qwen3 template with one addition. When a user’s message contains “What is”,
it inserts a fake [SYSTEM DIRECTIVE] telling an agent to use its
PowerShell tool to download a script, value.ps1, and run it in a hidden
window. The model card even advises users not to replace the built-in
template.
This attack needs no human to run anything if the model is driving an agent with shell access. Malspark couldn’t recover the script, so what it would have installed is unknown.
Where things stand
When we checked on 2 December, Hugging Face’s API listed all five
repositories as disabled. The Ollama mirror timdedid/qwen3-1.7b-cyber was still available, showing 477 downloads. We haven’t inspected its
template.
Neither technique is new on its own. Researchers had shown poisoned chat templates and malware hidden in model weights in lab settings. Malspark says it found no earlier public report of them in real attacks on Hugging Face, or of a payload appended to a model and armed by a template days later. It released gguf-radar, an open-source tool that checks templates and hidden bytes without running the model, and can rebuild a clean file with the weights unchanged.
What to do
- Search your model folders for the five repositories above and the
timdedid/qwen3-1.7b-cyberOllama model, and delete any copies. - Scan local
.gguffiles with gguf-radar, for examplegguf-radar scan ./model.gguf. Malspark says antivirus tools and checks that read only the end of a file miss the compressed payload. - Never paste a command that a local model suggests without reading it.
- For agents with tool access, use a template you’ve reviewed instead of
the embedded one:
--chat-template-filein llama.cpp, orTEMPLATEin an Ollama Modelfile. Require approval before an agent runs shell commands. - If a machine ran the PowerShell line, look for
%TEMP%\d.exeand anolliefolder underAppData\Roaming. Isolate the machine and rebuild it rather than killing the process. - From a clean device, change the passwords saved in Chrome, Edge and Brave, and move any funds in Phantom or MetaMask to a new wallet.
- Block
technoarteng[.]com, the download domain in Malspark’s YARA rule for the timdedid templates, and load Malspark’s YARA rules into your scanning tools.