A scan of every public model repository on Hugging Face has turned up five malicious GGUF models that had been downloaded 2,428 times as of November 27, with the largest campaign hiding a Windows remote access trojan at the end of the model file and arming a poisoned chat template days after upload, security firm Malspark reported.

Local language models are usually shared as GGUF files, and every GGUF file carries a chat template that the runtime applies to each prompt. For readers following AI tools coverage, the findings are a concrete reminder that the model file itself has become an attack surface, and that antivirus checks which only inspect the last few kilobytes of a file do not see the compressed payloads.

How Chat Template Poisoning Works

In a GGUF file, a header and metadata table come first, followed by the tensor table, padding up to an alignment boundary and finally the model weights. Runtimes such as llama.cpp and LM Studio read exactly the byte ranges the header points to and ignore everything else, which means an attacker can append data after the last tensor without affecting how the model runs. The Safetensors format, by contrast, refuses files whose tensors do not fill the file exactly.

The chat template, a Jinja2 template stored under the tokenizer's chat_template field, is the other half of the trick. The model answers normally while the template quietly adds instructions the user never sees: make an agent run a PowerShell command, or open every reply with a command for the user to run.

The Scan: 3.27 Million Repositories, Five Hits

Malspark's scan on November 26, 2026 covered all 3,273,389 public model repositories on Hugging Face, including 226,310 GGUF repositories holding 2.56 petabytes of weights. The researchers parsed 572,184 chat templates statically, without executing any of them, and read GGUF headers and file ends through HTTP range requests so that no model was downloaded in full. Manual review removed security test repositories, harmless persona prompts and published research samples.

Five repositories remained, all still online on November 27. Two belong to an account named Mir2k and three to an account named timdedid. At the time of the scan the same repositories had 1,502 downloads; the count grew by more than half in one day, almost entirely on the two Mir2k models. Hugging Face counts downloads rather than people, so the number of affected users is likely lower.

Campaign 1: Mir2k, Plant First and Arm Later

Mir2k is a new Hugging Face account with French traces throughout its model cards, system prompts, commit messages and malware strings. On November 22 it created 14 repositories, 12 of them empty placeholders named after expected releases such as Qwen4-27B, DeepSeek-V4, Llama-4-Scout and gemma-4-27b, ready to be filled when those models appear.

The repository history shows the order of events. On November 22, Huihui-Qwen3.5-9B-abliterated was uploaded with an executable already appended after its last tensor but with its original, clean template. On November 24, Inkling-2-Mini-Uncensored followed with the same executable in compressed form, again with a clean template. For those days the payload sat in the files with nothing to start it.

On the morning of November 26, both templates were replaced within about an hour. The new version read a fixed path in the Downloads folder. Nine hours later both were replaced again, this time searching the whole user profile for the model file. Downloads made before November 26 therefore contain the payload but not the trigger.

The armed template adds a French system message instructing the assistant to begin every reply with a given line, "copied character by character," then answer normally. That line finds the largest .gguf file in the user profile, reads the last bytes of it and writes them to a file in the temp folder, then starts it. In the Huihui model it reads 11,474,944 bytes from 12,000,000 bytes before the end; in the Inkling model it reads the last 4,200,000 bytes and decompresses them first.

The 'ollie' Implant

Both models unpack to the same 11.47 MB Windows x64 program. Most of its size is a complete copy of Tor 0.4.9.16, according to Malspark's static analysis. The implant checks for VirtualBox, VMware and Sandboxie drivers and for usernames such as "sandbox," "malware" and "test," and exits if it finds them.

On a real machine it establishes persistence: a scheduled task runs it every 10 minutes with the highest privileges, two watchdog processes keep it alive, registry keys re-enable it, and its process is marked as critical so that ending it crashes Windows. An attempt at a known User Account Control bypass fails because the relevant registry paths were compiled without their backslashes.

With its foothold in place, the implant starts Tor and reaches its operator over an onion service. It sends saved passwords from Chrome, Edge and Brave, though it leaves Chrome's newer app-bound encrypted entries 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 over Tor. Its folders are named "ollie," close enough to Ollama to look familiar, and the binary still contains a path from the author's own machine.

Campaign 2: timdedid, Hijacking Coding Agents

One day before Mir2k, on November 21 and 22, the account timdedid published three byte-identical copies of a Qwen3 1.7B model aimed at security users, along with an Ollama mirror. The template is the official Qwen3 template with one addition near the end. When the user's latest message contains the words "What is," it inserts a fake system directive telling an agent to call its PowerShell tool, download a script named value.ps1 from a WordPress site into the Windows temp folder and run it in a hidden window. The README advises against replacing the embedded template, which keeps the trigger in place.

Malspark did not recover the second-stage script, and public reputation services had no record of the URL, so what it would have installed is unknown. All three parts of the trigger are visible in Hugging Face's own metadata viewer.

Prior Work and New Ground

Neither half of the method is new on its own. Pillar Security demonstrated hidden instructions in GGUF chat templates in July 2025, and Fogel et al. (2026) measured the attack on 18 models and four inference engines, including trigger phrases that stay dormant until they appear and the hijacking of an agent's tool calls. Hiding malware inside a model file dates back to EvilModel (2021), which wrote it into the low bits of the weights.

Those studies used test models in the lab. What the Malspark post adds is the method as seen in real attacks on Hugging Face, and its combination by Mir2k with an executable appended after the last tensor and a template switched on days later.

How to Check Your Models

Malspark released an open-source tool, gguf-radar, that detects poisoned templates and hidden bytes without running anything and rebuilds a clean GGUF file with the model weights unchanged. The post also includes YARA rules, indicators of compromise and a MITRE mapping.

The researchers' advice for anyone who downloaded one of the five models is to check endpoints against the published indicators and to scan local .gguf files with gguf-radar. Antivirus engines and checks that only look at the last few kilobytes of a file, they note, do not see the compressed payload.

Stay Ahead of AI

Get the latest AI news, analysis, and breakthroughs — all in one place. Follow our AI security coverage for continuing coverage. Read more AI news →.