Mir2k: malware hides past the last tensor of GGUF models on Hugging Face
Mir2k is a malware campaign that appends a Windows trojan to GGUF model files on Hugging Face, past the point where loaders stop reading.
· Malspark · Research by Düzgün

Five GGUF models on Hugging Face hid a Windows trojan and poisoned chat templates, and Malspark counted 2,428 downloads by 27 November 2026. All five were still online when the researcher published.
01What happened
Malspark published the campaign on 27 November 2026, after scanning 3,273,389 public Hugging Face model repositories the day before. The researcher, who publishes as Düzgün, found five malicious GGUF repositories across two campaigns, Mir2k and timdedid, with 2,428 downloads in total. All five were still online at publication.
02How it works
Chat template poisoning is the mechanism: the Jinja2 template that formats every prompt is rewritten to add hidden instructions the chat window never shows. Mir2k also appends an 11.47 MB Windows executable after the last tensor of each GGUF file, a region llama.cpp and LM Studio never read, then switched both templates on 26 November so the model opens each reply with a PowerShell command that extracts and runs it. The timdedid templates instead fire when a user message contains the words What is, and tell an agent with shell access to fetch and run a script from a WordPress site.
03Who is affected
Anyone who pulled one of the five repositories listed below is exposed, and Malspark reports the Mir2k payload runs on Windows only. The write-up names llama.cpp, LM Studio and Ollama as the runtimes involved, including an Ollama mirror of one timdedid model. Download counts record pulls rather than people, so 2,428 is an upper bound on how many are affected.
04What to do
Treat any command a community model prints as untrusted, and do not paste it into a shell. Malspark recommends pinning a reviewed template with --chat-template-file in llama.cpp or TEMPLATE in an Ollama Modelfile, and scanning models with its open-source gguf-radar before they reach a registry or a developer machine. Rotate browser-stored and wallet credentials on any Windows machine that ran a Mir2k model.
Questions people ask
- Am I affected if I downloaded an uncensored GGUF model from Hugging Face?
- Only five repositories were malicious in Malspark's scan, and all five are named in the table on this page. Downloading a file is not enough on its own: the Mir2k payload runs when someone executes the PowerShell command the poisoned template makes the model print. Check your model directory against the five names and against the YARA rules Malspark publishes.
- Does antivirus detect the Mir2k payload inside a GGUF file?
- Malspark reports that antivirus engines and pickle scanners did not flag the live Mir2k files in its tests. Pickle scanners look for Python deserialization tricks, which GGUF does not use, and the executable sits in trailing bytes after the last tensor that normal loaders skip. Malspark released gguf-radar, an MIT-licensed Python scanner, to check both the trailing bytes and the template.
- How do I pin a safe chat template in llama.cpp or Ollama?
- Malspark recommends supplying your own reviewed template instead of the one shipped inside the model file. In llama.cpp that means passing --chat-template-file with a template you control, and in Ollama it means setting TEMPLATE in a Modelfile. Pinning a template removes the hidden-instruction path, though it does not remove an executable already appended to the GGUF file.
- Did Hugging Face remove the malicious GGUF repositories?
- Malspark does not say whether Hugging Face removed the five repositories or responded to the report. The write-up states only that all five were still online on 27 November 2026, and that the download total grew by more than half in the single day before publication. Treat the repositories as live until the hub confirms otherwise.
- What does the Mir2k trojan do once it runs on Windows?
- Malspark describes ollie as a remote access trojan that checks for virtual machines and analysis tools before continuing, persists through a scheduled task, watchdog processes and registry keys, and reaches its operator over a Tor onion channel. The researcher reports it steals saved browser passwords, targets the Phantom and MetaMask wallet extensions, supports keylogging and screen capture, and mines Monero while the machine is idle.
Sources 3 links, all fetched
- 1malspark.comMalspark Write-Up
- 2github.comGGUF Radar
- 3github.comGGUF Radar v0.1.0