Independent AI intelligence Two editions daily · ET
Fervor AI

Analysis · November 28, 2026 · repo

gguf-radarMalsparkHugging Facelocal-aiagent-securitymcp-securityai-skills

GGUF Radar Checks the Part of a Local Model Nobody Reads

Poisoned chat templates and programs hidden after the weights reached 2,428 downloads on Hugging Face. Here is the check to run before you load a model.

Most people treat a downloaded model as data. You pull a big file, point llama.cpp or LM Studio at it, and the worst you expect is bad answers.

That picture is missing a piece. Most chat models in GGUF, the single-file format most local models ship in (weights plus settings in one download), carry a chat template: a small program that rewrites your conversation before the model ever reads it. Runtimes that use it run it on every prompt. Almost nobody reads it.

This week a security researcher showed what happens when someone does read it, for the wrong reasons. A scan of every public Hugging Face model repository found models whose templates tell the model to print a PowerShell command, and one campaign that hid a Windows remote access trojan inside the model file itself.

The same researcher released gguf-radar, an open-source scanner that checks those templates and the hidden corners of a GGUF file without running anything. The idea worth taking from it is simple: a model file is code plus weights, and the code part deserves the same suspicion as any script you download.

What turned up on Hugging Face

Malspark scanned all 3,273,389 public model repositories on November 26, including 226,310 GGUF repositories, reading only file headers and endings rather than downloading the weights. After removing security test repos and harmless samples, five malicious models remained. Together they had 2,428 downloads as of November 27, up from 1,502 a day earlier.

Hugging Face counts downloads, not people, so the number of affected users is at most that figure. When I checked the largest Mir2k model on November 28, Hugging Face showed "Access to this model has been disabled" on its page.

There were two actors.

Mir2k uploaded two "uncensored" models, one on November 22 and one on November 24. Each carried a Windows program appended after the model data, with a clean template at first. For days, the payload sat in the file with nothing to start it. On the morning of November 26, both templates were rewritten so the model begins every answer with one PowerShell line. That line finds the model file on disk, reads its last few megabytes, writes them out as an executable and runs it. The same account created twelve empty repositories named after models people are waiting for, such as Qwen4-27B and DeepSeek-V4, ready to fill later.

According to Malspark's static analysis, the recovered program steals saved browser passwords, targets the Phantom and MetaMask wallet extensions, logs keystrokes and mines Monero over Tor. It names its folder ollie, close enough to Ollama to look familiar.

timdedid published three copies of a small Qwen3 model aimed at security users. Its template is the official one with an addition near the end: when your message contains "What is", it inserts a fake [SYSTEM DIRECTIVE] telling a coding agent to call its PowerShell tool, download a script and run it in a hidden window. The README even advises against replacing the embedded template.

The second attack needs no hidden bytes at all. It only needs you to run the model inside an agent that has a shell.

How a model file hides things

