Malware Hidden Inside GGUF Models: How It Works and How to Check Your Machine

A researcher scanned 3.27 million Hugging Face repositories and found five GGUF models carrying malware, downloaded 2,428 times. How it hides, whether you are affected, and what to do now.

Malware Hidden Inside GGUF Models: How It Works and How to Check Your Machine
A researcher scanned 3.27 million Hugging Face repositories and found five GGUF models carrying malware, downloaded 2,428 times. How it hides, whether you are affected, and what to do now.

Malware Hidden Inside GGUF Models: How It Works and How to Check Your Machine

Share:

On November 26, 2026, a security researcher scanned every public model repository on Hugging Face, 3,273,389 of them, and found five GGUF models carrying malware. They had been downloaded 2,428 times before they were removed. The dangerous part was not only the hidden executable: it was the chat template that makes the model itself ask you to run a dangerous command. This guide explains what happened, whether you are affected, and what to do today rather than tomorrow.

What happened

  • Düzgün of Malspark scanned 3,273,389 public Hugging Face repositories on November 26, 2026 and published the findings on November 27.
  • Five GGUF models carried malware, from two separate accounts: Mir2k and timdedid.
  • Combined downloads stood at 2,428 at publication, up from 1,502 at the time of the scan, roughly doubling in a single day.
  • Hugging Face disabled the five repositories after the report, but the counters reached 2,807 before removal. Follow-up coverage found a copy of one timdedid model still listed on Ollama on Saturday morning.

The point to hold on to before the details: this is not a flaw in the GGUF format. These were deliberately tampered uploads, and the format simply allowed the payload to hide.

How malware hides inside a model file

A GGUF file is simple: a header, a metadata table, a tensor table, then the weights. The header says exactly where the model data ends, and runtimes such as llama.cpp and LM Studio read that range and ignore everything after it. Anything appended past the last tensor is never read, never changes how the model behaves, and triggers no warning.

The first campaign used that dead zone: an 11.47 MB Windows executable appended after the last tensor. But a file alone does not run. The second half is the chat template, a small Jinja2 program stored in the metadata as tokenizer.chat_template, which reshapes every conversation before the model sees it. On November 26, both templates were rewritten to add a hidden French system message telling the model to open every reply with a PowerShell line that finds the largest .gguf file in the user's profile, extracts the trailing bytes to %TEMP%\d.exe and runs it.

Notice the order. The model does not execute anything and does not compromise anything. The model prints a line that looks like a setup step, and the user pastes it into a terminal. That is the whole attack: trusting what the model writes.

Two campaigns, two approaches

RepositoryCampaignMethodDownloads (Nov 27)
Mir2k/Huihui-Qwen3.5-9B-abliterated-GGUFMir2kReply prefix, hidden executable1,488
Mir2k/Inkling-2-Mini-Uncensored-GGUFMir2kReply prefix, compressed executable458
timdedid/qwen3.8-cyber-uncensoredtimdedidAgent tool hijack271
timdedid/qwen3-cyber-UNCENSORED-2timdedidAgent tool hijack136
timdedid/qwen3-cyber-UNCENSOREDtimdedidAgent tool hijack75

The Mir2k account was patient. On November 22 it created 14 repositories, twelve of them empty placeholders named after models that have not been released, such as Qwen4-27B and DeepSeek-V4, ready to be filled later. The two live models went up on November 22 and 24 with the executable in place but a clean template. The templates were switched on November 26, so the payload sat dormant for days before it was armed.

The timdedid campaign needed no hidden executable at all: three copies of a 1.7B Qwen3 model aimed at security users, with the official Qwen3 template plus one addition. If a user message contains the words "What is", the template inserts a fake [SYSTEM DIRECTIVE] ordering an agent to use its powershell tool to download a script from a WordPress site and run it in a hidden window. The second stage was never recovered, which is exactly the problem: it could be anything.

Why antivirus did not stop it

According to the Malspark report, antivirus engines and pickle scanners did not flag the live files. That makes sense: pickle scanners look for Python deserialization tricks, which GGUF does not use, and the executable sits in trailing bytes that normal loaders skip. A file that behaves perfectly normally can carry something nobody looks at.

