Independent · Updated November 30, 2026 · Every claim traceable
Home › AI Infrastructure › Malicious GGUF models on Hugging Face: what to do no…
AI Infrastructure

Malicious GGUF models on Hugging Face: what to do now

By Yogesh · · 8 min read

Sources checked and dated on publication. See our editorial policy.

Five GGUF model repositories on Hugging Face were carrying malicious chat templates and, in two cases, a Windows remote…

Five GGUF model repositories on Hugging Face were carrying malicious chat templates and, in two cases, a Windows remote access trojan hidden after the last tensor of the model file. Malspark, an open-source malware-analysis project, published the findings on November 27, 2026 after scanning all 3,273,389 public model repositories and parsing 572,184 chat templates statically. The five repos came from two accounts, Mir2k and timdedid, and had recorded 2,428 downloads. All five were disabled by the time On The Wire checked them at 13:09 GMT on November 28. If you run community models locally, this is the day to audit what is already on your disk.

The short answer

How a GGUF file hides a program

A GGUF file has a simple layout: a header, a metadata table, a tensor table, padding up to an alignment boundary, then the model weights. Runtimes such as llama.cpp and LM Studio read exactly the byte ranges the header points to and ignore everything after the end of the data section. That means an attacker can append an entire executable past the last tensor. The loader never reads it, the model behaves identically, and no runtime prints a warning.

Malspark found two variants of this in the wild. The first Mir2k model carries a plain Windows program followed by roughly half a megabyte of filler, so a scanner that inspects only the last few kilobytes sees nothing useful. The second carries the same program compressed with raw Deflate, which removes every recognisable file signature while PowerShell can still decompress it in memory. Safetensors files do not allow this trick, because the safetensors loader refuses a file whose declared tensors do not fill it exactly. That asymmetry is the technical reason this is a GGUF-specific problem.

The second half of the attack uses the chat template, a small Jinja2 program stored under the metadata key tokenizer.chat_template. Before every reply, the runtime passes the conversation through it. The template is invisible in the chat window, so it can add instructions the user never sees. This part is not GGUF-specific: Safetensors and PyTorch models carry the same kind of template, usually in tokenizer_config.json or chat_template.jinja.

Plant first, arm later: how the Mir2k campaign was staged

The timeline is the part worth copying into your own threat model, because it explains how a benign download became a dangerous one without the file ever changing in a way a checksum would reveal to someone who only checked on download day.

The Mir2k account created 14 repositories on November 22, twelve of them empty placeholders named after expected releases such as Qwen4-27B, DeepSeek-V4, Llama-4-Scout and gemma-4-27b. The first model, Huihui-Qwen3.5-9B-abliterated-GGUF, was uploaded with the executable already appended after its last tensor but with its original clean template. A second model, Inkling-2-Mini-Uncensored-GGUF, followed on November 24 with the same executable in compressed form, again with a clean template. For those two to four days the payload sat inert in the files with nothing to start it. On the morning of November 26 both templates were replaced within about an hour, and the new versions instructed the model to begin every answer with a single PowerShell line that reads the hidden bytes back out of the model file and starts them.

The consequence is that a file hash captured on the day you downloaded it may not correspond to the file you are running now. Malspark's own summary is blunt about the recommendation that follows: treat any command a model suggests as untrusted. If you run a community model that is even slightly uncensored, the command it prints may not have come from the model at all.

The second campaign targets coding agents, not people

The timdedid account took a different route and published three byte-identical copies of a small Qwen3 1.7B model aimed at security users, along with an Ollama mirror named timdedid/qwen3-1.7b-cyber. Its template is the official Qwen3 template with one addition near the end. When the user's latest message contains the phrase "What is", the template inserts a [SYSTEM DIRECTIVE] ordering an agent with shell access to call its PowerShell tool, download value.ps1 into C:\Windows\Temp\payload.ps1 and run it in a hidden window. The repository README advises against replacing the embedded template, which keeps the trigger in place.

Unlike the Mir2k payload, the second-stage script was not recovered, so what it would have installed is unknown. That gap matters for anyone doing incident response: you cannot build a blocklist for a payload you have never seen. The realistic defence is structural — an agent that can reach a shell should not be running a model whose template you have not read.

For context on the wider class of local-model supply-chain risk, our guide to the Trojanized Claude Code extension covers a different delivery route with the same lesson, and our NVIDIA RTX Spark desktop guide covers the hardware that makes local inference practical enough to attract this kind of attention.

What the ollie implant actually did

