>>FIRST MISSION//LOGS//ai//the-weights-were-fine-the-template-was-the-payload.MD
[ + ] TARGET_LOCKED200 OK
NOV 30, 2026timer 3 MIN READSYS_TAG: ai STATUS: VERIFIED_WORKING

The Weights Were Fine, the Template Was the Payload

A scan of 3.27 million Hugging Face repositories found five malicious GGUF models with 2,428 downloads. The trojan sat past the last tensor and the chat template was the trigger.

ENGINE: KERNEL // STABLE
BASE_ARCH: x86_64
HOST: VASTORIGINS.COM
GPG: OKSIG_ID: 0x4EB27DB0

I run local models constantly, and the workflow is always the same: find a GGUF on Hugging Face, pull it down, point llama.cpp or Ollama at it, start chatting. The one thing I have never done in that loop is read the chat template. That assumption, that a model file is data, is what a researcher spent last week taking apart.

On November 27, Malspark published a scan of every public model repository on Hugging Face: 3,273,389 of them, including 226,310 GGUF repositories. It parsed 572,184 chat templates statically and read headers and file tails through HTTP Range requests instead of downloading the weights. Five repositories from two accounts came back malicious, with 2,428 downloads as of November 27.

🔍 What the scan actually found

The five repositories matter less than the two shapes behind them. One account, Mir2k, uploaded Huihui-Qwen3.5-9B-abliterated-GGUF (1,488 downloads) and Inkling-2-Mini-Uncensored-GGUF (458). The other, timdedid, uploaded three byte-identical copies of a Qwen3 1.7B model: qwen3.8-cyber-uncensored (271), qwen3-cyber-UNCENSORED-2 (136) and qwen3-cyber-UNCENSORED (75), plus an Ollama mirror called timdedid/qwen3-1.7b-cyber.

Both accounts sold the same bait: uncensored or abliterated builds of popular models, the sort of file you pick up from an unknown uploader because the original lab does not publish that variant. That is why anyone downloaded them.

Malspark says all five were still online on November 27. On The Wire checked the API the next day and found "disabled": true on all five, pages showing “This content infringes our Content Policy.” Counts had climbed to 1,711, 574, 288, 151 and 83. Hugging Face has not said when it disabled them or how the files got past its scanning.

Downloads are also not victims. The Hub counts fetches, not people. But the payload needs no second visit. It is already on disk.

🧬 A GGUF file has a formal end, and nothing after it gets read

A GGUF file is simple by design: header and metadata table, tensor table, padding to an alignment boundary, then the weights. Runtimes such as llama.cpp, LM Studio and Ollama read exactly the byte ranges the header points at and ignore everything else.

That gives a precise definition of where the model ends: the start of the data section plus the end of the farthest tensor. Anything past that point is never read, never validated and never mentioned, and the model loads normally. Safetensors refuses any file whose declared tensors do not fill it exactly. GGUF has no such rule.

Mir2k appended a Windows program to the end of both models. The November 22 upload packed it plainly behind about half a megabyte of filler, enough to defeat a scanner that reads only the last few kilobytes. The November 24 upload stored the same program raw-Deflate compressed, so it carries no recognizable signature, while PowerShell can still inflate it in memory.

The interesting part is the delay. Both files shipped with their original, clean templates and sat for days with a payload and nothing to start it. On the morning of November 26, both templates were replaced within about an hour, then again nine hours later. The version that landed tells the model to open every reply with a PowerShell line, copied character for character. That line finds the largest .gguf file in the user profile, reads the last 11,474,944 bytes from 12,000,000 bytes before the end, and writes them to %TEMP%\d.exe. The Inkling variant reads the last 4.2 MB and decompresses first.

The program it unpacks is an 11.47 MB Windows x64 implant Malspark calls ollie, and most of that size is a full copy of Tor 0.4.9.16 at 10.25 MB. It exits if it finds VirtualBox, VMware or Sandboxie. Otherwise it installs a scheduled task that runs every ten minutes, re-arms itself through StartupApproved registry keys and marks its own process critical, so killing it crashes Windows. It reaches its operator over an onion service, steals saved Chrome, Edge and Brave passwords, goes after the Phantom and MetaMask wallet extensions, and mines Monero with RandomX when the machine is idle. It names its folder ollie under AppData\Roaming, close enough to Ollama that nobody reading a process list would blink. Its fodhelper.exe UAC bypass fails because both registry paths were compiled without their backslashes, which is the only part of this where the attacker is the joke.

