Coderefercoderefer
CoursesWebinarsBlogAbout
Coderefercoderefer

Discover. Learn. Automate. Grow.

Learn

  • Courses
  • Webinars
  • Blog
  • Search

Company

  • About
  • Contact
  • FAQ

Legal

  • Privacy Policy
  • Terms of Service
  • Refund Policy
© 2026 Coderefer. All rights reserved.
HomeBlogHow to Check a GGUF Model for Malware Before You Run It
ai-toolsNovember 29, 20267 min read

How to Check a GGUF Model for Malware Before You Run It

A researcher found 5 GGUF models on Hugging Face hiding a Windows RAT and poisoned chat templates, with 2,428 downloads. Here's how to scan any GGUF file first.

V

Vamsi Tallapudi

Manager, Architect Technology at Cognizant

How to Check a GGUF Model for Malware Before You Run It

A security researcher scanned 3.27 million public Hugging Face repos on November 26, 2026 and found five GGUF models carrying hidden malware. They'd been downloaded 2,428 times. Nobody's antivirus flagged them, because the malware wasn't in the weights: it was stitched into parts of the file that llama.cpp, Ollama, and LM Studio never bother to read.

If you pull GGUF files from Hugging Face to run locally, this is worth five minutes of your time. Here's what actually happened, why your GGUF loader is blind to it, and the exact commands to check a file before you run it.

What did researchers actually find?

The security firm Malspark published the finding on November 27, 2026, in a report that's since been picked up widely. Two threat actors, tracked as Mir2k and timdedid, were running separate campaigns:

  • Mir2k uploaded two "uncensored" fine-tunes (a Qwen3.5-9B abliterated model and an Inkling 2 Mini variant) with a Windows remote access trojan the researchers named "ollie" appended to the file. Combined downloads: 1,946.
  • timdedid uploaded three copies of a "cyber uncensored" Qwen3 model that used a poisoned chat template to trigger PowerShell execution instead of hiding a full binary. Combined downloads: 482.

Ollie is not a toy. It phones home over Tor, lifts saved passwords from Chrome, Edge, and Brave, hunts for Phantom and MetaMask wallet files, logs keystrokes and clipboard content, grabs webcam and screen captures, and mines Monero when your machine is idle. The folder name "ollie" sits one letter off from "Ollama" on purpose: glance at a file listing and it reads as a legitimate helper, not malware.

To be clear about scale: 2,428 downloads out of millions of models on the Hub is small, and Hugging Face counts downloads, not unique people, so the real victim count is lower than that. This isn't a hub-wide crisis. But it's a proof of concept that worked, and it's not the first time — more on that below.

Why don't GGUF loaders catch this?

Two separate tricks, and both exploit the gap between what a GGUF header declares and what a loader actually parses.

Trick one: bytes after the last tensor. A GGUF file's header tells llama.cpp exactly which byte ranges hold tensor weights. The runtime reads those ranges and stops. Anything appended after the final declared tensor just rides along in the file, unread and unexecuted by the model loader, invisible to a casual "does this load and chat normally" check. That's where Mir2k parked the ollie executable.

Trick two: the chat template itself. Every GGUF file carries a tokenizer.chat_template field, usually a Jinja template that formats your prompt before it hits the model. Mir2k's models armed that template so a normal-looking reply would include a shell command that carved the hidden bytes out of the file and dropped them into %TEMP%\d.exe. timdedid skipped the appended-binary step and just had the template inject a PowerShell one-liner directly. Either way, the user or an agent executing that output is what actually runs the malware, not the model itself.

This second trick isn't new. JFrog's security research team documented the underlying class of bug back when CVE-2024-34359 ("Llama Drama") landed a 9.7 CVSS score against llama-cpp-python versions 0.2.30 through 0.2.71 — a server-side template injection in how the library rendered chat_template values with Jinja2. That specific hole was patched in 0.2.72, and current llama.cpp, Ollama, and LM Studio aren't vulnerable to the original RCE. What's left is the softer version: the template can't execute code on its own anymore, but it can still manipulate what the model says, and what it tells an agent to do.

Pillar Security's research on poisoned templates showed exactly how far that goes — they demonstrated a backdoored Phi-4-mini template that behaved normally for jokes and general chat but injected malicious instructions specifically when a user asked for HTML. The trigger stays dormant until the right prompt shows up, which makes it close to useless to catch by just poking a model a few times after download.

How common is this really?

Less common than the headlines suggest, which is the honest answer. Splunk's research team analyzed roughly 156,838 GGUF models across about 219,000 files in January 2026 and found the template ecosystem was "largely explicit, attributable, and aligned with documented usage" — only 24 unique template values showed up across all of it, and none looked like covert manipulation. So this isn't an epidemic baked into every model on the Hub.