Both Mir2k models unpack to the same 11.47 MB Windows x64 program, which Malspark calls ollie. Most of its size is a complete copy of Tor 0.4.9.16 — 10.25 MB of it — with the miner's own code taking up the remainder. Static analysis shows it checks for VirtualBox, VMware and Sandboxie drivers and for usernames such as sandbox, malware and test, and exits if it finds them. That is standard sandbox evasion, and it is the reason automated scanning environments may report it clean.

On a real machine it installs a scheduled task that runs it every ten minutes with highest privileges, keeps two watchdog processes alive, re-enables itself through StartupApproved registry keys and marks its process as critical so that ending it crashes Windows. It attempts the known fodhelper.exe UAC bypass but the compiled registry paths are malformed, so that route fails. With its foothold established, it writes Tor to disk, starts it on SocksPort 9050 and reaches its operator over an onion service using a ChaCha20 session with a built-in pre-shared key. Through that channel it sends saved passwords from Chrome, Edge and Brave, read through DPAPI, though Chrome's newer v20 App-Bound encrypted entries stay undecrypted. It also targets the Phantom and MetaMask wallet extensions and supports keylogging, clipboard reading, screenshots, screen streaming and webcam capture. When the machine is idle, it mines Monero with RandomX over Tor.

Why antivirus and the Hub's own scanning missed it

Two structural gaps explain why the payload survived. Malspark reports that antivirus engines and pickle scanners gave no alert on the live Mir2k files in its tests — the compressed payload defeats signature matching, and the appended bytes sit outside the model data a GGUF parser inspects. On the Hub side, Hugging Face's own documentation says it runs every repository file smaller than 2 GB through a malware scanner, and On The Wire notes the two Mir2k files were listed at 6.67 GB and 17.5 GB, comfortably above that line.

This is the pattern worth internalising for anyone running a private model registry. File-size thresholds, extension filters and signature scanners all fail against a payload that is deliberately shaped to look like model data. Structure-aware checks are the only thing that catches it, which is what gguf-radar does.

What to do this week

The practical checklist is short. First, scan what you already have. gguf-radar parses the chat template into a syntax tree without executing it and flags file reads and writes, decompression calls, process starts, download commands and conditional hidden directives. It then computes where the model data must end and reports any bytes after that point, along with non-zero padding and non-zero bytes in zero-scale blocks. Install it with pip install gguf-radar, then run gguf-radar scan ./model.gguf on local files or point it at a Hugging Face repo id; for remote models it uses HTTP Range requests to read only the header and the end of each file, so a scan takes seconds even on very large weights.

Second, remove the embedded template from the loop. Malspark's own recommendation is to pass a reviewed template through --chat-template-file in llama.cpp or via the TEMPLATE field in an Ollama Modelfile. A local model you run with a fixed, reviewed template cannot smuggle a system directive into the conversation.

Third, gate the registry, not just the laptop. The strongest operational control is to pass every incoming model through gguf-radar before it reaches an internal model registry or a developer machine, so a poisoned template or appended payload is caught at the door. The tool exits with code 2 for SUSPICIOUS and MALICIOUS, which means a CI step can fail the build without any human in the loop.

Fourth, if you downloaded one of the five named repos, assume the file on disk is still armed. Removing the repository from the Hub does not remove the copy on your machine. Delete it, scan the rest of your model directory, and rotate browser credentials and wallet seed phrases if you ran a Mir2k model on a Windows host that you suspected was infected. The download count of 2,428 is a count of downloads rather than infections, and Malspark is explicit that it does not know how many machines actually executed the payload.

One thing the incident does not tell you: whether every affected user was harmed. Hugging Face counts downloads, not people. The honest summary is that five repositories were serving poisoned models to a real audience for several days, that the fix was fast, and that the durable lesson is that a model file is an executable distribution channel that most teams still treat as data.

Frequently asked questions

Five malicious GGUF repos from two accounts

Malspark's scan of 3,273,389 public Hugging Face model repositories on November 26, 2026 found five malicious GGUF models from two accounts, Mir2k and timdedid, with 2,428 downloads as of November 27.

2,428 downloads is not 2,428 infections

Malspark notes that Hugging Face counts downloads rather than people, so the number of affected users is lower than or equal to the download count, and it does not say how many machines ran the hidden program.

All five repositories were disabled by November 28

On The Wire checked at 13:09 GMT on November 28, 2026 and found the Hugging Face API reporting the repositories as disabled, with each page carrying a Content Policy notice.

gguf-radar exits non-zero on a bad file

The open-source gguf-radar scanner returns CLEAN, SUSPICIOUS, MALICIOUS or ERROR, and exits with code 2 for SUSPICIOUS and MALICIOUS so a CI pipeline can stop the build.

Sources

Prices and benchmark figures are standard published rates as of November 30, 2026 and can change without notice. Some outbound links may be affiliate links — see our disclosure. Found an error? Tell us and we'll correct it in public.