A GGUF file works like a shipping box with a packing list taped to the top. The header and the tensor table are the packing list: they say exactly where each tensor (one block of the model's weights) sits inside the box. Loaders such as llama.cpp read only the byte ranges the list points to.

Anything packed after the last listed item is never touched. It doesn't change how the model loads, and no runtime warns about it. That is where Mir2k put its program, once as a plain executable followed by half a megabyte of filler (so scanners that look at the last few kilobytes see nothing), and once compressed so no recognizable file signature remained.

The chat template lives in the packing list itself, under the metadata key tokenizer.chat_template. It is written in Jinja2, a templating language, and C++ runtimes render it in a restricted engine, so it can't reach your operating system directly. It doesn't need to. It can add text to the conversation that never appears in your chat window, and that text can tell the model what to say or tell an agent what to run.

Malspark also reproduced three more hiding places in the lab: oversized alignment padding, a ZIP archive glued to the end so the file is also importable Python, and data tucked into blocks of weights whose scale is zero (blocks that decode to all zeros no matter what bytes they hold). None of the live malware used those yet.

What gguf-radar does

The tool does three jobs. Two of them, scanning and rebuilding, are in the v0.1.2 release from November 28. The third, comparing templates, landed on the main branch after that release, so it isn't in v0.1.2 yet.

It scans. gguf-radar scan parses the chat template into a syntax tree without running it and flags file reads and writes, decompression, process starts, download commands and hidden conditional directives. It then works out where the model data must end and reports anything after that point, plus non-zero padding and suspicious bytes in zero-scale blocks. It works on local files and on Hugging Face repos, where it downloads only the header and the end of each file (HTTP range requests, which fetch chosen byte ranges instead of the whole file). It also checks the template files of Safetensors and PyTorch models.

It compares (main branch only, for now). gguf-radar compare-template checks the template in a GGUF file against the template of the model it was converted from. A converter copies the template unchanged, so any difference means someone edited it. This check doesn't depend on known patterns, which matters because pattern matching is the scanner's weak spot.

It rebuilds. gguf-radar sanitize writes a new file with standard 32-byte alignment, zeroed padding and everything after the last tensor removed. The dequantized weights stay identical, according to the project.

Every scan ends with one of four verdicts: CLEAN, SUSPICIOUS, MALICIOUS or ERROR. The exit code is 0 for clean, 2 for suspicious or malicious, and 1 for an error, so it can fail a CI job.

Put this into practice

You need Python 3.10 or newer. The tool installs from GitHub, not PyPI, so pin what you install. For scanning and rebuilding, pin the release tag:

pip install git+https://github.com/Root0ne/gguf-radar@v0.1.2

For compare-template, which isn't in a release yet, pin the main-branch commit you reviewed instead (this was the latest on November 28):

pip install git+https://github.com/Root0ne/gguf-radar@a46a65c249c6eee04f0d4f51528b991fac19c231

1. Scan what you already have. Point it at the folder where your models live:

gguf-radar scan ~/models/

Most results should come back CLEAN. Treat SUSPICIOUS as a reason to read the template, not as proof of an attack; the limitations doc says a harmless template can match a pattern, and evenly spread small weights can look like encrypted data.

2. Scan before you download. For a model on Hugging Face, scan the repo first. It reads only the start and end of each file, a few megabytes for a model that is many gigabytes, and checks up to 20 GGUF files per repo (--max-files changes that). Gated or private repos need a Hugging Face token:

gguf-radar scan Qwen/Qwen2.5-0.5B-Instruct-GGUF

3. Compare the template with the original. This is the check that catches templates written to dodge the patterns. It needs the main-branch install above. Name the base yourself:

gguf-radar compare-template ./model.gguf --base Qwen/Qwen2.5-0.5B-Instruct

The tool deliberately won't pick the base from the file's own metadata, because a modified file can name any repository, including one its author controls. For a Hugging Face base, the docs show pinning a revision with a tree/<commit> URL. You'll get IDENTICAL, OLDER or DIFFERENT, and a diff when they differ. Most differences are harmless. A finding that shows up only in the downloaded file is the strongest reason to distrust it.

4. Strip what you don't need. If a file is flagged for hidden bytes:

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

One catch: sanitize removes hidden data but keeps the chat template unless you replace or remove it. The Python API shows sanitize_gguf_file(..., strip_template=True) for that.

5. Take the embedded template out of the loop. Once you've reviewed a template, run with your copy instead of the file's. In llama.cpp's server, --chat-template-file sets a custom Jinja template in place of the one in the model's metadata:

llama-server -m clean.gguf --jinja --chat-template-file reviewed.jinja

Malspark's write-up recommends the same for Ollama, using the TEMPLATE instruction in a Modelfile. Either way, a template change upstream can no longer reach you silently.

6. Gate it in CI. If your team keeps an internal model registry, scan on the way in. The project's docs give a GitHub Actions step that runs gguf-radar scan ./models/ --json gguf-radar-report.json, pins @v0.1.2, and keeps the report as an artifact. Pinning matters here: a new version shouldn't change your results without notice.

7. Treat model-suggested commands as untrusted. This one costs nothing. If a model starts an answer with a command you didn't ask for, don't run it. If it's wired to an agent with a shell, the agent shouldn't either, which means an allow list or an approval step on shell tools.

Honest limitations

It finds known patterns. The template check looks for patterns seen in real attacks. A template written to avoid them can pass, especially one that changes behavior only in some situations, such as when tools are present. compare-template covers that gap, but only if you name a trustworthy base. If the original repository is itself malicious, the comparison tells you nothing.

It doesn't check what the model learned. A model trained to give harmful answers can have a perfectly normal file and template. That needs different tools.

Some formats are skipped. Quantization formats are the compressed number formats a GGUF stores weights in, and several are not inspected, including the whole IQ family and the ternary and 1-bit formats (full list). sanitize doesn't clear hidden data in them either. The zero-scale check also needs the whole file, so it doesn't run on Hugging Face scans.

It's new, and moving fast. Version 0.1.2 shipped on November 28, the template comparison isn't in a release yet, and the repo had about 170 stars when I checked. The research, the indicators and the fix all come from one researcher. That doesn't make them wrong, and the write-up is unusually specific, but nobody has independently replicated the scan yet.

A clean result is a snapshot. The project's own words: "A clean result is not a guarantee." Repos change after you check them, which is exactly how Mir2k worked. Rescan on update.

The model file is code

The habit to build is the one you already have for scripts. You wouldn't pipe a stranger's shell script into bash because the file was called model. A GGUF file deserves the same pause, because part of it runs on every prompt you send.

Scan it, compare its template to the original, pin the one you reviewed, and keep your agent away from commands a model suggests. That's ten minutes the first time and a CI step after that.

Sources: Malspark, "GGUF LLM Models with Hidden Malware on Hugging Face Reached 2400+ Victims" (November 27, 2026) · Root0ne/gguf-radar, reviewed at v0.1.2 (README, docs/limitations.md, docs/scanning.md, docs/ci-and-python.md) and main at commit a46a65c (src/gguf_radar/cli.py, docs/comparing-templates.md) · llama.cpp server README · Ollama Modelfile reference