A Hugging Face Account Hid a Windows Trojan Past the Last Tensor of 'Uncensored' GGUF Models, Then Armed the Chat Templates Days Later

A Malspark scan of all 3.27 million public Hugging Face model repositories found five malicious GGUF models with 2,428 downloads. One campaign appended a remote access trojan after the model weights and later rewrote the chat template so the model tells users to run the line that unpacks it. Hugging Face now lists all five repositories as disabled.

A wooden shipping crate on a dark warehouse shelf with a false bottom slid open under a single cold lamp, revealing a hidden compartment.
A wooden shipping crate on a dark warehouse shelf with a false bottom slid open under a single cold lamp, revealing a hidden compartment.

Researchers at Malspark say they scanned every public model repository on Hugging Face, 3,273,389 of them, on November 26, 2026, and found five GGUF models carrying malware. Two accounts were behind them. The larger campaign hid a Windows remote access trojan inside the model files and switched it on days later by editing the chat template, so the model itself would ask users to run a command. By Sunday morning, Hugging Face’s API listed all five repositories as disabled.

Malspark published its findings on November 27 and counted 2,428 downloads across the five repositories as of that day, up from 1,502 when the scan ran. Malspark notes that Hugging Face counts downloads, not people. The counters kept climbing: at 06:10 IST on November 29 the five disabled repositories showed 2,807 downloads combined.

The scan covered 226,310 GGUF repositories holding 2.56 PB of weights, reading headers and file endings through HTTP range requests, and statically parsed 572,184 chat templates.

Planted on November 22, triggered on November 26

The first campaign came from Mir2k, a new account with French traces throughout its files. On November 22 it created 14 repositories. Twelve were empty placeholders named after anticipated releases such as Qwen4-27B, DeepSeek-V4, Llama-4-Scout and gemma-4-27b.

The two real uploads were abliterated, or “uncensored”, builds: Huihui-Qwen3.5-9B-abliterated-GGUF on November 22 and Inkling-2-Mini-Uncensored-GGUF on November 24. Each carried a Windows executable appended after the last tensor, the second compressed with raw Deflate so no file signature remained. GGUF loaders such as llama.cpp read only the byte ranges the header points to, so the extra data never affected how the model ran.

For several days the templates were clean. On the morning of November 26 both were replaced within about an hour. The new template adds a hidden system message, in French, telling the model to begin every reply with one PowerShell line copied exactly. That line finds the largest .gguf file in the user profile, reads its final bytes, writes them to %TEMP%\d.exe and starts it. Nine hours later the templates changed again to search the whole profile rather than a fixed Downloads path. Copies downloaded before November 26 contain the payload but not the trigger.

An implant named to look like Ollama

Both models unpack the same 11.47 MB program, which Malspark calls ollie. Most of its size is a bundled copy of Tor 0.4.9.16. It exits if it detects VirtualBox, VMware or Sandboxie. Otherwise it persists through a scheduled task that runs every 10 minutes with highest privileges and two watchdog processes, and marks itself critical so killing it crashes Windows.

The implant talks to its operator over a Tor onion service using ChaCha20. It sends saved passwords from Chrome, Edge and Brave, though Chrome’s newer app-bound encrypted entries stay undecrypted. It targets the Phantom and MetaMask wallet extensions, supports keylogging, clipboard reading, screenshots, screen streaming and webcam capture, and mines Monero when the machine is idle. Its working folder is named ollie under AppData\Roaming.

A trigger phrase aimed at coding agents

The second account, timdedid, published three byte-identical copies of a Qwen3 1.7B model aimed at security users on November 21 and 22, along with an Ollama mirror. Its template is the official Qwen3 template with one addition: when the user’s latest message contains “What is”, it inserts a fake [SYSTEM DIRECTIVE] instructing an agent with a PowerShell tool to download a script from a WordPress site into C:\Windows\Temp and run it in a hidden window. Malspark did not recover the second-stage script. The Ollama listing timdedid/qwen3-1.7b-cyber was still online on Sunday morning.

Three more hiding spots and a scanner

Hidden template instructions and malware inside model files had both been shown in lab research before, but Malspark says it found no earlier public report of Mir2k’s combination: a payload planted after the last tensor and a template armed days later. Its researchers also built synthetic files showing three more places GGUF can hide data without changing any dequantized weight: oversized alignment padding, a ZIP archive appended so the file doubles as importable Python, and zero-scale Q8_0 blocks, including ones with a negative-zero scale. Safetensors files rule out the trailing-bytes trick because the loader rejects files whose declared tensors do not fill them exactly.

Malspark released gguf-radar on GitHub under the MIT license. It parses templates without running them, flags bytes past the last tensor and other anomalies, and rebuilds a clean GGUF with identical weights. Malspark advises local users to treat any command a model suggests as untrusted and to pin a reviewed template with --chat-template-file in llama.cpp or TEMPLATE in an Ollama Modelfile. It is asking model hubs to reject GGUF files that carry trailing bytes or non-zero padding.

Topics
  • #Hugging Face
  • #GGUF
  • #Supply Chain
  • #Malware
  • #Local LLMs
Raj M

Author

Raj M

Contributor

AI Systems Architect is a seasoned technology leader with over 15 years of experience in the IT industry working with Fortune 500 companies. With a solid foundation in multi-agent systems, open-source LLM infrastructure, and enterprise deployment, he excels at building scalable production-grade AI platforms.