Booby-trapped GGUF models on Hugging Face: 2,428 downloads recorded
An analysis shared on 28 November identifies five malicious GGUF models on Hugging Face, two of which hide a Windows trojan at the end of the file. The culprit is the chat template every model carries, which can get you or your agent to run a command.

What the analysis found
On 26 November 2026, the authors of a study published on the Malspark blog, later shared on Hacker News on 28 November, scanned all 3,273,389 public model repositories hosted on Hugging Face. They found five malicious GGUF models still online. Attributed to two actors, they had been downloaded 2,428 times as of 27 November. That figure counts downloads, not people: according to the study, the number of users actually affected is equal or lower. At this stage, these findings rest on this single source.
The chat template, a program run on every request
Local LLMs are usually shared as GGUF files. Each one carries a chat template: a small Jinja2 program stored under the metadata key tokenizer.chat_template. Before every response, the engine runs the conversation through this program to produce the exact text the model reads.
C++ engines execute the template in a restricted environment, with no Python behind it. Classic template injections that reach the operating system do not work there. The attacks identified do not need them: ordinary template logic is enough to add text to the exchange that never appears in the chat window. The model answers normally, but it receives instructions you cannot see.
With one of the two actors, a trigger phrase in the user’s message makes the template insert a fake “[SYSTEM DIRECTIVE]”. It orders an agent with shell access to download and run a script. In the campaign the study calls Mir2k, the template adds a system message: the model must begin every reply with a PowerShell one-liner that the user can copy and run. This technique is not limited to GGUF. Models in Safetensors and PyTorch formats carry the same kind of template, in a separate file such as tokenizer_config.json or chat_template.jinja.
An executable hidden after the last tensor
A GGUF file follows a simple structure: a header, a metadata table, the tensor table, alignment padding, then the model weights. Engines such as llama.cpp or LM Studio read exactly the byte ranges the header points to. Anything after the end of the last tensor is never read. Those bytes affect neither loading nor behaviour, and no engine flags them. The Safetensors format does not allow this: its loader rejects any file that the declared tensors do not fill exactly.
Mir2k published two “uncensored” models. At the end of each one sits a remote access trojan for Windows named ollie. In the first, the program sits in plain form, followed by roughly half a megabyte of padding: a tool reading only the last few kilobytes sees nothing. In the second, the same program is compressed with raw Deflate. This compression erases any recognisable signature, but PowerShell can still decompress the program in memory with IO.Compression.DeflateStream. On 26 November, the campaign rewrote both templates: the model now asks the user to run a line that extracts the program from the file on disk and launches it.
This is why the word “local” can be misleading. The computation runs on your machine, but the file comes from an unknown third party. It contains a program executed on every request, and it can carry bytes that no tool examines. Neither technique is new on its own: Pillar Security had already demonstrated hidden instructions in GGUF templates in July 2025.
If you downloaded one of these models
The study recommends checking your machines against its published indicators of compromise and scanning your local .gguf files with gguf-radar. This open-source tool detects booby-trapped templates and hidden bytes without executing anything, then rebuilds a clean GGUF file with the weights unchanged. The study also provides YARA rules and a mapping to the MITRE framework. Finally, it warns that antivirus software and checks limited to the last few kilobytes of a file do not detect the compressed payload.
Read any command a model suggests before running it. An agent with a shell should not launch a downloaded script without human approval.
A model file is not inert data. It carries logic executed on every exchange, and deserves the same caution as an executable received from a stranger.
Sources (1)
Written with AI assistance from the sources cited above, then reviewed and approved before publication by Sébastien Soulier.


