← Back to all posts
News

Scan Finds Malicious GGUF Models on Hugging Face That Armed a Hidden RAT Days Later

November 29, 2026 · 01:14 UTC · News
On this page 9 sections
Scan Finds Malicious GGUF Models on Hugging Face That Armed a Hidden RAT Days Later

TL;DR

Malspark, an open-source malware-analysis project, scanned every public model repository on Hugging Face on 26 November: 3,273,389 repos, 226,310 of them GGUF, with 572,184 chat templates parsed but never executed. Five models from two accounts were malicious. Two, uploaded by Mir2k, carry an 11.47 MB Windows RAT glued after the last tensor, where loaders never read, and they sat inert for days until both chat templates were rewritten on 26 November to make the model open every reply with the PowerShell line that unpacks the thing. The other three, from an account called timdedid, wait for the words "What is" and then order coding agents to fetch and run a script. Hugging Face disabled all five by 28 November, after roughly 2,807 downloads.


At a glance
Five bad models in 3.27 million
3.27M
public Hugging Face repos scanned on 26 November
5
malicious GGUF models, from two accounts
2,807
downloads before the repos were disabled
11.47 MB
Windows RAT hidden after the last tensor
2 GB
Hugging Face's malware-scan size cap

Two dark corners in every GGUF file

A GGUF file is a header with metadata, a tensor table, then the weights. Runtimes such as llama.cpp and LM Studio read exactly the byte ranges the header points to and never complain about the rest. Two spots in that layout turned out to be enough.

The first is the chat template, a small Jinja2 program stored under the tokenizer.chat_template key. The runtime runs it on every conversation before the model sees it, so a rewritten template can inject text the model obeys and you never see. Picture a teleprompter mounted facing the model: it reads from it all conversation, and you cannot. C++ runtimes render templates inside a restricted engine, so the classic template-injection escape to the operating system stays closed. The malware does not need the escape; it only needs the model to say a line out loud.

The second is everything after the last tensor. The header says where the data section ends, loaders trust it, and a whole Windows executable can ride there without changing how the model loads. Safetensors refuses a file whose declared tensors do not fill it exactly; GGUF has no such check and no runtime warns. Antivirus and pickle scanners gave "No alert" on the live files in Malspark's tests.

Neither half is new. Pillar Security demonstrated poisoned GGUF chat templates in July 2025, and EvilModel hid malware inside weight bits back in 2021. What Malspark adds is the combination seen live: an executable appended to real uploads, plus a template switched on days later, "for which no earlier public report was found".

Mir2k planted first and armed later

The account appeared on 22 November and created 14 repositories in two automated bursts. Twelve were empty placeholders named after models that do not exist yet, Qwen4-27B, DeepSeek-V4, Llama-4-Scout, gemma-4-27b, storefronts stocked for crowds that have not arrived. The other two were the weapons: Huihui-Qwen3.5-9B-abliterated-GGUF, uploaded 22 November with the executable already appended and the original clean template, then Inkling-2-Mini-Uncensored-GGUF on 24 November with the same program compressed with raw Deflate. For days the payload sat in the files with nothing to start it.

On the morning of 26 November both templates were replaced within about an hour, then again nine hours later. The armed version adds a French system message: begin every reply with this line, copied character by character, then answer normally. The line finds the largest .gguf file in your user profile, carves bytes off its end, writes them to %TEMP%d.exe and starts them. In the Huihui model it reads 11,474,944 bytes starting 12,000,000 bytes before the end; in the Inkling model it takes the last 4.2 MB and decompresses them in memory. Anyone who downloaded before 26 November got the payload without the trigger.

The kill chain
Plant, wait, arm, run
22-24 Nov
Plant
two GGUFs uploaded, RAT appended after the last tensor, templates still clean
22-25 Nov
Wait
downloads accumulate, scanners quiet, payload inert
26 Nov
Arm
both templates rewritten; every reply now opens with a PowerShell line
Victim
Copy and run
the line carves d.exe out of the model file into %TEMP% and starts it
Result
ollie runs
RAT over Tor: passwords, wallets, webcam, Monero mining
Downloads before 26 November hold the payload but not the trigger. Source: Malspark's repository history.

Downloads tell the story: 1,502 across the five repos at the scan on 26 November, 2,428 a day later, and 2,807 by 28 November, when On The Wire polled the Hugging Face API directly. Hugging Face counts downloads, not people, so 2,807 is the ceiling on exposure.

Downloads per repo
The two RAT carriers pulled the most
mir2k modelstimdedid copies
huihui 9b
1,711
inkling 2m
574
cyber no.1
288
cyber no.2
151
cyber no.3
83
Counts from Hugging Face's API at 13:09 GMT on 28 November, before the disable notices. Source: On The Wire.

ollie, the stowaway

Both models unpack to the same 11.47 MB Windows x64 program, which Malspark calls ollie after its own strings. Most of that size is a complete copy of Tor 0.4.9.16, 10.25 MB of it. The program looks for VirtualBox, VMware and Sandboxie and exits if it finds them. On a real machine it installs a scheduled task that reruns it every 10 minutes with highest privileges, two watchdog processes, registry keys that re-enable it, and it marks its own process critical, so ending it in Task Manager crashes Windows. Its one UAC-bypass attempt fails because the registry paths were compiled without their backslashes.

