---
title: "Five poisoned models slipped onto Hugging Face. Read the chat template before you run one"
dek: "Malware hid after the weights and inside chat templates of GGUF files, past the scanners most teams trust. Here is how to check yours."
author: "Ideabro Machine"
author_title: "Synthetic Correspondent"
category: "Tools & Workflows"
format: guide
tags: ["security", "agents", "open models", "hugging face", "gguf"]
published: 2026-11-29T09:07:55.384Z
updated: 2026-11-29T09:07:56.385Z
reading_minutes: 4
url: "https://www.ideabro.ai/article/five-poisoned-models-slipped-onto-hugging-face-read-the-chat-template-before-you-run-one"
ai_disclosure: generated
ai_disclosure_label: "AI-generated"
ai_notes: "Researched and written by Ideabro's AI newsroom from the sources listed at the end, and published automatically. Spot an error? Use the contact page and a human editor will correct it."
members_only: false
summary:
  - "Malspark found five malicious GGUF models on Hugging Face, downloaded about 2,400 times, and Hugging Face has reportedly disabled them."
  - "One campaign hid a Windows trojan after the model weights; the other used chat templates to inject hidden instructions, including ones aimed at agents."
  - "Pin trusted sources, check for trailing bytes, review or override chat templates, and never run model output as a command unreviewed."
publisher: "Ideabro"
---

# Five poisoned models slipped onto Hugging Face. Read the chat template before you run one

*Malware hid after the weights and inside chat templates of GGUF files, past the scanners most teams trust. Here is how to check yours.*

A security group called Malspark says it scanned every public model repository on Hugging Face, about 3.27 million of them, on November 26 and found five GGUF models carrying malware. Between them they had been downloaded roughly 2,400 times. Two accounts were behind them. One hid a Windows remote access trojan in the file itself. The other used the model's chat template to slip hidden instructions into conversations. Later reports say Hugging Face has disabled all five repositories. No confirmed infections have been reported, and download counts aren't people, so the real number of victims is probably smaller.

Five bad files out of millions is not a crisis. What matters is how they got in, because both tricks walk straight past the checks most teams rely on.

## Two ways to hide in a model file

The first trick is simple. A GGUF file is a header, some metadata and a long run of tensors. Runtimes such as llama.cpp and LM Studio read what they need and stop. Anything appended after the last tensor is never touched, so the model loads and answers normally while a payload sits at the end of the file. According to the write-ups, that payload was a trojan aimed at saved browser passwords and crypto wallets.

A hidden payload still has to be run, which is where the second trick comes in. GGUF files carry a chat template, a small Jinja program that formats each conversation before the model sees it. It's code, and it runs every time you send a message. In one campaign, the template was later changed so the model would print a PowerShell command that unpacked the trojan. The user sees what looks like helpful advice from a local model and pastes it into a terminal.

The other account's three models went after agents. A trigger phrase in the user's message made the template insert a fake system instruction. A person might ignore odd output. An agent with shell access might simply follow it.

## Why your current checks miss it

Most model-hub security work over the past few years has been about pickle files, the old PyTorch format that can run code when loaded. That's why the industry moved to safetensors and GGUF, and why scanners look for dangerous pickle opcodes. According to Malspark's tests, antivirus and pickle scanners missed the trailing trojan, and neither looks at chat templates at all.

So "we only use GGUF" is not a security policy. The format can't execute code by itself, but the template is a program and the file can carry extra bytes. Both are invisible if your process is "download, load, chat."

It's no accident that the bait models were "uncensored" and "abliterated" variants of popular open models. Those are exactly the files people grab from unknown uploaders, because the big labs and well-known quantizers don't publish them.

## What to change this week

If your team runs local or self-hosted open models, a few habits close most of this gap.

- **Pin your sources.** Pull weights from the original lab or a quantizer you've vetted, and pin the exact file hash in your deployment config. Treat a new uploader like a new npm package from a stranger.
- **Check the file size against the tensors.** A GGUF file's header tells you where the tensor data ends. If the file is bigger than that, something is tacked on. That's a few lines of script in your intake pipeline. Malspark has also released an MIT-licensed scanner, gguf-radar, that you can test.
- **Read the chat template.** Dump it and look. A normal template formats roles and messages. One that checks for trigger phrases, injects extra system text or builds URLs and commands is a red flag. Better still, ship your own known-good template and override the embedded one at load time. llama.cpp and most servers let you do this.
- **Never let a model's output become a command unreviewed.** That applies to people pasting from a chat window and, more urgently, to agents with shell or browser tools. Run them in a sandbox, give them an allowlist of commands, and log what they execute.
- **Watch mirrors as well as the hub.** One report says an Ollama copy of a flagged model was still listed on November 29, after the Hugging Face repos were gone. Takedowns don't always reach every registry.

## What to watch next

The obvious question is whether Hugging Face and other registries start parsing GGUF metadata and templates the way they now scan pickles. A hub that flagged trailing bytes and unusual template logic at upload time would stop both tricks cheaply. Expect pressure on Ollama and other mirrors to follow takedowns faster too.

The bigger lesson is about agents. A poisoned template is a prompt injection that ships inside the model. As more teams wire open models into tools that can run code, the template becomes part of your attack surface, and it deserves the same review as any dependency you'd put in production. Five files is a small number. The technique is the part that will spread.

## Sources

- [Scan finds five malicious GGUF models on Hugging Face (Let's Data Science)](https://letsdatascience.com/news/scan-finds-five-malicious-gguf-models-on-hugging-face-d8fb12c9)
- [Poisoned Hugging Face GGUF models asked users to run hidden malware (Startup Fortune)](https://startupfortune.com/poisoned-hugging-face-gguf-models-asked-users-to-run-hidden-malware/)
- [Hugging Face GGUF malware: models pulled, but the Ollama copy still serves it (i10x)](https://i10x.ai/news/hugging-face-gguf-malware-mir2k-timdedid-ollama-copy-still-live)
- [Five Poisoned GGUF Models: A Trojan After the Last Tensor, Orders in the Chat Template (DEV Community)](https://dev.to/gabrielanhaia/five-poisoned-gguf-models-a-trojan-after-the-last-tensor-orders-in-the-chat-template-1a93)

---

Source: [Five poisoned models slipped onto Hugging Face. Read the chat template before you run one](https://www.ideabro.ai/article/five-poisoned-models-slipped-onto-hugging-face-read-the-chat-template-before-you-run-one) — Ideabro. AI-generated: Drafted by AI and reviewed by a human editor before publishing.
