Malicious GGUF Models Hit 2,400+ Downloads on Hugging Face

Warning over a model file showing malicious GGUF models hiding malware on Hugging Face

Five malicious GGUF models are still online on Hugging Face, and they’ve been downloaded 2,428 times as of 27 November. A scan of all 3,273,389 public model repositories on 26 November turned them up, split between two separate campaigns. One of them hides a Windows remote access trojan inside the model file itself.

The hub tallies downloads rather than individuals, so fewer people than that were hit. Even so, the total climbed by over 50% in one day, from 1,502 on 26 November, and nearly all of the growth came from two models uploaded by a single account.

How a poisoned chat template works

Most locally run models travel as GGUF files, each with a chat template baked in. Before the model reads a prompt, the runtime passes it through that template. The template is a small Jinja2 program stored in the file’s metadata.

The attackers don’t try to escape the template engine. Plain conditional logic is enough to inject text that never shows up in the chat window. One campaign watches for a trigger phrase from the user, then inserts a fake system directive telling any agent with shell access to fetch and execute a script. In the other, the template tells the model to begin every reply with a PowerShell line that the user is expected to copy and run.

The same kind of template ships with Safetensors and PyTorch models too, so that half of the trick isn’t limited to GGUF.

Inkling chat template with the French system message, the read of the last 4.2 MB of the GGUF file, in-memory Deflate decompression, and the start of %TEMP%\d.exe
Image: Malspark

Malware after the last tensor

The second trick only works on GGUF. The header and tensor table mark where the model data stops, and loaders like llama.cpp and LM Studio read nothing beyond it. Anything after the last tensor is ignored, with no warning. Safetensors loaders reject a file whose tensors don’t fill it exactly, so they can’t be abused this way.

An account called Mir2k used that gap. It uploaded two uncensored models, Huihui-Qwen3.5-9B-abliterated on 22 November and Inkling-2-Mini-Uncensored on 24 November. The first holds an uncompressed Windows executable, padded with roughly half a megabyte of filler so that scanners checking just the final kilobytes find nothing. The second holds the same executable squeezed with raw Deflate, which removes every file signature a scanner could match.

For several days the payload had no way to run. Then, on the morning of 26 November, the account swapped in new templates for both models inside an hour, and swapped them again nine hours later. Anyone who downloaded a model earlier holds the payload without the trigger. The account had also set up 12 empty repositories named for models people expect to see soon, among them Qwen4-27B and DeepSeek-V4.

Hex view of the ollie binary at offset 0x000E88A0, where miner strings end and the embedded Tor executable's MZ header begins
Image: Malspark

What the trojan does

Both files hide one 11.47 MB Windows x64 program, which the analysis calls ollie. Most of that size is a complete copy of Tor. It looks for virtual machine and sandbox drivers first and exits if any turn up. On a genuine PC it:

  • schedules itself to run every 10 minutes and marks its process as critical, so ending it crashes Windows
  • contacts its operator through an onion service
  • steals saved passwords from Chrome, Edge and Brave, and targets the Phantom and MetaMask wallet extensions
  • offers keylogging, clipboard reading, screenshots and webcam capture
  • mines Monero when the machine is idle

It isn’t flawless. Its UAC bypass fails because the registry paths were compiled without backslashes, and Chrome’s newer app-bound encrypted entries stay undecrypted. It also names its folder ollie, close enough to Ollama to look familiar.

Hugging Face GGUF metadata viewer for timdedid/qwen3.8-cyber-uncensored with three marked parts: the What is trigger, the hidden SYSTEM DIRECTIVE and the PowerShell download command
Image: Malspark

The second campaign

The malicious GGUF models from this account weren’t the only ones.

On 21 and 22 November, an account named timdedid posted three byte-identical copies of a small Qwen3 1.7B model pitched at security users, along with an Ollama mirror. Its template adds a fake system directive whenever the latest user message contains “What is”. The directive tells an agent to call its PowerShell tool, download a script from a WordPress site and launch it in a hidden window. Nobody recovered that second-stage script, so its purpose is unknown.

Other hiding places

A hub that rejects files with trailing bytes would shut down Mir2k’s approach. The format still leaves other spots, which researchers reproduced with synthetic test files but haven’t seen in real attacks. Raising the alignment value creates a gap that loaders skip. A ZIP archive tacked onto a model yields one file that works as a model and as an importable Python package. And in Q8_0 blocks with a zero scale, any 32 bytes decode to zero weights, so data can ride inside the weights without changing them.

What to do now

Spotting malicious GGUF models by signature alone is unreliable, since the data can be encoded any way an attacker likes.

Anyone who downloaded one of these files should check endpoints against the published indicators and scan local .gguf files. Antivirus engines and checks that read only the end of a file don’t see the compressed payload.

The open-source tool gguf-radar parses the template without running it, flags file reads, decompression, process starts and download commands, and reports bytes after the last tensor. It can also rebuild a clean file with the weights unchanged. It reads only the header and file end over HTTP Range requests, so it doesn’t have to download whole models.

Individuals should treat every command a model suggests as untrusted. If the model has tool access, supplying a template you’ve reviewed (the –chat-template-file option in llama.cpp, or TEMPLATE in an Ollama Modelfile) means the embedded one never runs. Companies can scan every incoming model before it reaches an internal registry. Model hubs and runtimes could end the appended-payload trick by rejecting GGUF files with trailing bytes or non-zero padding.

Source: Malspark

Written by

Saksham Bhargava

Saksham Bhargava runs Alteroid and has been writing about consumer technology for over five years, covering iPhone, Android, Windows, AI tools and gaming. With an MCA and six years of hands-on web development experience, he tests the features he writes about on his own devices and focuses on clear, practical guides that solve real problems. Away from the screen, he enjoys travelling to places most tourists skip.