From there it does the usual rounds: saved passwords from Chrome, Edge and Brave read through DPAPI (Chrome's newer app-bound entries stay locked), the Phantom and MetaMask wallet extensions, keylogging, clipboard reading, screenshots, screen streaming, webcam capture, and Monero mining over Tor when the machine idles. Its command channel is an onion service with a ChaCha20 session keyed by a built-in pre-shared key. It installs under AppDataRoamingollie, close enough to Ollama to look familiar, and it still carries a leftover path from the author's own machine, C:/Users/MoH/socks.txt. Neither the file's hash nor the campaign strings had public sightings when Malspark wrote.

The other three go after your agent

On 21 and 22 November, timdedid published three byte-identical copies of a Qwen3 1.7B model aimed at security users, plus an Ollama mirror that was still listed when On The Wire checked, with 42 downloads. The template is the official Qwen3 one with a single addition: when your message contains "What is", it inserts a [SYSTEM DIRECTIVE] telling an agent with shell access to call its powershell tool, download value.ps1 from a WordPress site into C:WindowsTemppayload.ps1, and run it in a hidden window. The README advises against replacing the embedded template, which keeps the trigger in place.

The second stage was never recovered, so what it would have installed is unknown. What is known: if you point a coding agent with a shell at this model and ask "What is DNS exfiltration?", the directive arrives dressed as an order from your own harness. The trigger was visible in Hugging Face's metadata viewer the entire time.

Why nothing caught it

Hugging Face's malware scanning runs on repository files smaller than 2 GB. The two Mir2k files list at 6.67 GB and 17.5 GB, both over the line, and Malspark reports antivirus and pickle scanners raised nothing on them. The first public flags were community threads posted on 28 November, one titled "Don't donwload this!!!! VIRUS!!!!", hours before the pages went dark. By 13:09 GMT that day, all five repositories read "This content infringes our Content Policy". Hugging Face has not commented publicly, and Malspark does not say whether it reported the repos before publishing.

File size vs the scanner
Both weapons sat above the 2 GB cap
hf malware-scan capmir2k files
scan cap
2 GB
huihui gguf
6.67 GB
inkling gguf
17.5 GB
Hugging Face scans repo files smaller than 2 GB; the two RAT carriers were 6.67 GB and 17.5 GB. Source: HF docs, sizes via On The Wire.

What to do this week

  • Treat any command a model suggests as untrusted input, including PowerShell it prefixes to answers.
  • Stop using embedded templates in anything with tools. Pass a reviewed one with --chat-template-file in llama.cpp, or TEMPLATE in an Ollama Modelfile, and the poisoned template is out of the loop.
  • Check the template in the Hub's GGUF metadata viewer before you download a community model. The timdedid trigger sat there in plain sight.
  • Run gguf-radar over local files or hub URLs. It parses the template into a syntax tree without executing it, flags file reads, decompression, downloads and hidden directives, computes where the model data must end, and reports anything after it. It checks URLs through HTTP range requests, header and tail only, so auditing a 17.5 GB file costs kilobytes. Its sanitize mode rebuilds a clean GGUF with the weights unchanged.
  • If you gate models for a team, run that scan at the gate rather than on a developer laptop.

The structural fix belongs to hubs and runtimes: reject GGUF files with bytes after the last tensor or non-zero padding, and scan templates for loader patterns. Malspark also demonstrated three more hiding places in the lab, in alignment padding, in a GGUF-and-ZIP polyglot, and in zero-scale Q8_0 blocks, that no loader warns about today. Rejecting trailing bytes closes the hole these five used and leaves three open.

Caveats

  • Everything about the payload's behavior is Malspark's static analysis of one sample. Nobody has observed a real infection, and 2,807 downloads is an upper bound, not a victim count.
  • The writeup promotes gguf-radar, published by the same GitHub account as Malspark; On The Wire notes the overlap. The claims are reproducible from the post's indicators and YARA rules.
  • Hugging Face has not said when or why it disabled the repositories.
  • timdedid's second stage was never recovered, so its payload is unknown.

Key Takeaways

  • Five of 3,273,389 public Hugging Face repositories carried malicious GGUFs: two with an 11.47 MB Windows RAT appended after the last tensor, three with a template that hijacks coding agents on the phrase "What is".
  • The Mir2k files were clean on upload and armed on 26 November by rewriting the chat template, so a scan on upload day would have seen only an odd file tail.
  • The armed template makes the model open every reply with a PowerShell line that carves the RAT out of the model file itself. The model download is the only file the victim ever fetches.
  • Hugging Face's malware scanner covers files smaller than 2 GB. The two RAT files were 6.67 GB and 17.5 GB, and antivirus raised nothing on them.
  • Defenses that work today: override embedded templates in tool-using setups, read the template in the Hub's metadata viewer, and scan with gguf-radar, which flags poisoned templates and trailing bytes without executing anything.
  • Hubs and runtimes could kill this class by rejecting GGUFs with bytes after the last tensor. Three more lab-proven hiding places would survive that check.

Sources: Malspark, GGUF LLM models with hidden malware on Hugging Face (27 Nov 2026), On The Wire's independent check (28 Nov 2026), Hugging Face malware-scanning docs, Hugging Face GGUF docs, gguf-radar, Pillar Security on poisoned templates, EvilModel (arXiv 2107.08590)

AIHugging FaceGGUFMalwareSupply Chain Securityllama.cppOllamaLocal LLMs
CONSOLE
$