Skip to content
Neural Daily

ToolsNews

Malware hid in GGUF models on Hugging Face

🇭🇺 Olvasd el magyarul →

A security researcher scanned all 3.27 million public Hugging Face model repos and found five malicious GGUF models with 2,428 downloads. The models load and answer normally; the attack lives in the chat template and in bytes appended after the last tensor, where loaders never read.

· 4 min read

A gguf-radar nyílt forrású szkenner GitHub-oldala a Root0ne fiókban
Image: Root0ne · Screenshot · Source

What happened

On November 27, Düzgün of Malspark published a detailed analysis. On November 26 he scanned all 3,273,389 public Hugging Face model repositories, including 226,310 GGUF repos. Nothing was downloaded in full: HTTP Range requests read only headers and file ends, and 572,184 chat templates were parsed statically without being executed.

After manual review, five malicious repos from two accounts remained, with 2,428 downloads, up from 1,502 a day earlier. Hugging Face counts downloads, not people, so the number of affected users is at most that. All five repos were still online on November 27.

How the attack works

Two pieces combine. The first is the chat template, a small Jinja2 program in the GGUF metadata that every conversation passes through before each reply. The attackers don't escape the template engine; they simply add hidden text to the conversation that never shows up in the chat window. This half also applies to Safetensors and PyTorch models, where the template lives in a separate file.

The second is GGUF-specific. The header and tensor table define exactly where model data ends. Anything after that is never read by llama.cpp or LM Studio, and no warning is raised, so an entire executable fits there. Safetensors doesn't allow this, because its loader rejects files whose declared tensors don't fill them exactly.

The two campaigns

  • Mir2k: on November 22 and 24 it uploaded two "uncensored" models (Huihui-Qwen3.5-9B-abliterated-GGUF with 1,488 downloads, Inkling-2-Mini-Uncensored-GGUF with 458), each with a Windows trojan at the end of the file but a clean template.
  • On November 26, Mir2k swapped both templates: the model now starts every reply with a PowerShell line that reads the file's tail and launches d.exe. Downloads before November 26 contain the payload but not the trigger.
  • The account also parked 12 empty repos under expected model names (Qwen4-27B, DeepSeek-V4, Llama-4-Scout, gemma-4-27b), ready to be filled at release.
  • timdedid: three Qwen3 1.7B based "cyber uncensored" models. When the user's message contains "What is", the template injects a fake [SYSTEM DIRECTIVE] telling a coding agent with shell access to download and run a PowerShell script.

The implant, ollie, is an 11.47 MB Windows x64 program, 10.25 MB of which is a bundled copy of Tor. It steals saved passwords from Chrome, Edge and Brave, targets Phantom and MetaMask wallets, supports keylogging, screenshots and webcam capture, and mines Monero when the machine is idle. Its folders are named ollie, close enough to Ollama to look familiar. In Malspark's test, antivirus engines and pickle scanners raised no alert on the live Mir2k files.

One target was a repackaged version of Thinking Machines' open model (Inkling 2 Mini: open 26B model that runs on a laptop).

What to do

The researcher released gguf-radar under the MIT license. It analyzes templates without running them, flags bytes after the last tensor, and rebuilds a clean GGUF with identical weights. It can also check Hugging Face links without downloading the full file. YARA rules ship in the repo.

  • Treat any command a model suggests as untrusted.
  • If the model can call tools, pass a reviewed template: --chat-template-file in llama.cpp, or TEMPLATE in an Ollama Modelfile.
  • Companies can run every incoming model through a scanner like this before it reaches an internal registry or a developer laptop.
  • The researcher argues that model hubs and runtimes could close the gap for good by rejecting GGUF files with bytes after the last tensor.

Why it matters

As local models spread, a GGUF file has become a supply-chain artifact just like an npm package. "Uncensored" and "abliterated" variants reach exactly the users who are less cautious, and agents with shell access can turn a hidden prompt into an executed command.

    By Mikola Máté Patrik

    Produced with the help of AI, reviewed by an editor. How we make our articles

    Reviewed and edited by the Neural Daily desk. About

    Related articles