{"slug": "gguf-malware-how-to-check-a-model-before-you-run-it", "title": "GGUF Malware: How to Check a Model Before You Run It", "summary": "A scan of all 3,273,389 public Hugging Face model repositories on 26 Nov 2026 found 5 malicious GGUF models that had been downloaded 2,428 times as of 27 Nov, according to a 27 Nov 2026 report from security firm Malspark. Malspark said the models, from 2 actors and all still online on 27 Nov, hid payloads in the Jinja2 chat template stored under the metadata key `tokenizer.chat_template` or in bytes placed after the last tensor, where \"no runtime warns about it\"; one campaign hid a Windows remote access trojan and later rewrote the templates so the model asks the user to run the line that unpacks it. The report recommends reading the chat template, scanning for extra bytes after the last tensor, downloading from the original publisher and never running a command the model prints, and links the MIT-licensed gguf-radar scanner, which had 118 GitHub stars on 28 Nov 2026.", "body_md": "# GGUF Malware: How to Check a Model Before You Run It\n\nSpot GGUF malware before it runs: read the chat template, scan for bytes after the last tensor, use the original publisher, run no command it prints.\n\nTo check a GGUF model before you run it, read its chat template, scan the file for extra bytes after the last tensor, get it from the original publisher, and never run a command the model tells you to. Malspark reports five malicious GGUF models on Hugging Face that used these tricks. Checked 28 Nov 2026.\n\n[Munder Difflin](https://harnessmd.com/download) is free and open source: a desktop app that runs a team of AI agents for all kinds of knowledge work, coding included, on your own computer. The [install guide](https://munderdiffl.in/blog/how-to-install-and-use-munder-difflin/) covers setup.\n\n## What does a GGUF file carry? [#](#what-does-a-gguf-file-carry)\n\nA GGUF file carries the model weights, a set of metadata and a chat template. Hugging Face’s [GGUF docs](https://huggingface.co/docs/hub/gguf) say “GGUF encodes both the tensors and a standardized set of metadata,” and the Hub “has a viewer for GGUF files that lets a user check out metadata & tensors info (name, shape, precision)”.\n\nThe [Malspark report](https://malspark.com/blog/malicious-gguf-models-hugging-face/), dated 27 Nov 2026, names the two weak spots. The chat template is “a small Jinja2 program stored under the metadata key `tokenizer.chat_template`”, and in chat template poisoning “the template quietly adds instructions the user never sees”: a hidden line the chat window never shows. And past the end of the last tensor, “Anything after that point is never read,” so extra bytes there go unseen and “no runtime warns about it.”\n\n## What did Malspark find on Hugging Face? [#](#what-did-malspark-find-on-hugging-face)\n\nMalspark reports that a scan of every public Hugging Face model repository on 26 Nov 2026 found 5 malicious GGUF models with 2,428 downloads as of 27 Nov, from 2 actors.\n\n| What Malspark reports | Number | \n|---|---|\n| Public model repositories scanned, 26 Nov 2026 | 3,273,389 | \n| GGUF repositories among them | 226,310 | \n| Chat templates parsed without running them | 572,184 | \n| Malicious GGUF models, all still online on 27 Nov | 5 | \n| Downloads at the time of the scan, 26 Nov | 1,502 | \n| Downloads as of 27 Nov | 2,428 | \n\n“Hugging Face counts downloads, not people,” the report adds, “so the number of affected users is lower or equal.”\n\nThe larger campaign, in the section titled “Plant First and Arm Later”, hid a Windows remote access trojan after the last tensor of two uncensored models with clean templates, then on 26 November rewrote both templates “so the model asks the user to run the line that unpacks it.” The account was new; of its 14 repositories, the report says, “Twelve of them are empty placeholders named after expected releases.”\n\nThe second, under “Hijacking Coding Agents”, copied one model three times. A trigger phrase makes its template insert a fake system directive that “orders an agent with shell access to download and run a script,” and its README “advises against replacing the embedded template.”\n\nOn [Hacker News](https://news.ycombinator.com/item?id=50676752) the report had 104 points at 16:19 UTC on 28 Nov.\n\n## How do you check a GGUF model before you run it? [#](#how-do-you-check-a-gguf-model-before-you-run-it)\n\nRun these 8 checks. [gguf-radar](https://github.com/Root0ne/gguf-radar), the MIT licensed scanner the report links, had 118 GitHub stars on 28 Nov 2026, and its README says it “never runs the model or its template.”\n\n```\n# read the metadata and template (llama.cpp gguf-py)\npip install gguf\ngguf-dump --json --no-tensors model.gguf\n\n# Ollama\nollama show --modelfile llama3.2\n\n# scan a file or a Hugging Face repo (gguf-radar)\npip install git+https://github.com/Root0ne/gguf-radar\ngguf-radar scan ./model.gguf\ngguf-radar scan Qwen/Qwen2.5-0.5B-Instruct-GGUF\n\n# run with your own template (llama.cpp)\nllama-server -m model.gguf --chat-template-file my-template.jinja\n```\n\n1. **Original publisher.** gguf-radar’s[limitations page](https://github.com/Root0ne/gguf-radar/blob/main/docs/limitations.md) says to “Download models from publishers you trust”. Our view: a new account full of placeholder repos is a warning sign.\n2. **Read the template.** Use the Hub’s viewer, or`gguf-dump` from llama.cpp’s[gguf-py](https://github.com/ggml-org/llama.cpp/tree/master/gguf-py) , which “Dumps a GGUF file’s metadata to the console”. Its plain view shortens long strings; the`--json` flag (“Produce JSON output”) prints the whole template. For Ollama, the[Modelfile docs](https://github.com/ollama/ollama/blob/main/docs/modelfile.mdx) point to`ollama show --modelfile` .\n3. **Commands in the template.** gguf-radar flags “file reads and writes, decompression, process starts, download commands, conditional hidden directives,” Malspark says. Our view: a template formats text, so a shell, URL or file path in it is a warning sign, as is a model card that tells you to keep the template.\n4. **Extra bytes.** gguf-radar “reports any bytes after that point”, the end of the model data, the report says. For Hugging Face models the README says “it downloads only the small parts it needs”. Verdicts are`CLEAN` ,`SUSPICIOUS` ,`MALICIOUS` or`ERROR` .\n5. **Antivirus alone.** Hugging Face’s[malware scanning page](https://huggingface.co/docs/hub/security-malware) says “We run every file of your repositories that is smaller than 2 GB through a malware scanner.” Malspark reports that “Antivirus engines and checks that only look at the last few kilobytes of a file do not see the compressed payload.”\n6. **Your own template.** llama.cpp’s[server docs](https://github.com/ggml-org/llama.cpp/blob/master/tools/server/README.md) say`--chat-template-file` will “set custom jinja chat template file (default: template taken from model’s metadata)”. In Ollama,`TEMPLATE` is “The full prompt template to be sent to the model.” Malspark says that when the model has access to tools, a reviewed template “takes the embedded one out of the loop.”\n7. **No command from a model.** Malspark’s advice: “treat any command a model suggests as untrusted.”\n8. **Check again.** Keep scanning, the limitations page says, “because files in a repository can change after you first check them.”\n\n## What should you do if you already ran one? [#](#what-should-you-do-if-you-already-ran-one)\n\nScan your machine and your GGUF files first. Malspark advises: “Check endpoints against the indicators in Section 7.2 and scan local .gguf files with gguf-radar.” It reports the Windows program it took apart sends saved passwords from Chrome, Edge and Brave, and targets the Phantom and MetaMask wallet extensions.\n\nOur view: take the machine off the network, scan it, then from a clean device change your saved browser passwords and rotate your API keys.\n\n## Why do local agents raise the stakes? [#](#why-do-local-agents-raise-the-stakes)\n\nA poisoned template can give orders to your agent, as the campaign under “Hijacking Coding Agents” shows. Our view: give a community model shell tools only with permission prompts on. Claude Code’s [permissions docs](https://code.claude.com/docs/en/permissions) say the default mode “Prompts before most edits, shell commands, and network requests” and “Permission rules are enforced by Claude Code, not by the model.” To wire in a local model, see [how to connect Ollama to Claude Code](https://munderdiffl.in/blog/how-to-connect-ollama-to-claude-code/), [is Ollama good for coding](https://munderdiffl.in/blog/is-ollama-good-for-coding/) and [llama.cpp 1.0](https://munderdiffl.in/blog/llama-cpp-1-0/). For skills and tools, see [how to check an agent skill before you install it](https://munderdiffl.in/blog/check-agent-skill-before-install/) and [MCP tool poisoning](https://munderdiffl.in/blog/mcp-security-tool-poisoning/).\n\nIn Munder Difflin, the [README](https://github.com/HarnessMD/munder-difflin), read 28 Nov 2026, says: “API keys and local models (Ollama, LM Studio, vLLM) go in Settings → Agents & Models.” We think the same checks apply there.\n\n## FAQ\n\nCan a GGUF file contain malware?\n\nMalspark reports that it can. Its scan of Hugging Face on 26 Nov 2026 found 5 malicious GGUF models. In the larger campaign a Windows program sat after the last tensor, where loaders never read, and the chat template was later changed so the model asks the user to run the line that unpacks it.\n\nWhat is GGUF chat template poisoning?\n\nThe chat template is \"a small Jinja2 program\" in the GGUF metadata that formats every conversation, Malspark explains. Poisoning it means the template \"quietly adds instructions the user never sees\", such as telling an agent to run a command.\n\nIs it safe to download GGUF models from Hugging Face?\n\nOur view: get the model from its original publisher, read the template and scan the file first. gguf-radar's own docs add that \"A clean result is not a guarantee\" and that \"files in a repository can change after you first check them.\"\n\nDoes Hugging Face scan GGUF files for malware?\n\nIts malware scanning page says \"We run every file of your repositories that is smaller than 2 GB through a malware scanner.\" The page does not say it reviews chat templates. Malspark reports that \"Antivirus engines and checks that only look at the last few kilobytes of a file do not see the compressed payload.\"\n\nWhat does gguf-radar do?\n\nIts README says it \"checks LLM model files for hidden malware and poisoned chat templates\" and \"never runs the model or its template.\" It scans local files and Hugging Face models, can build a clean copy with the same model weights, and is MIT licensed.", "url": "https://wpnews.pro/news/gguf-malware-how-to-check-a-model-before-you-run-it", "canonical_source": "https://munderdiffl.in/blog/check-gguf-model-before-you-run-it/", "published_at": "2026-11-28 00:00:00+00:00", "updated_at": "2026-11-28 17:11:44.021295+00:00", "lang": "en", "topics": ["ai-safety", "ai-tools", "large-language-models", "ai-agents"], "entities": ["Malspark", "Hugging Face", "gguf-radar", "llama.cpp", "Ollama", "Munder Difflin", "Hacker News"], "also_reported_by": [], "takeaway": "Inspect a GGUF's `tokenizer.chat_template` metadata and any bytes after the last tensor before running it, since Malspark found 5 malicious models hiding payloads in exactly those two places that no runtime reads or warns about.", "recommendation": {"advice": "Before loading any downloaded GGUF, dump its metadata and chat template with gguf-dump or gguf-radar and scan for trailing bytes, then run it with your own template rather than the embedded one.", "playbook": "agent-security", "playbook_url": "https://wpnews.pro/playbooks/agent-security"}, "alternates": {"html": "https://wpnews.pro/news/gguf-malware-how-to-check-a-model-before-you-run-it", "markdown": "https://wpnews.pro/news/gguf-malware-how-to-check-a-model-before-you-run-it.md", "text": "https://wpnews.pro/news/gguf-malware-how-to-check-a-model-before-you-run-it.txt", "jsonld": "https://wpnews.pro/news/gguf-malware-how-to-check-a-model-before-you-run-it.jsonld"}}