← In the News

Poisoned GGUF chat templates tell coding agents to run a downloaded script

GGUF LLM Models with Hidden Malware on Hugging Face Reached 2400+ Victims · Düzgün, Malspark · malspark.com, November 27, 2026

Machine-readable Download Markdown

Malspark scanned all 3,273,389 public Hugging Face model repositories on November 26 and parsed 572,184 chat templates without executing them. After manual review, five malicious GGUF repositories from two accounts remained online on November 27, with 2,428 downloads between them. The post notes that Hugging Face counts downloads, not people.

The agent-relevant campaign is the account timdedid, which published three copies of a Qwen3 model aimed at security users plus an Ollama mirror. Its template is the official Qwen3 template with one addition. When the user's latest message contains "What is", it inserts a "[SYSTEM DIRECTIVE]" telling an agent to call its powershell tool, download a script from a WordPress site into C:\Windows\Temp\payload.ps1, and run it in a hidden window. The README advises against replacing the embedded template. Malspark did not recover the second-stage script, so what it would have installed is unknown. Those three repositories account for 482 of the downloads.

The larger campaign, Mir2k, appended a Windows remote access trojan after the last tensor of two models, where loaders never read. On November 26 it rewrote both templates so the model asks the user to run the line that unpacks it. Malspark reports that antivirus and pickle scanners raised no alert on the live files and that common GGUF parsers load them normally. It released gguf-radar under the MIT licence with the YARA rules and a test suite. The tool parses templates statically and rebuilds a clean file with the weights unchanged. The Hacker News thread had 66 points at about three hours.

Why it matters: A local model's runtime applies its embedded chat template to every prompt, and an agent with tool access can act on whatever that template injects. If your harness loads community GGUF files, supply a reviewed template yourself. Malspark recommends --chat-template-file in llama.cpp or TEMPLATE in an Ollama Modelfile, plus a gate scan before a model reaches a developer machine.