Key Takeaways
- Malspark found five malicious GGUF files among 226,310 GGUF repositories (2.56 PB of weights) after scanning 3,273,389 public Hugging Face repos; those five repos logged 2,428 downloads before being disabled.
- Attackers combined two techniques: poisoned chat templates (hidden reply prefixes that could execute commands) and hidden executables appended after the last tensor in GGUF files, enabling normal model behavior while carrying a trojan.
- Provenance and static metadata controls stop most attacks: mirror and pin external models, require signed manifests, and run GGUF scanners such as gguf-radar to detect trailing bytes and suspicious metadata before promotion.
- Runtime least-privilege is mandatory: run untrusted community models in isolated VMs/containers, restrict filesystem and network access, and enforce constrained tool identities and policy-gated execution to prevent silent escalation.
On November 27, 2026, the Malspark project disclosed five malicious GGUF models on Hugging Face, two of them with a Windows trojan appended after the last tensor. [4][5]
The scan covered 3,273,389 public model repositories, including 226,310 GGUF repos that held 2.56 PB of weights. [7]
All five malicious files were later disabled, but their pages had already logged 2,428 download events. [4][6][7]
The models combined two paths: poisoned chat templates that silently injected commands, and hidden executables that local tools could extract from the GGUF tail. [4][5][8]
Mir2k targeted Windows users with an “ollie” RAT, and timdedid targeted coding agents with terminal and remote tools. [4][5][7]
For teams running llama.cpp, Ollama, LM Studio, or custom agent harnesses, this is a concrete model supply chain compromise. [4][8]
💡 Goal: Assume some community models are hostile, and design tooling so a poisoned GGUF cannot quietly take over agents or workstations. [4][12]
1. Incident recap: what the five malicious GGUF models actually did
Key facts:
- Scan scope:
- Static analysis of 572,184 chat templates, no model execution, flagged five GGUF repos as malicious. [7]
- All five later disabled for policy violations. [3][7]
Two connected attack techniques
-
Chat template poisoning
- GGUF stores a Jinja2 chat template at
tokenizer.chat_template. - Attackers modified it so every request received a hidden prefix.
- In Mir2k models, the prefix was a PowerShell line that appeared above the visible answer.
- If users copied that line into PowerShell, it unpacked and executed a Windows binary from the same GGUF file. [4][5][8]
- GGUF stores a Jinja2 chat template at
-
Trojan bytes after the last tensor
⚠️ Key point: The weights were valid. The exploit used the container format and template, pieces that many teams never inspect. [4][7]
Who was targeted and how
Malspark attributed two repos to Mir2k and three to timdedid. [4][7]
-
Mir2k campaign
-
timdedid campaign
Downloads, not victims
- 2,428 download events across the five repos by November 27, 2026. [4][6][7]
- Breakdown:
- Hugging Face counts downloads, not devices or confirmed infections. Victim count is at most this number and probably lower. [3][4][7]
Timeline and stealth
- Mir2k uploaded the Huihui and Inkling models in late November.
- Initial revisions already carried the embedded trojan, but with clean templates. [5][8]
- On November 26, Mir2k updated templates to add the PowerShell prefix, making the trojan reachable through normal chat. [5][7]
- Early testers could see benign behavior, then later pull a revision that behaved differently, under the same filename and branding. [5][8]
Uncertain impact and missing payloads
- Reports describe plausible paths to password theft and wallet targeting, but no measured victim count. [1][2][4]
- For timdedid, the remote second stage payload was not recovered. [4][6][7]
📊 Mini conclusion: Five malicious files among millions is small statistically, but they targeted high demand “uncensored” and “cyber” niches that local LLM users actively seek. Operational risk is real. [7][8]
2. Threat model: model supply chain risk for local LLM stacks
The GGUF case is a classic ML supply chain attack. The attacker uploads a poisoned artifact and waits for someone to pull and run it. [4][5]
Teams that auto download GGUF models into llama.cpp, Ollama, LM Studio, KoboldCpp, or homegrown runners face this risk directly. [4][8]
More broadly, enterprises building conversational AI, AI agents, and agentic AI on top of large language models such as GPT, GPT-4, BERT, and ChatGPT, from providers like OpenAI, led by Sam Altman, and Anthropic, already face threats such as prompt injection, model poisoning, ML supply chain attacks, data exfiltration, and hallucination. DevOps, MLOps, and LLMOps teams manage complex pipelines with Infrastructure as Code, experiment tracking, and continuous monitoring, so this risk belongs in mainstream security strategy.
As Model Context Protocol (MCP) and similar standards let agents coordinate tools across clouds, and as models like o3 or advanced generators reach or exceed GPT-4 level abilities, the blast radius of compromise grows. Hosted routers and orchestration layers that connect LLMs, agents, and downstream tools become part of the security boundary.
From unsafe serialization to poisoned containers
- JFrog showed that some Hugging Face models using Python pickle could execute arbitrary code during deserialization. [10]
- In that case, loading the model artifact granted the attacker a shell. [10]
- The GGUF case extends this pattern:
⚠️ Threat class: “Model artifact as executable,” not only “model as text generator.” [4][10]
Specific risk to agentic systems
- In simple chatbots, malicious templates skew content.
- In coding assistants or shell agents, model output often flows straight into tools. OWASP calls this unsafe output handling. [9]
- In the GGUF campaigns, prompt injection was baked into the system prompt via templates, not added by a user query. [7][8][9]
- For timdedid, trigger phrases like “What is” caused the template to inject a hidden directive to a shell capable agent, instructing it to download and run remote code. [4][8][9]
Cloud and router side exposure
- Analysis of around 2 million canary prompts sent to inference providers found that some hosts logged or leaked prompts marked for zero data retention. [11]
- OpenRouter removed three providers and 125 endpoints from zero retention eligibility as a result. [11]
- This shows that even when you never download weights, you inherit supply chain risk from routing, logging, and vendor practices. [11][12]
Adversaries already experiment with AI
- Anthropic reports attempts by state sponsored and criminal actors to use LLMs for cyber operations, fraud, and surveillance. [13]
- As models and tooling become central to workflows, compromising hubs, routers, or templates becomes attractive to such actors. [12][13]
💼 Mini conclusion: Treat model artifacts, templates, hosted channels, and agent tools as potential entry points, especially when outputs can reach shells, build systems, or production data. [9][11][13]
3. Artifact provenance: verifying who you pull from and what you run
Treat GGUF files like binaries or container images, not like static datasets. [10][12]
You would not run a random :latest Docker image from an unknown author in production. Apply the same policy to models. [10][12]
Repository trust policies and mirrors
Malspark found only five poisoned GGUF repos, but all used names like “uncensored,” “abliterated,” or “cyber,” terms that attract users seeking “no guardrails” models. [4][7][8]
Practical defenses:
- Maintain allowlists of trusted publishers, such as official orgs or vetted community authors. [7][12]
- Mirror external models into an internal registry; do not pull directly from public hubs in production. [10][12]
- Pin by checksum and require signed manifests for promoted versions. [10][12]
One midsize SaaS firm discovered engineers copying GGUF URLs from blogs into ollama pull on corporate laptops. Their first fix was an internal model catalog backed by a mirror and scanners, and blocking direct Hub downloads from office networks.
Integrating scanners such as gguf-radar
The Malspark author released gguf-radar, which:
- Parses GGUF headers and metadata.
- Detects extra bytes beyond the last tensor.
- Can reconstruct a clean GGUF that drops trailing payloads while preserving weights. [4][5]
Integrate such tools into CI:
- Fetch or mirror the GGUF.
- Run
gguf-radaror equivalent. - Fail if:
Every artifact in the loading chain
Earlier malicious cases involved tokenizers and adapter checkpoints using pickle. [10]
Apply provenance controls to:
- Primary model weights.
- Tokenizers.
- LoRA or QLoRA adapters.
- Custom loaders and inference plugins.
- Post processing code that runs in process with the model. [10][12]
⚡ Mini conclusion: Govern models like container images. Mirror, sign, and scan them. Make direct Hub pulls into local runners an internal anti pattern. [10][12]
4. Metadata and template review: static defenses against poisoned GGUF
Even with provenance controls, metadata can carry attacks. Malspark statically parsed 572,184 chat templates to find prompt injection patterns without running models. [7][8]
This is cheap and catches reply prefixes and trigger based injections. [7][8]
How the reply prefix worked
- In Mir2k files, the chat template forced the conversation to begin with a PowerShell command, then the normal answer. [5][8]
- The hidden command unpacked and ran the “ollie” binary from the GGUF tail. [4][5]
A template auditor can search for:
- Unconditional shell or PowerShell commands at the start of assistant replies.
- URLs combined with
Invoke-WebRequest,curl, orwget. - Instructions to “copy and paste this into your terminal.” [5][8][9]
Regular expressions and Jinja2 AST checks can detect most cases. [8][9]
Agent tool hijacking via templates
- timdedid templates targeted coding agents with terminal tools.
- When user input contained phrases like “What is,” the template injected an invisible
[SYSTEM DIRECTIVE]to the agent. [4][8] - That directive told the agent to invoke a shell tool with attacker commands. [4][8][9]
Therefore, you must audit:
Input sanitization concepts from web security now apply to templates and tool specs. Normalize encodings, watch for homoglyphs, and block obvious attempts to embed shell instructions in metadata.
Building a template auditing pipeline
A robust GGUF import pipeline should:
- Parse GGUF headers and extract
tokenizer.chat_templateand related fields. [4][7] - Lint templates for:
- Block promotion if linting fails, unless a human reviewer explicitly approves. [9][12]
OWASP lists prompt injection and insecure output handling as top LLM risks. Static scanning of templates is a form of input validation for models. [9][12]
📊 Mini conclusion: Treat chat templates as code paths that run on every request. If you would not auto merge a third party shell script, do not auto promote an unreviewed template. [7][8][9]
5. Least privilege inference: sandboxing local models and agents
Even with strong provenance and template scanning, some malicious artifacts will pass. Runtime isolation and least privilege are the final barrier. [9][12]
The GGUF case illustrates what happens when a local runner or agent has full workstation access. [4][5][8]
Sandbox the runtime
Analysts report that the “ollie” RAT targeted:
- Saved browser passwords.
- Browser based cryptocurrency wallets such as Phantom and MetaMask. [6]
To reduce impact:
- Run community GGUF models in containers, OS sandboxes, or dedicated VMs. [6][9]
- Block direct access to browser profiles, password stores, home directories, and wallet files. [6][9]
- Restrict outbound network access to what the application actually needs. [9][12]
One fintech team had run uncensored models on the same laptops used for personal banking. After the incident, they moved local runners into isolated desktop VMs without shared clipboard or disk mounts.
Least privilege tool wiring
For agent stacks:
- Give each tool a constrained identity, not a shared wide scope token. [9][12]
- Examples:
- Route model suggested commands through a policy engine that treats them as untrusted. This aligns with OWASP guidance on validating LLM outputs before execution. [9]
Guarding secrets in hosted inference
Since some “zero retention” prompts were logged or exposed, teams have been advised to:
- Rotate all secrets that appeared in those prompts.
- Reevaluate which tools route through third party hosts. [11]
For both local and hosted LLMs:
- Never expose production secrets directly to models without additional checks.
- Use DLP style guards to prevent accidental inclusion of keys or credentials in prompts. [11][12]
Many controls can extend from existing data science, MLOps, and DevOps practice. The same experiment tracking, continuous monitoring, and Infrastructure as Code that govern classic ML now need to cover LLMOps and agentic systems that mix weights, templates, and tools.
⚠️ Mini conclusion: Assume some models and agents will be malicious. Design pipelines so that a single compromised GGUF cannot escalate from a download to a workstation breach or silent data exfiltration.
Conclusion
The malicious GGUF incident shows that:
- Attackers already weaponize model formats and templates. [4][5][7]
- Popular community hubs are part of your software supply chain. [4][7][8]
- Local runners and agent frameworks can turn template level prompt injection into real code execution. [4][8][9]
A practical defense stack combines:
- Provenance controls: allowlists, mirroring, signatures, and artifact scanners such as
gguf-radar. [4][5][10][12] - Metadata and template review: static linting of chat templates, system prompts, and tool wiring. [7][8][9][12]
- Least privilege inference: sandboxed runtimes, minimal tool permissions, and strict handling of secrets and outputs. [6][9][11][12][13]
Treat models as executable artifacts, not just text generators, and extend familiar supply chain and runtime security patterns to LLMs. That approach will not eliminate all risk, but it will turn future malicious GGUF files into contained incidents instead of full scale compromises.
Frequently Asked Questions
How did the malicious GGUF models in the Malspark incident actually deliver malware?
What provenance and static checks should teams enforce before using community GGUF models?
What runtime defenses prevent a compromised GGUF from becoming a workstation breach?
Sources & References (13)
- 1Five Malicious GGUF Models Found on Hugging Face | Zeniteq
Five Malicious GGUF Models Found on Hugging Face | Zeniteq Skip to content Loading Loading Zeniteq is now available on mobile for iPhone, iPad and Apple Watch . Download now Learn more Listen AI narra
- 2Hugging Face GGUF Models Hid a Windows Trojan
Hugging Face GGUF Models Hid a Windows Trojan Hugging Face GGUF Models Hid a Windows Trojan. SHARE The Windows trojan was already inside the model. What came later was the invitation to run it. On Nov
- 3Open-source security project Malspark says five GGUF models on Hugging Face were malicious, two with hidden malware; Hugging Face pages now show all five disabled — On The Wire
Open-source security project Malspark says five GGUF models on Hugging Face were malicious, two with hidden malware; Hugging Face pages now show all five disabled — On The Wire ← Back to Tools & Produ
- 4GGUF Malware on Hugging Face: Hidden Payloads and Chat-Template Poisoning
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 publ...
- 5GGUF LLM Models with Hidden Malware on Hugging Face Reached 2400+ Victims | Malspark
Researchers scanning Hugging Face repositories found five malicious GGUF models containing hidden Windows malware and poisoned chat templates that affected over 2,400 downloads. The campaigns used hid...
- 6centerai.eu
💡 A cybersecurity researcher has found five GGUF models on Hugging Face with malicious code, downloaded 2,428 times in total. 🤨 • 2,428 downloads from five repositories. • Specific models like M...
- 7Five poisoned GGUF models out of 3.27 million repositories
Five poisoned GGUF repositories remained online on 27 November 2026 after a scan of 3,273,389 public model repositories on Hugging Face, including 226,310 GGUF repositories holding 2.56 PB of weights,...
- 8Five Poisoned GGUF Models: A Trojan After the Last Tensor, Orders in the Chat Template
Five Poisoned GGUF Models: A Trojan After the Last Tensor, Orders in the Chat Template Par Gabriel Anhaia You ask your local model "What is a mutex?" Before the model reads your question, its own fi...
- 9Sécuriser les solutions d’IA générative
Sécuriser les solutions d’IA générative Présentation Les systèmes d’IA générative présentent un certain nombre de défis uniques en matière de sécurité. Outre le défi habituel que représente la sécuri...
- 10Malicious Hugging Face ML Models
In the realm of AI collaboration, Hugging Face reigns supreme. But could it be the target of model-based attacks? Recent JFrog findings suggest a concerning possibility, prompting a closer look at the...
- 11Inference providers leaked prompts marked zero data retention. Were our employees’ prompts exposed, and how do we keep company secrets out?
Inference providers leaked prompts marked zero data retention. Were our employees’ prompts exposed, and how do we keep company secrets out? ZDR-flagged prompts leaked at AI inference hosts: exposure ...
- 12Les 10 mesures de sécurité en matière d’intelligence artificielle : Introduction - ITSAP.10.049
Les 10 mesures de sécurité en matière d’intelligence artificielle : Introduction - ITSAP.10.049 Mai 2026 Série sensibilisation ITSAP.10.049 Mai 2026|Série sensibilisation À une époque où l’intelli...
- 13Detecting and countering misuse of AI: September 2026
Over the past eight months, our Threat Intelligence team identified and disrupted operations in which threat actors tried to use Claude for malicious activity. In this report, we share case studies fr...
Key Entities
Generated by CoreProse in 3m 37s
What topic do you want to cover?
Get the same quality with verified sources on any subject.