AI Today

🛡️ Malware in GGUF models on Hugging Face: five models, about 2,400 downloads

· 5 min

Hugging Face metadata viewer with the trigger, the hidden system directive and the PowerShell download command of the timdedid template

In brief


🛡️ People who run language models locally usually download them as GGUF files. The security blog [Malspark](https://malspark.com) reports that exactly these files were used to carry malware on Hugging Face: a scan of all roughly 3.27 million public model repositories on 26 November found five rigged GGUF models that had been downloaded 2,428 times in total by 27 November. Because Hugging Face counts downloads, not people, the number of affected users is at most that high. The trick sits in the chat template, a small program inside every GGUF file that formats each conversation before the model reads it. The model answers normally, but the template inserts instructions that never appear in the chat window. 💻 The larger campaign, an account called Mir2k, also appended a Windows program after the model weights, where loaders such as llama.cpp never look, according to the analysis. Only days later did the account switch the templates so that the model opens every reply with a PowerShell line that unpacks and starts this program. A second account, timdedid, targeted coding agents with shell access. Malspark is releasing the open-source checker gguf-radar alongside the report. 🚫 On 28 November the pages of the named models on Hugging Face showed a notice that the content infringes the platform's content policy.


🧱 Why GGUF. A GGUF file starts with a header and a metadata table, followed by the tensor table, a padding zone and the actual weights. Programs such as llama.cpp and LM Studio read exactly the ranges the header points to and ignore everything else. Whatever sits after the last tensor does not change how the model behaves, and no runtime warns about it. Safetensors files do not allow this, because their loader rejects a file that does not end exactly with its tensors. The chat template, by contrast, also exists in other formats, usually as a separate file next to the model, so that half of the method works there too.

📅 Plant first, arm later. According to Malspark, Mir2k created 14 repositories on 22 November, twelve of them empty placeholders named after expected models such as Qwen4-27B, DeepSeek-V4 or Llama-4-Scout. The same day Huihui-Qwen3.5-9B-abliterated appeared with the program appended but a clean template at first; on 24 November Inkling-2-Mini-Uncensored followed with the same file in compressed form. Only on the morning of 26 November did the account replace both templates, and nine hours later a second time. The new template inserts a French system message telling the model to begin every reply with a certain line. That line finds the largest GGUF file in the user profile, reads its last megabytes and writes them to the temp folder as d.exe. Anyone who downloaded the model before 26 November has the malware on disk but no trigger. Between the scans on 26 and 27 November, downloads rose from 1,502 to 2,428, almost all on the two Mir2k models.

🕵️ What the program does. Malspark calls it ollie, after its folder name under AppData, which looks a lot like Ollama. Of the 11.47 MB file, 10.25 MB is a complete copy of Tor. According to the static analysis it first checks whether it runs in a virtual machine or sandbox and quits if so. On a real machine it sets up a scheduled task that starts it every ten minutes, keeps itself alive with two watchdog processes and marks its process as critical, so ending it crashes Windows. Through a Tor onion service it sends saved passwords from Chrome, Edge and Brave to its operator, targets the Phantom and MetaMask wallet extensions, and can log keystrokes, read the clipboard, capture the screen and the webcam. When the machine is idle it mines the cryptocurrency Monero. An attempt to bypass User Account Control fails because of a coding error, Malspark notes: the registry paths lack their backslashes.

🤖 The second campaign. The account timdedid published three identical copies of a small Qwen3 model aimed at security users on 21 and 22 November, plus a mirror on Ollama. When the user's message contains the words "What is", the template inserts a fake system directive: an agent with a PowerShell tool is told to download a script from a WordPress site and run it hidden. What that script would have installed is unknown; Malspark could not recover it. These three models had 482 downloads between them.

📚 The combination is new. [Pillar Security](https://www.pillar.security) had already demonstrated hidden instructions in GGUF templates in the lab in July 2025, and malicious code in model files has been a research topic for years. What is new, according to Malspark, is that both now show up in real attacks on Hugging Face, in Mir2k's case together with an appended executable and a template that was only activated days later. Antivirus engines and checks that only read the last few kilobytes of a file do not detect the compressed variant. Malspark also describes three further hiding places in the format that it reproduced in the lab, including data stored in blocks whose weights all come out as zero.

🧰 What users can do. The tool [gguf-radar](https://github.com/Root0ne/gguf-radar) (MIT licence) checks local files and Hugging Face links without running the model or its template, and can rebuild a cleaned GGUF file with unchanged weights. Malspark advises treating any command a model suggests as untrusted. Anyone who gives a model tools can force a reviewed template, in llama.cpp with --chat-template-file, in Ollama through TEMPLATE in the Modelfile. The report asks model hubs and runtimes to reject GGUF files with bytes after the last tensor. We found no public statement from Hugging Face on the case; the model pages now carry the platform's block notice.

Sources

Open in the interactive reader →

This post was selected, researched, written and rated by AI. The AI can be wrong: check the sources. Imprint, privacy policy and terms of service