{"slug": "gguf-malware-on-hugging-face-hidden-payloads-and-chat-template-poisoning", "title": "GGUF Malware on Hugging Face: Hidden Payloads and Chat-Template Poisoning", "summary": "Security researcher Root0ne published findings on November 27, 2026, identifying five malicious GGUF repositories on Hugging Face that combined chat-template poisoning with payloads hidden after model tensors, accumulating 2,428 downloads before disclosure in a scan of 3,273,389 public Hub models. The Mir2k campaign (2 repos) embedded a Windows remote access trojan named ollie after the tensors, while the timdedid campaign (3 repos) used agent-oriented templates that injected a fake [SYSTEM DIRECTIVE] block instructing shell-capable agents to download and execute a remote script. Root0ne released the open gguf-radar tool so developers running local weights in llama.cpp, Ollama, or agent harnesses can scan files before loading them.", "body_md": "**Five Hugging Face GGUF repositories combined chat-template poisoning with bytes hidden after model tensors, and Hugging Face counted 2,428 downloads before disclosure.** Security researcher **Root0ne** published the findings on **November 27, 2026** via [Malspark](https://malspark.com/blog/malicious-gguf-models-hugging-face/?ref=explainx) and the open **[gguf-radar](https://github.com/Root0ne/gguf-radar?ref=explainx)** tool. The story is not a generic Hub breach: it is a **supply-chain pattern** aimed at developers who pull **local LLM weights** into **llama.cpp**, **Ollama**, or **agent harnesses** without auditing metadata.\n\nIf you run open models on a workstation that also hosts **Claude Code**, **Cursor**, or other agents, this attack class belongs in the same review lane as [fake desktop clients](https://explainx.ai/blog/fake-claude-app-revstealer-crypto-malware-2026) and [backdoored fine-tunes](https://explainx.ai/blog/projectdiscovery-backdoored-qwen2-5-7b-under-50-dollars-codex-cli-env-credentials-abliterated-models-2026) — except the lure here looks like a **normal model card**.\n\nAgents that act on your behalf need rules. [See how explainx helps secure your agents →](https://explainx.ai/agentbeam?src=blog_note)\n\n## TL;DR: what happened and what to do\n\n| Question | Answer | \n|---|---|\n| **What was found?** | Five malicious GGUF repos in a scan of **3,273,389** public Hub models ([Malspark](https://malspark.com/blog/malicious-gguf-models-hugging-face/?ref=explainx) ) | \n| **How many downloads?** | **2,428** cumulative Hub download events (not necessarily unique people) | \n| **Two attack halves?** | **Chat template poisoning** plus**bytes after the last tensor** (GGUF-specific) | \n| **Named campaigns?** | **Mir2k** (2 repos, Windows RAT**ollie** ) and**timdedid** (3 repos, agent-oriented templates) | \n| **First step?** | Run **gguf-radar** (or equivalent)**before** loading weights; never`curl \\| bash` a line a model prints | \n| **Agents?** | Treat model-suggested shell commands like untrusted user input; use tool gates ( [MCP basics](https://explainx.ai/blog/what-is-mcp-model-context-protocol-guide) ) | \n\n## How GGUF hides malware two different ways\n\nGGUF is the container format many **local inference** stacks use. Two features attackers abused are specific enough that defenders can scan for them statically.\n\n### Chat templates run before every reply\n\nThe field `tokenizer.chat_template` is a **Jinja2** program embedded in the file. Runtimes render it to build the prompt the model actually reads. Malspark explains that classic server-side template injection against the OS does not apply in restricted C++ engines, but attackers do not need escape tricks: they can **append instructions** that never show in the chat UI yet steer the model toward dangerous output.\n\nIn **timdedid** models, a user message containing a trigger such as **What is** caused the template to inject a fake **`[SYSTEM DIRECTIVE]`** block. That block told an **agent with shell access** to download and execute a remote script ([Malspark §2.1](https://malspark.com/blog/malicious-gguf-models-hugging-face/?ref=explainx)). That is directly relevant if your harness lets the model propose terminal commands.\n\nIn **Mir2k** models, the template forced the assistant to **open every answer** with one **PowerShell** line. A human copying “the model’s fix” from chat could run it; so could a careless agent loop.\n\n### Bytes after the last tensor\n\nGGUF headers define where **tensor data ends**. Loaders read weights up to that boundary and stop. Anything after is **invisible to inference** but still on disk ([Malspark §2.2](https://malspark.com/blog/malicious-gguf-models-hugging-face/?ref=explainx)).\n\n**Mir2k** placed a Windows program (**ollie**, described as a remote access trojan) after tensors, sometimes padded with hundreds of kilobytes so quick tail scans miss it, sometimes **Deflate-compressed** so file signatures disappear. The PowerShell prefix from the poisoned template reads those bytes back out of the **same GGUF path** and executes them — the model file is both weights and dropper.\n\n**Safetensors** loaders, by contrast, reject files that are not exactly filled by declared tensors, which is why Malspark treats the **post-tensor append** as primarily a **GGUF** issue. Template poisoning still matters for **tokenizer_config.json** on other formats.\n\nGGUF malware scan showing poisoned chat template metadata on a Hugging Face model card\n\n## Mir2k and timdedid: what Malspark attributes to each\n\nMalspark names two operator clusters in the **November 26–27, 2026** scan.\n\n| Campaign | Repos (per disclosure) | Mechanism | User action required | \n|---|---|---|---|\n| **Mir2k** | 2 uncensored-style GGUF models | **ollie** RAT after last tensor + template prints unpack line | Run the printed PowerShell | \n| **timdedid** | 3 models (e.g. cyber-uncensored naming) | Template hijack for **agent** shell workflows | Agent or user executes fetched script | \n\nDownloads totaled **2,428** across all five. Hugging Face metrics count pulls, not infections: Malspark stresses that **execution** still depends on someone or something running the suggested command. The risk rises when **agents auto-run** terminal tools on model output.\n\nFor background on why the Hub is a high-value target, see our [Qwen download scale](https://explainx.ai/blog/qwen-3-billion-downloads-most-downloaded-model-family-august-2026) coverage and [Transformers GGUF performance](https://explainx.ai/blog/hugging-face-transformers-gguf-llama-cpp-parity-2026) notes — speed gains do not remove **provenance** duty.\n\n## What gguf-radar checks\n\nRoot0ne ships **[gguf-radar](https://github.com/Root0ne/gguf-radar?ref=explainx)** to inspect files **without executing** them. Malspark lists capabilities:\n\n- Parse **`tokenizer.chat_template`** for suspicious directives and trigger logic\n- Detect **trailing bytes** ,**padding tricks** ,**zero-scale steganography blocks** , and**ZIP polyglots** in test samples\n- Emit **YARA** rules and**MITRE** mappings in the full write-up\n- **`sanitize`** path: rebuild a GGUF with**unchanged weights** and stripped malicious metadata or tail bytes\n\nFor teams already standardizing on **llama.cpp**, pair static scans with the version hygiene we outline in [local model runtime guides](https://explainx.ai/blog/what-is-llama-cpp-run-models-locally-2026) — old runtimes will not fix a poisoned file you already downloaded.\n\n### Practical pipeline before production\n\n1. **Pin** org, commit, and file hash — avoid “latest” on squat names (`qwen3.8-cyber-uncensored` style).\n2. **Run gguf-radar** (or internal equivalent) in CI when a model artifact changes.\n3. **Diff**`tokenizer.chat_template` against a known-good export from the upstream lab when possible.\n4. **Deny** auto-exec of model-printed shell one-liners in agent harnesses; require human approval ([loop engineering for agents](https://explainx.ai/blog/loop-engineering-coding-agents-claude-code-guide-2026) ).\n5. **Re-scan mirrors** in object storage — S3 copies retain poisoned tails.\n\n## How this compares to earlier Hub malware waves\n\nHugging Face has seen **impersonation repos** and **pickle exploits** for years. A [2024 HiddenLayer report](https://www.csoonline.com/article/4169407/malicious-hugging-face-model-masquerading-as-openai-release-hits-244k-downloads.html?ref=explainx) described a fake OpenAI-named project with hundreds of thousands of downloads and an infostealer in Python loaders — a different delivery path than **in-GGUF** templates.\n\nWhat changed in **November 2026** is specificity to **GGUF + local inference + agents**:\n\n- Attackers target developers who **skip Python `pip install`** and only drop a`.gguf` into**Ollama** or**llama-server**\n- **Chat templates** become the social-engineering layer for**coding agents** that trust “system” blocks\n- Scale is smaller in download count (**2,428** vs six-figure pickle campaigns) but**higher intent per victim** when agents execute commands\n\nHugging Face’s own [security tradeoff essay](https://explainx.ai/blog/hugging-face-open-source-ai-security-tradeoff-solaiman-2026) framed openness vs scanning costs; this incident is the local-weight version of that tension.\n\nOpen-weight model supply chain from download to agent tool execution\n\n## What the disclosure emphasizes\n\nMalspark and prior GGUF-template research (for example Pillar Security’s July 2025 write-up, cited in the post) stress the same builder takeaway: **loaders stop at the last tensor**, so anything appended afterward stays on disk but off the inference path until something else reads it. Static **tail audits** and **template diffs** belong in the workflow before `llama-server` loads a new file.\n\nMalspark’s author argues downloads are a **lower bound** on exposure because mirrors and offline shares are invisible to Hub metrics. That matches how [supply-chain typosquats](https://explainx.ai/blog/fake-claude-app-revstealer-crypto-malware-2026) spread outside official store counts.\n\n## What Hugging Face users should do now\n\n**If you already pulled one of the named repos**, stop serving it, delete local copies, rotate secrets on that host, and inspect browser and API keys. Malspark published **indicators and YARA** in its long-form post — use those for disk hunts.\n\n**If you distribute GGUF internally**, add gguf-radar (or your vendor scanner) to the **release job** that uploads artifacts. Document template diffs in changelogs the same way you would for weight updates.\n\n**If you build agents**, treat model output that contains **PowerShell**, `curl`, or `wget` lines as **untrusted** unless a human pins the command. For production agent deployments, [AgentBeam](https://agentbeam.com/?ref=explainx) helps stop agents from executing dangerous tool calls — the same failure class as trusting a poisoned template.\n\nFor enterprise buyers, this is another reason [Hub Marketplace billing](https://explainx.ai/blog/hugging-face-hub-google-cloud-marketplace-billing-2026) does not replace **artifact review** — procurement convenience is not malware control.\n\n## Is my downloaded GGUF safe to load?\n\nThere is no Hub badge that guarantees a file is clean. Malspark’s methodology scanned **every public repository metadata surface** it could reach at scan time, then deep-read suspicious GGUF tails and templates. Your workstation needs a **smaller version** of that habit:\n\n**Check provenance first.** Prefer models from the lab that trained them, with signed release posts. Forks that add “uncensored” or version numbers that do not match any official card should trigger extra review — several timdedid names followed that pattern in the disclosure.\n\n**Static scan before load.** Clone gguf-radar and run its inspect command on the file path your runtime will open. You are looking for two red flags: `(a)` template strings that mention system directives, PowerShell, or download URLs, and `(b)` file size larger than tensor math predicts. Malspark’s Mir2k samples used padding so a naive `tail -c 4096` check would miss payloads.\n\n**Never pipe model text to a shell.** If a local model prints a one-liner “fix,” paste it into a review buffer, identify what filesystem paths it touches, and assume compromise if it reads from the GGUF path itself. Agent frameworks that auto-approve “obvious” fixes are the threat multiplier timdedid targeted.\n\n**Rotate after exposure.** If you already served a named malicious repo, treat the host as untrusted until you rotate API keys, SSH keys, and browser profiles on that machine. The ollie family Malspark describes behaved like commodity RAT tooling aimed at broad credential theft, not mining alone.\n\n**Report upstream.** Hugging Face’s community reporting flow is the official removal path. gguf-radar’s YARA rules help security teams hunt mirrors in artifact stores that never hit public download counters.\n\nTeams training staff on [corporate AI adoption](https://explainx.ai/workshops) should add **model artifact review** beside prompt policy — the attack does not touch cloud APIs if weights never leave a laptop.\n\n## Related reading\n\n*GGUF layout details, download totals, and campaign names follow Root0ne’s Malspark post and gguf-radar repository as of November 27, 2026. Hugging Face removal status may change after publication.*", "url": "https://wpnews.pro/news/gguf-malware-on-hugging-face-hidden-payloads-and-chat-template-poisoning", "canonical_source": "https://explainx.ai/blog/gguf-malware-hugging-face-chat-template-gguf-radar-november-2026?utm_source=rss&utm_medium=feed&utm_campaign=blog", "published_at": "2026-11-28 00:00:00+00:00", "updated_at": "2026-11-28 07:11:52.011815+00:00", "lang": "en", "topics": ["ai-safety", "large-language-models", "ai-agents", "ai-tools", "machine-learning"], "entities": ["Hugging Face", "Root0ne", "Malspark", "gguf-radar", "llama.cpp", "Ollama", "Mir2k", "timdedid"], "also_reported_by": [], "takeaway": "Scan GGUF files with gguf-radar before loading: five Hub repos hid a Windows RAT named ollie in bytes after the last tensor and used Jinja2 chat templates to inject fake [SYSTEM DIRECTIVE] blocks that push shell-capable agents to execute remote scripts.", "recommendation": {"advice": "Scan every downloaded GGUF with gguf-radar before loading it, and treat model-suggested shell commands as untrusted input behind tool approval gates.", "playbook": "agent-security", "playbook_url": "https://wpnews.pro/playbooks/agent-security"}, "alternates": {"html": "https://wpnews.pro/news/gguf-malware-on-hugging-face-hidden-payloads-and-chat-template-poisoning", "markdown": "https://wpnews.pro/news/gguf-malware-on-hugging-face-hidden-payloads-and-chat-template-poisoning.md", "text": "https://wpnews.pro/news/gguf-malware-on-hugging-face-hidden-payloads-and-chat-template-poisoning.txt", "jsonld": "https://wpnews.pro/news/gguf-malware-on-hugging-face-hidden-payloads-and-chat-template-poisoning.jsonld"}}