It is, however, a repeatable attack with a known playbook now, and the Hacker News discussion of the Malspark report makes the same point several ways: most people assumed GGUF files were just tensors and metadata, full stop. They're not. Anything riding in tokenizer.chat_template or tokenizer_config.json, or appended past the last tensor, is attacker-controlled surface that a casual download-and-chat test won't reveal.

How do I check a GGUF file before running it?

The fastest option is gguf-radar, the open-source scanner Malspark released alongside their report. It parses the chat template without executing it and checks for data sitting past the declared tensor boundary — the two exact tricks above.

pip install git+https://github.com/Root0ne/gguf-radar
gguf-radar scan ./model.gguf

It returns one of four verdicts: CLEAN, SUSPICIOUS, MALICIOUS, or ERROR. It also works directly against a Hugging Face model link, pulling only the small slices of the file it needs, so a scan takes seconds even on a 20GB model. If it flags something, you can usually get a clean copy without losing the weights:

gguf-radar sanitize suspicious.gguf -o clean.gguf

A few other checks worth doing manually, especially if you don't want to trust a brand-new tool with your supply chain:

  1. Dump the metadata. Run gguf-dump from llama.cpp's gguf-py package and actually read the tokenizer.chat_template field. If you see subprocess, os.system, base64 blobs, or PowerShell strings in a Jinja template, stop.
  2. Check the file size against the tensor math. If the declared tensors don't add up to the file size on disk, something's appended that shouldn't be there.
  3. Override the template yourself. Pass --chat-template-file with a known-good template in llama.cpp, or set TEMPLATE explicitly in an Ollama Modelfile, so whatever shipped inside the download never gets used.
  4. Prefer models you can trace. Quantizations from established uploaders (Unsloth, bartowski, mradermacher) that publish how they built the GGUF are a much smaller risk than a random "uncensored" fine-tune from a week-old account.
  5. Build it yourself when it matters. Download the original safetensors from the model's official repo and quantize locally with llama.cpp's own conversion scripts. More work, but it removes the "trust a stranger's binary" step entirely. If you haven't set up llama.cpp for this yet, our Qwen3 GGUF quantization guide walks through the build and quant flow.

Is this the same thing as a supply chain attack on a package registry?

Conceptually, yes, and it's worth treating it with the same seriousness. We've covered the pattern before with LiteLLM's backdoored release and the opencode breach: someone compromises a trusted distribution channel, and the payload rides in on something you assumed was inert. A GGUF file feels safer than an npm package because it's "just weights," but it isn't just weights. It's weights plus metadata plus a template that gets executed by whatever you wire the model up to.

If you're running local models through an agent framework that can execute shell commands or hit the filesystem, the chat template is now part of your attack surface, not just your prompt formatting. Treat it that way.

My take

Five models out of millions on Hugging Face isn't cause for panic, and I'd push back on anyone framing this as "Hugging Face is compromised." It isn't. What it is, is proof that the GGUF format has a real blind spot that two separate research teams (JFrog in 2024, Pillar in 2025) warned about before anyone actually exploited it at scale. That's the part that should bother you more than the download count. The fix took one researcher a weekend to build as a CLI tool. If you're pulling "uncensored" or niche fine-tunes from accounts you don't recognize, run gguf-radar first. It costs you thirty seconds.

FAQ

What's inside a GGUF file, and why metadata matters
ai-tools security gguf llama-cpp 2026

Comments

    Get AI tricks that save you hours every week

    New AI tools, automation workflows, and course drops — straight to your inbox. Join 2,400+ builders.

    Read Next

    Claude Code Sabotage Study: The 25% Gap Was a Timer Artifact
    ai-tools

    Claude Code Sabotage Study: The 25% Gap Was a Timer Artifact

    A preliminary study found Claude Code's quality dropped 25% under "no human reviews this" framing, then the gap vanished to zero once the session timer went from 20 to 60 minutes.

    November 29, 20267 min read
    Claude Code Hooks Tutorial: PreToolUse and PostToolUse Examples You Can Copy
    ai-tools

    Claude Code Hooks Tutorial: PreToolUse and PostToolUse Examples You Can Copy

    Copy-paste PreToolUse and PostToolUse hook configs for Claude Code: block rm -rf, protect .env files, auto-format on save, and feed test failures back to Claude.

    November 29, 20267 min read
    Is Claude Sabotaging ML Research? What Opus 5.5 Really Restricts
    ai-tools

    Is Claude Sabotaging ML Research? What Opus 5.5 Really Restricts

    Claude isn't trained to sabotage ML research. Here's what Opus 5.5 actually restricts, the 63% early-stop rate Anthropic admitted to, and how to tell a fallback from a bug.

    November 28, 20267 min read
    View all posts →