November 29, 2026AgentsInfrastructureOpen Source

Malware on Hugging Face Hides in the Chat Template

Five models on Hugging Face, 2,428 downloads, and the dangerous part is not the weights. It is the chat template, the small Jinja program inside every GGUF file that the runtime applies to each prompt before the model sees it. Malspark, a company building AI agents for malware analysis, scanned all 3,273,389 public model repos on November 26 and published the results on November 27. https://malspark.com/blog/malicious-gguf-models-hugging-face/

Two actors. The bigger campaign, Mir2k, uploaded two "uncensored" GGUF models with a Windows remote access trojan appended after the last tensor, a region no loader ever reads, so the model works perfectly. The template started out clean. On November 26 the account rewrote both templates so the model opens every reply with a one-line command for the user to copy, and that line unpacks the hidden program. Plant first, arm later. The same account also created 12 empty repos named after models people are waiting for, like Qwen4-27B and DeepSeek-V4, ready to fill on launch day.

The second campaign is the one agent builders should read. Account timdedid published three copies of a small Qwen3 "cyber" model whose template, when the user's message contains a trigger phrase, inserts a fake system directive telling an agent with shell access to download and run a script. The README even advises users not to replace the embedded template. The user sees a normal chat. The agent sees an order.

Downloads went from 1,502 on November 26 to 2,428 a day later, mostly on the Mir2k models. As of the evening of November 28 all five repos still answer on the Hugging Face API, and no statement from Hugging Face has surfaced. Malspark has a commercial interest here, but the detector it released, gguf-radar, is MIT-licensed and checks templates and trailing bytes without running anything: https://github.com/Root0ne/gguf-radar

Our read: everyone audits weights for backdoors and nobody reads the template, yet the template is a system prompt the model author wrote and the user never sees. Once a local model drives an agent with tools, a model download is a prompt download. The fix is boring and available today: pin a reviewed template (llama.cpp's --chat-template-file, Ollama's TEMPLATE) and treat any command a model suggests as untrusted. Hubs rejecting bytes after the last tensor would kill the Mir2k trick outright.
← Previous
Terence Tao: Big Math Is Coming, Lab Proofs Are Toxic Waste
Next β†’
Convex Pulls the Classifier Line Within a Day
← Back to all articles

Comments

Loading...
>_