Are you affected?

  1. Are you on Windows? The Mir2k payload runs on Windows only.
  2. Did you download one of the five repositories in the table? The repository names are the test, not the word "uncensored" on its own.
  3. Did a chat ever print a PowerShell line asking you to copy and run it? That is the signature of the armed template.
  4. Do you run an agent with shell access? That moves the risk from "a suspicious file" to "automatic execution".

Keep the nuance: downloads made before November 26 contain the payload but not the trigger, so the real risk starts from that date. And 2,428 counts downloads, not people, so the number of affected users is likely lower.

What to do if you downloaded one

  1. Disconnect the machine from the network if you think you ran the file, and stop using the model.
  2. Scan your model folder with gguf-radar, the open-source tool released with the research. It inspects templates and hidden bytes without executing anything and can rebuild a clean file with the weights unchanged.
  3. Treat a flag as a prompt to inspect, not proof of infection: early users reported false positives on legitimate files.
  4. Rotate credentials stored in Chrome, Edge and Brave on any Windows machine that ran a Mir2k model, and move funds out of Phantom and MetaMask wallets on that machine.
  5. Look for persistence: the payload registers a scheduled task that runs every ten minutes, two watchdog processes, and a folder named ollie under AppData\Roaming.
  6. Check mirrors too: one model was still listed on Ollama, so Hugging Face is not the only place to look.

How to protect yourself from now on

  • Pin your own template: in llama.cpp use --chat-template-file with a template you reviewed; in Ollama set TEMPLATE in a Modelfile. That closes the hidden-instruction path, though it does not remove an executable appended to the file.
  • Never run a command a model prints. Make it a hard rule: text inside a model reply is untrusted content, even when it looks like an innocent install step.
  • Prefer known publishers, and be wary of new accounts uploading "uncensored" models named after releases that do not exist yet. That is exactly the Mir2k pattern.
  • Scan before use. A model is downloaded once and used for months; the scan takes a minute.
  • Reduce agent permissions. An agent with an unrestricted shell turns any hidden instruction into an executed command.

The lesson for anyone building with AI

This is not only about running models on your laptop. If you build an agent connected to your tools, or give an assistant permission to run commands or read files, a tampered chat template can steer that agent. The practical rule: give agents the least permission they need, and put a human approval step in front of dangerous actions. Our guide to Chrome DevTools for agents (MCP) and the article on AI agents and business automation cover that setup.

FAQ

Is GGUF unsafe?

No. The format is sound; the attack abuses two legitimate features, trailing bytes that loaders ignore and a chat template that is a small program. The risk is tampered files from unknown accounts, and the same template risk exists in Safetensors and PyTorch models, which store their template in files such as tokenizer_config.json.

I downloaded a model from Hugging Face. Am I compromised?

Very unlikely unless it was one of the five repositories listed. Downloading alone is not enough: the Mir2k payload requires you to paste the PowerShell line the model prints.

Is reinstalling Windows enough?

If you ran the file, a clean reinstall or restoring a clean image is reasonable, but change passwords and wallets first, because the payload steals what is saved in the browser and its extensions.

What should a team admin do?

Inventory which models the team uses and where they came from, block downloads from unverified accounts, scan shared model folders, and write the "never execute a command a model prints" rule into the team policy.

Bottom line

The incident is a reminder that the trust chain in AI does not stop at the model. It runs through the file you download, the template that reads your messages, and the tools you hand your agent. Checking today is far cheaper than cleaning up tomorrow: scan your models, pin your templates, and never paste a model's suggested command into your terminal.

🔗 Sources and tools

⭐ Featured Recommendation

📈 Double Your Site Traffic & Revenue with Featured Backlinks & SEO

Get a pinned Featured Backlink in our directory or a complete SEO audit by NOOR 4 TECH experts to dominate rankings.

Explore Featured Package ⭐
💼 NOOR 4 TECH Professional Services

Looking for a Technical Partner for Your Next Project?

We deliver enterprise web development, mobile apps, technical SEO, and AI automation.

Author

Noor4Tech Team

We are a specialized team in providing the best technical and programming content to help you achieve your digital goals.

Comments (0)

No comments yet. Be the first to comment!

Add Your Comment

Your email will not be published. Comments require review before publishing.