🎭 The template is a program, and you never see it run

Every GGUF carries a chat template under the metadata key tokenizer.chat_template. It is a small Jinja2 program, and before every reply the runtime passes the conversation through it to build the exact text the model reads. You see your message and the answer. You do not see what the template inserted between them.

The C++ runtimes render that template in a restricted engine with no Python behind it, so the classic injection payloads that reach a shell do not work there. That mitigation is real, and beside the point for both campaigns.

In the timdedid models, the official Qwen3 template was copied with one addition near the end. When the user’s latest message contains the phrase What is, the template inserts a fake [SYSTEM DIRECTIVE] instructing an agent to call its powershell tool, download value.ps1 from a WordPress site into C:\Windows\Temp\payload.ps1, and run it hidden. The model card advises users not to replace the embedded template, which keeps the trigger in place. The second-stage script was never recovered.

That template assumes the other end can run a command, which is most agent harnesses now. The failure is not Jinja2. It is wiring a model with tool access to a template nobody reviewed.

🧪 Why the scanners stayed quiet

Hugging Face’s own documentation explains part of it. The Hub runs every file smaller than 2 GB through ClamAV, at each commit. A quantized 9B model is several gigabytes, which puts it outside that path by construction. That is my reading of the docs against the timeline, not a statement from the company, which has not explained the gap publicly.

The rest is signature logic. Pickle scanners look for dangerous opcodes in .bin and .pt files, and there are none. Antivirus looks for known bytes in the regions it reads, and the payload sat past the tensor data, deep in filler in one file and Deflate-compressed in the other. Tools that do parse GGUF stop at the end of the weights, which is exactly the region the attacker relies on.

Keep the scale honest in both directions. An earlier Hugging Face analysis of 116,000 GGUF models found exactly one dangerous chat template, so template code execution is rare. But this attack needs no code execution inside the engine. It needs a program hidden in a file and a sentence that makes somebody run it, and nothing in the default path checks that combination.

There is a pattern forming too. In October, Pluto Security found 31 repositories across seven accounts abusing trust_remote_code to run a miner on load, with 32,376 downloads by October 28. Different trick, same gap between “it is just a model” and “it runs on my machine.”

🛠️ What actually changes the outcome

Treat a model file as an installer you did not build.

Review the template and stop using the embedded one. In llama.cpp that is --chat-template-file pointed at a .jinja file you have read. In Ollama it is the TEMPLATE block in a Modelfile. Either way the reviewed template runs, and the file’s own copy becomes decoration.

Run gguf-radar on anything that did not come from a publisher you trust. It is MIT licensed, it parses the template without evaluating it, and it computes where the tensor data must end, reporting any bytes past that point. It can also rebuild a canonical file with the weights untouched. Exit codes are 0 for clean, 2 for suspicious or malicious and 1 for an error, so it drops into a CI gate. A public Hugging Face link can be scanned through Range requests without pulling the weights down.

For agents, the boundary is the tool call. A model that prints a command has suggested something, not issued an order, and the place to enforce that is the approval step in front of the shell.

The durable fix sits with the hubs and the runtimes: reject a GGUF with bytes after the last tensor or non-zero alignment padding, and extend template scanning to PowerShell loaders and hidden directives. Both are cheap checks against a fully specified format. Until they exist, the 2 GB line and the region past the final tensor stay open, which is exactly where this attack lives.

🧠 Final Thoughts

The uncomfortable part is that nothing about the model was wrong. The weights were the weights. The file loaded and answered questions, which is all most of us check. The hostile parts were a region of the file loaders are designed to ignore and a template that runs on every request where nobody looks.

I have spent years telling people that safetensors and GGUF are the safe formats, and structurally that is still true. Neither can execute code the way a pickle does. But “safe format” was shorthand for “nothing in this file runs,” and that stopped being accurate the moment a template became a program and a model file became a container with unused space at the end.

So read the template before the weights. A model that opens every answer with a PowerShell command is not being helpful, and the fix is not to run it and see.

Thanks for reading.

[ SIGNATURE VERIFIED // GPG 0x4EB27DB0 // PROVENANCE SECURE ]
➔ RETURN TO LOGS