Skip to main content
search

Most people think a local AI model is just a file of numbers. On November 27, security researcher Düzgün reported on Malspark that five models on Hugging Face carried GGUF malware. Two hid a Windows trojan after the model weights, and three tried to get coding agents to run a script. Together they had 2,428 downloads.

The good news: you can check a model in seconds, for free, with gguf-radar, an open-source scanner we tested on harmless files we built ourselves. One poisoned repo even borrowed the name of Inkling 2 Mini, a model we covered this week.

Watch the 2-minute version

Made by Momentum Hub. Prefer vertical video? Watch the Short, or find more on our YouTube channel.

Key takeaways

  • A GGUF file holds the weights plus a chat template, a small program that formats every conversation before the model reads it.
  • Loaders ignore bytes after the last tensor, so a file can carry a hidden program and still run normally.
  • The main attacker uploaded the payload first and switched the template on days later.
  • gguf-radar is free and MIT licensed, and it flags both GGUF malware tricks without running the model.

2,428

Downloads of the five poisoned models by Nov. 27, 2026, out of 3,273,389 public Hugging Face model repos scanned, per Malspark.

What Happened on Hugging Face

On November 26, Malspark scanned every public model repository on Hugging Face and parsed 572,184 chat templates without running any. Five repositories from two accounts survived a manual review. The counts and the malware analysis below are Malspark’s own; we haven’t seen an independent replication yet.

On November 29, all five showed “Access to this model has been disabled” on Hugging Face. We found no public statement from the company, and a copy from one account was still listed on Ollama. This GGUF malware is rare, but the method is easy to copy.

What Is Inside a GGUF File

GGUF is the format llama.cpp, Ollama and LM Studio use to run models locally. Each file has four parts: a header with metadata, a table of tensors, padding, and the weights. Runtimes read only the byte ranges the header points to.

One metadata entry matters most for GGUF malware: tokenizer.chat_template. It’s a small Jinja2 program. Before every reply, the runtime runs your conversation through it to build the text the model sees, text you never see in the chat window. Julia Turc’s explainer goes deeper on the format:

How GGUF Malware Hides in Two Places

Trick 1: a template that whispers to your agent

Templates render in a restricted engine, so they can’t touch your operating system. These attacks didn’t need to. They used ordinary template logic to add hidden text.

  • timdedid posted three copies of a small Qwen3 model. When your message contains “What is”, the template inserts a fake [SYSTEM DIRECTIVE] telling an agent to download and run a script with its PowerShell tool.
  • Mir2k posted two “uncensored” models whose template tells the model to start every answer with one PowerShell line.

Input guardrails never see this text, a blind spot we also saw with prompt injection. Pillar Security described poisoned GGUF templates in July 2025, and a paper by Ariel Fogel and colleagues found triggered template backdoors cut factual accuracy from 90% to 15% on average across 18 models. Fogel explains the attack in this OWASP Foundation talk:

Trick 2: a program after the last tensor

The header says exactly where the model data ends. Anything after it is never read, so the model still works and no runtime warns you. That’s where Mir2k hid its GGUF malware: an 11.47 MB Windows program, padded with filler in one file so quick checks of the tail miss it, and compressed in the other. Safetensors files can’t hide bytes this way, though their template files can still be poisoned.

Plant First, Arm Later

What’s new in this GGUF malware, per Malspark, is the timing. Mir2k uploaded its models on November 22 and 24 with the payload inside and a clean template, then swapped both templates on November 26. The final line finds the largest .gguf file in your user folder, copies its last bytes to a temporary .exe and starts it.

Per Malspark’s analysis, the implant steals browser passwords, targets crypto wallets, logs keys, watches the screen and webcam, and mines cryptocurrency. Files downloaded before November 26 carry the payload without the trigger, so delete those too.

GGUF malware downloads by repository: two Mir2k models with 1,488 and 458 downloads, and three timdedid models with 271, 136 and 75
Based on Malspark’s scan of public Hugging Face model repositories. Chart by Momentum Hub.

How to Check for GGUF Malware With gguf-radar

gguf-radar parses the template without running it, works out where the model data must end, and reports anything past it. Its exit codes (0 clean, 2 suspicious or malicious, 1 error) fit a CI pipeline. It needs Python 3.10 or newer, and no token for public Hugging Face models.

pip install gguf-radar
gguf-radar scan ./model.gguf
gguf-radar scan Qwen/Qwen2.5-0.5B-Instruct-GGUF
gguf-radar sanitize suspicious.gguf -o clean.gguf

On November 29, PyPI served 0.1.3 and GitHub had 0.1.4. The tool is young, with five releases in three days, two of them fixing false alarms, so pin a version.

What our GGUF malware test showed

We built three tiny, harmless GGUF files with the gguf Python package and scanned them with version 0.1.4:

  • A clean file came back CLEAN.
  • The same file with 64 KB of plain text appended came back SUSPICIOUS.
  • A file whose template hid a [SYSTEM DIRECTIVE] behind “What is”, with a harmless command pointing at example.com, came back MALICIOUS with four findings.

Sanitize removed the extra bytes, and the rebuilt file matched our clean original byte for byte. A remote scan of Qwen’s official 0.5B GGUF repository checked nine files of up to 1.27 GB while fetching about 6.3 MB of each.

A 5-Step Checklist Against GGUF Malware

  1. Prefer the original publisher. Be wary of new accounts and “uncensored” re-uploads.
  2. Scan first. Run gguf-radar scan on new downloads, or in CI.
  3. Read the template. gguf-dump --json --no-tensors or ollama show --modelfile shows it.
  4. Pin your own template for agents. Use --chat-template-file in llama.cpp or TEMPLATE in an Ollama Modelfile.
  5. Read before you run. Never paste a command a model prints without understanding it.

For agents, our posts on testing agent skills and the Codex sandbox cover the other half: limit what an agent can touch.

Quick Questions, Answered

Does GGUF malware run when I load the file? No. Loaders ignore bytes after the last tensor. The danger is a person or an agent running the command the template asks for.

Were 2,428 people infected? Nobody knows. Hugging Face counts downloads, not people, and no source we read confirms any infections.

Can I trust gguf-radar? It’s open source and MIT licensed, but days old and from the same source as the report. Read its limitations page and pin a version.

Final Thoughts: A Model File Is Also Code

GGUF malware is rare so far: five repositories out of 3.27 million. Still, a model file carries a program that shapes every conversation. Scan before you load, pin templates for anything with shell access, and give agents the least power they need. If you’re exploring new open models on Hugging Face, make the scan part of the download.

Obada Kraishan

A Computational Social Scientist, Research Scholar, and Software Engineer specializing in machine learning, computational methods, and full-stack development. He leverages these skills to advance research and create innovative web solutions.