IntermediateAI

Five Poisoned GGUF Models on Hugging Face Hid a Windows Trojan

A scan of every public model repository on Hugging Face found five GGUF files that hid malware or poisoned chat templates, with 2,428 downloads between them before the platform disabled the repositories. Malspark, the security project behind the open-source gguf-radar scanner, published the findings on November 27, 2026, after scanning 3,273,389 repositories the previous day. Hugging Face counts downloads rather than people, so the number of affected users is at most that figure, and the report does not confirm a single infection.

A Hugging Face model page for timdedid/qwen3.8-cyber-uncensored beside a code view of its chat template, annotated to mark a dormant trigger on the phrase 'What is', an injected system directive, and a PowerShell download stage
The chat template from one of the timdedid models, annotated by Malspark to show the trigger phrase and the injected system directive. Image credit: Malspark

What the Scan Found

The scan covered 226,310 GGUF repositories holding 2.56 PB of weights and parsed 572,184 chat templates statically, without executing any of them. Headers and file ends were read through HTTP Range requests, so no model was downloaded in full. Manual review then removed security test repositories, harmless persona prompts and published research samples, leaving five that were still online on November 27.

Repository Campaign Method Downloads
Mir2k/Huihui-Qwen3.5-9B-abliterated-GGUF Mir2k Reply prefix with hidden executable 1,488
Mir2k/Inkling-2-Mini-Uncensored-GGUF Mir2k Reply prefix with hidden compressed executable 458
timdedid/qwen3.8-cyber-uncensored timdedid Tool hijacking 271
timdedid/qwen3-cyber-UNCENSORED-2 timdedid Tool hijacking 136
timdedid/qwen3-cyber-UNCENSORED timdedid Tool hijacking 75

The five repositories had 1,502 downloads when the scan ran on November 26. Malspark counted 2,428 the next day, and by November 29 the counters on the disabled pages showed 2,807. Almost all of the growth came from the two Mir2k models.

How the Attack Works

A GGUF file begins with a header and a metadata table, then a tensor table, then padding, then the weights. Loaders such as llama.cpp and LM Studio read exactly the byte ranges the header points to and ignore everything else, including anything appended after the last tensor. The chat template lives in the metadata under tokenizer.chat_template, and the runtime passes every conversation through it before the model sees it.

Both halves matter. A template is a small Jinja2 program, and C++ runtimes execute it in a restricted engine with no Python behind it, so classic template injection that reaches the operating system does not apply. Ordinary template logic can still insert text the user never sees. In the Mir2k models the template added a French system message instructing the model to open every reply with one PowerShell line, copied character by character. In the later version of that line, the command finds the largest .gguf file in the user profile, reads its last bytes and writes them to %TEMP%\d.exe.

The two halves were uploaded separately. Mir2k created 14 repositories on November 22, twelve of them empty placeholders named after models that had not shipped yet, including Qwen4-27B and DeepSeek-V4. The first real upload carried the executable after its last tensor under a clean template; a second model on November 24 carried the same program compressed with raw Deflate, which strips recognizable file signatures. On the morning of November 26 both templates were replaced within about an hour, and replaced again nine hours later. Files downloaded before that morning contain the payload but nothing to start it.

Diagram of a GGUF file split into header, padding, tensor data and appended bytes, with the two places used by real malware marked, and a second row showing the same file after gguf-radar rebuilds it with the template checked and the appended bytes removed
Where data can hide in a GGUF file, and what gguf-radar removes on rebuild. Image credit: Malspark

The second account, timdedid, targeted agents instead of people. Its three repositories held byte-identical copies of a small Qwen3 model, and the template watched for the words “What is” in the latest message. When they appeared it inserted a fake [SYSTEM DIRECTIVE] ordering an agent with shell access to fetch a script from a WordPress site and run it with PowerShell. Nobody had to paste anything. Malspark could not recover the second stage, so what it would have installed is unknown.

Detection, and What Disabling Does Not Fix

Malspark released gguf-radar alongside the report. The tool parses a model file statically, checks the chat template for the patterns these campaigns used, and flags bytes after the last tensor; for Hugging Face models it downloads only the small ranges it needs. It can also rebuild a clean GGUF with the weights unchanged, which is the practical option for a file whose payload sits outside the tensors.

A hex editor view of a model file with an MZ executable header and a pattern list naming outer_ollie_pe, miner_agent and tor_04916, showing an embedded Windows program inside the GGUF file
A Windows executable recovered from inside a model file, seen in the ImHex hex editor. Image credit: Malspark

The files passed the checks that exist. Malspark reports that antivirus engines and pickle scanners raised no alert on either Mir2k file, which follows from where the payload sits: appended after the weights, and in one case compressed, so a scanner that reads the last few kilobytes sees filler. Pickle scanning looks for unsafe deserialization in .bin and .pt files, not for executable bytes in a GGUF. The template half is not unique to GGUF either; Safetensors and PyTorch models carry the same kind of template in tokenizer_config.json or chat_template.jinja.

Disabling a repository does not reach copies that already exist. Reporting on November 29 found an Ollama mirror of the timdedid model still listed, and every file downloaded before the takedown is still on disk. The technique is not new either: Pillar Security demonstrated poisoned GGUF templates in July 2025, and a 2026 paper measured the attack across 18 models and four inference engines, including trigger phrases that stay dormant and hijacking of an agent’s tool calls. Pillar said at the time that responses from vendors including Hugging Face and LM Studio indicated they did not treat it as a flaw in their platforms.

What This Means

The usual reassurance about local models is that weights are data, and data does not run. That holds for the tensors and not for the rest of the container. A GGUF file is data plus a template that the runtime applies on every turn, and the template can steer both a person and an agent. The dangerous configuration is not a laptop running inference. It is an agent with shell access reading a model’s output as instructions, which is exactly the setup the timdedid files targeted.

For readers who download open weights, the practical rule is to treat a model file as untrusted software rather than as a document. That means checking provenance and repository history, scanning before first use, and being more careful with uncensored or abliterated builds from new accounts, which is where both campaigns operated. The download count is not a safety signal: 2,428 downloads accumulated across files that were live for less than a week.

It also puts a number on a risk that has been discussed mostly in the abstract. Five malicious files in 3.27 million repositories is a small fraction, and there is still no confirmed infection. The interesting part is not the rate. It is that the attack needed no vulnerability in the loader, no malicious pickle and no compromised account, only the parts of the format that were designed to be flexible.

This post was drafted with AI assistance and reviewed by RITS staff.

Sources

Related stories

deepseek

A 763B Model in 2 Bits: What ISTA-DASLab’s GGUFs Give Up

ISTA-DASLab published non-uniform GGUF quantizations of DeepSeek-V4.1-Flash-1017 on October 23, 2026, compressing a 763.2-billion-parameter mixture-of-experts model to 1.75, 2.00 and 2.25 bits per weight under an MIT licence. The lab’s benchmark table says the middle build gives up nothing: 100.0% of the base model’s task average across AIME25, GPQA-Diamond and LiveCodeBench v6. The runtime built […]

AI

LiteLLM Backdoored, LM Studio Flagged: AI Tools Face Supply Chain Threats

Two major security incidents hit the AI developer ecosystem within hours on March 24, 2026: backdoored versions of LiteLLM, the popular LLM API proxy, were published to PyPI carrying a multi-stage credential stealer, while LM Studio users reported Windows Defender flagging the local AI tool as a trojan. Together, the incidents underscore how the software […]

Never miss a RITS update

Subscribe to the RSS feed for AI, emerging technology, and digital scholarship news curated for the NYU Shanghai community, or get in touch to suggest a story.