AI

Hugging Face GGUF malware: how to check your local models

Key takeaways

  • A scan of 3,273,389 public Hugging Face repositories found five malicious GGUF models with 2,428 downloads
  • The Mir2k campaign hides a Windows remote access trojan after the last tensor and arms the chat template days later
  • Scan every local .gguf file with gguf-radar and treat any hit as a possible endpoint compromise

After reading this, you will be able to check every local GGUF model file on a machine for hidden executables and poisoned chat templates, and know what to do if one turns up.

A scan published on Malspark's blog covered all 3,273,389 public Hugging Face model repositories on 26 November 2026 and found five malicious GGUF models, downloaded 2,428 times as of 27 November. Hugging Face counts downloads, not people, so the number of affected users is lower or equal. The largest campaign, run by an account called Mir2k, hid a Windows remote access trojan named ollie at the end of two "uncensored" model files. Difficulty: moderate.

What you need before starting

  • A list of the machines where anyone has downloaded GGUF files, including developer laptops and any server running llama.cpp or LM Studio.
  • Access to the open-source tool gguf-radar, which Malspark says detects poisoned templates and hidden bytes without running anything and can rebuild a clean GGUF file with the weights unchanged.
  • The indicators of compromise (file hashes, YARA rules) published in Section 7.2 of the Malspark post.
  • Endpoint logging or EDR that can search for scheduled tasks and files in %TEMP%.
  • Administrator rights, and ideally a spare machine for any file you want to examine further.

The tool costs nothing. The main expense is time.

Step-by-step process

Step 1: Inventory your GGUF files

Search every user profile for *.gguf. Note the repository each came from, the uploader and the download date. The Mir2k timeline matters here: Huihui-Qwen3.5-9B-abliterated was uploaded on 22 November 2026 and Inkling-2-Mini-Uncensored on 24 November, both with the payload already appended but with a clean template. The templates were armed on 26 November. Files downloaded earlier contain the payload but not the trigger, so a clean template today does not mean a clean file.

Step 2: Scan with gguf-radar

Run gguf-radar across the folders from step 1. It looks for two things: suspicious chat templates and bytes sitting after the last tensor. Do not rely on antivirus alone. Malspark says antivirus engines and checks that read only the last few kilobytes of a file do not see the compressed payload. The first Mir2k model pads its executable with about half a megabyte of filler; the second compresses it with raw Deflate, which strips recognisable file signatures.

Step 3: Read the templates yourself

For any model you intend to keep, inspect the tokenizer.chat_template metadata key. Red flags are a system message telling the model to begin every reply with a command, anything mentioning PowerShell, or a hidden "[SYSTEM DIRECTIVE]" that fires on a trigger phrase, the pattern seen in the timdedid models. Safetensors and PyTorch models carry the same kind of template in tokenizer_config.json or chat_template.jinja, so check those too.

Step 4: Hunt for ollie on endpoints

Search for the indicators in Section 7.2. Look for a d.exe in %TEMP%, a scheduled task that runs every 10 minutes with highest privileges, and two watchdog processes. Malspark's static analysis found that ollie bundles Tor 0.4.9.16, checks for VirtualBox, VMware and Sandboxie drivers, and marks its own process as critical, so killing it crashes Windows.

Step 5: Respond to a hit

Isolate the machine first. Follow your incident process rather than improvising; the NCSC's incident management guidance is a sound template.

Common mistakes to avoid

  • Assuming a clean template means a clean model. The payload was planted days before the trigger. Scan the file bytes, not only the metadata.
  • Trusting a tail check. Scanners that read only the last few kilobytes miss padded and compressed payloads.
  • Copying the first line a model prints. The armed Mir2k template tells the model to open every answer with a PowerShell line, which reads the last bytes of the largest .gguf file in the user profile and writes them to %TEMP%\d.exe. A user pasting that line runs the malware.
  • Killing the process on a live host. The critical-process flag turns that into a Windows crash.
  • Dismissing the numbers as small. Downloads rose from 1,502 on 26 November to 2,428 the next day, almost entirely on the two Mir2k models.

Tips that make a difference

  • Take extra care with "uncensored" and "abliterated" community re-uploads. Both Mir2k uploads were of that kind.
  • Sandbox agents. The timdedid template targets agents with shell access, so run any tool-calling model without shell rights unless you need them.
  • Use the rebuild function to keep a model you trust but cannot re-download; the weights are unchanged.
  • Log which template version each model shipped with. Mir2k replaced its templates twice on 26 November, about nine hours apart.

UK and compliance angle

For UK organisations, a developer machine compromised through a model file is an ordinary endpoint incident with ordinary obligations. The NCSC's AI and cyber security guidance and its secure AI development guidelines cover supply-chain risk in AI components.

The pattern echoes other attacks that target AI tooling rather than classic software, such as the hidden commands found in website headers aimed at AI agents, and the audit approach in prompt adware: how to audit AI agents for hidden instructions applies to templates too.

The method is not new in pieces: Pillar Security showed hidden instructions in GGUF chat templates in July 2025, and EvilModel hid malware in model weights in 2021. What Malspark reports is the combination in live attacks: an executable after the last tensor, with the template switched on later. No earlier public report of that combination was found.

Next steps

Add model provenance to your software inventory, restrict who may pull models from public hubs, and run gguf-radar as a gate before any model reaches a shared machine. Watch for further sweeps of Hugging Face, since twelve empty placeholder repositories are waiting to be filled.

Summary

You now have a repeatable check: inventory GGUF files, scan bytes and templates with gguf-radar, hunt for ollie indicators, and contain any hit before rebuilding.

Frequently asked questions

What is chat template poisoning?

It abuses the Jinja2 template stored in a GGUF file under tokenizer.chat_template. The model answers normally while the template quietly adds instructions the user never sees, such as telling an agent to run a PowerShell command.

Can a GGUF file hide malware?

Yes. Anything appended after the last tensor is never read by runtimes such as llama.cpp and LM Studio, so an executable can sit there unnoticed. Safetensors files refuse to load if declared tensors do not fill the file exactly.

How many malicious models were found on Hugging Face?

A scan of all 3,273,389 public repositories on 26 November 2026 found five malicious GGUF models. They had 2,428 downloads as of 27 November, though downloads are not the same as unique users.

More from Future Technology HQ