Hugging Face GGUF Malware: 5 Models, a Trojan in the Tail

By 13 min read
Hugging Face GGUF malware campaign hiding a Windows trojan after the last tensor of local LLM model files

Someone uploaded a popular-looking uncensored model to Hugging Face with a trojan already bolted to the end of the file, waited four days, and then edited one small text field so the model would ask its own users to install the malware. No loader warned, and Malspark says its antivirus tests saw nothing.

In short: the Hugging Face GGUF malware found by Malspark is a set of five poisoned local LLM model files, downloaded 2,428 times by 27 November 2026, that used hidden chat-template instructions to get users or AI agents to run a command, in one campaign unpacking a Windows remote access trojan stored inside the model file itself.

What is the Hugging Face GGUF malware?

It is two campaigns, Mir2k and timdedid, that Malspark researcher Düzgün described on 27 November 2026 after scanning every public model repository on Hugging Face. Both abused the GGUF model format and its embedded chat template, and one also smuggled a full Windows executable inside the model.

GGUF is the file format most people use to run large language models locally with tools such as llama.cpp, LM Studio and Ollama. A GGUF file holds a header, a metadata table, a tensor table and then the model weights. One metadata field, tokenizer.chat_template, holds a small Jinja2 program that formats every conversation before the model sees it.

This is not the first time a developer tool became a malware carrier this month. We covered fake AI coding-agent skills in the TrojanPony campaign two days earlier. The difference here is that the malicious content sits inside the model file, the one artifact most people assume is just numbers.

How big was the scan, and what did it find?

Malspark says it scanned 3,273,389 public model repositories on 26 November 2026, including 226,310 GGUF repositories holding 2.56 PB of weights, and parsed 572,184 chat templates without executing them. It read only file headers and file ends through HTTP range requests, so no model was downloaded in full.

Four headline figures from the Malspark scan: 3.27 million repos, 226K GGUF repos, 5 malicious, 2,428 downloads.
Five malicious models out of more than three million repositories: rare, but each one was live and being downloaded. Data: Malspark.

After manual review removed security test repositories, harmless persona prompts and research samples, five repositories were left:

Repository Campaign Method Downloads (27 Nov)
Mir2k/Huihui-Qwen3.5-9B-abliterated-GGUF Mir2k Reply prefix plus hidden executable 1,488
Mir2k/Inkling-2-Mini-Uncensored-GGUF Mir2k Reply prefix plus compressed executable 458
timdedid/qwen3.8-cyber-uncensored timdedid Agent tool hijack 271
timdedid/qwen3-cyber-UNCENSORED-2 timdedid Agent tool hijack 136
timdedid/qwen3-cyber-UNCENSORED timdedid Agent tool hijack 75
Total 2 actors   2,428

Malspark stresses that downloads are not people, so the number of affected users is equal or lower. The count also grew fast: the same five repositories had 1,502 downloads at scan time on 26 November, and i10x reported the counters at 2,807 on 28 November, just before takedown.

Bar chart of downloads per malicious repository, led by the Mir2k Huihui-Qwen3.5 model at 1,488.
The two Mir2k models, the ones carrying the trojan, drew 80 percent of the downloads. Data: Malspark.

How did the Mir2k campaign work?

Mir2k planted the payload first and armed it later. That delay is the detail that makes this campaign different from earlier proof-of-concept research.

Planting a trojan after the last tensor

The GGUF header defines exactly where model data ends. Runtimes read only those byte ranges, so anything appended after the final tensor is never loaded, never changes model behaviour, and triggers no warning. Malspark says Mir2k used this gap to carry a complete Windows program.

The first model, an “abliterated” build of Huihui-Qwen3.5-9B, carried a plain executable followed by about half a megabyte of filler, so a scanner that checks only the last few kilobytes of a file sees nothing. Abliteration is a technique that strips a model’s refusal behaviour, which is why such builds attract users looking for uncensored models. The second model, Inkling-2-Mini-Uncensored, carried the same program compressed with raw Deflate, which removes every recognisable file signature.

Arming the chat template days later

According to the repository history Malspark reviewed, the Huihui model went up on 22 November and the Inkling model on 24 November, both with clean templates. For two to four days the payload sat in the files with nothing to start it.

On the morning of 26 November both templates were replaced. The new template added a hidden French system message telling the model to begin every reply with one PowerShell line, copied exactly. Conceptually, that line finds the model file on disk, reads the hidden bytes back out of its tail, writes them to the temp folder as d.exe and starts it. Nine hours later the templates were replaced again to search the whole user profile instead of one fixed Downloads path.

Seven-stage flow of the Mir2k attack from model upload to the ollie RAT reaching its Tor C2.
The victim never downloads anything except the model; the model itself asks them to run the unpacking command. Data: Malspark.

A practical consequence: copies downloaded before 26 November contain the trojan but not the trigger. They are still dangerous to keep, because the payload is sitting on disk.

Who is behind Mir2k?

Malspark describes Mir2k only as a new Hugging Face account with French traces in its model card, system prompt, commit messages and malware strings, and makes no attribution beyond that. On 22 November the account also created 12 empty placeholder repositories named after expected releases such as Qwen4-27B and DeepSeek-V4, ready to be filled when those models appear.

What does the ollie RAT do?

ollie is the remote access trojan both Mir2k models unpack. Malspark describes it as an 11.47 MB Windows x64 program, about 10.25 MB of which is a bundled copy of Tor 0.4.9.16. A remote access trojan (RAT) is malware that gives an attacker ongoing remote control of a machine.

Malspark’s static analysis lists these behaviours:

Area Behaviour reported by Malspark
Sandbox evasion Exits if it finds VirtualBox, VMware or Sandboxie drivers, or usernames such as sandbox, malware or test
Persistence Scheduled task every 10 minutes with highest privileges, two watchdog processes, StartupApproved registry keys, process marked critical
Privilege escalation Tries the fodhelper UAC bypass, which fails because the registry paths were compiled without backslashes
Command and control Starts Tor on SocksPort 9050 and reaches an onion service over ChaCha20 with a built-in key
Theft Saved passwords from Chrome, Edge and Brave via DPAPI; Phantom and MetaMask wallet extensions
Surveillance Keylogging, clipboard, screenshots, screen streaming, webcam
Monetisation Mines Monero with RandomX when the machine is idle

Two limits are worth knowing. Malspark says Chrome’s newer v20 App-Bound encrypted passwords are left undecrypted, and the broken UAC bypass means the malware is sloppier than its feature list suggests. Its install folder is named ollie under AppData\Roaming, close enough to Ollama to look familiar at a glance.

How did the timdedid campaign target AI agents?

The timdedid account published three byte-identical copies of a Qwen3 1.7B model aimed at security users on 21 and 22 November, plus an Ollama mirror named timdedid/qwen3-1.7b-cyber. Hugging Face’s own metadata for one of the repositories lists Qwen/Qwen3-1.7B as the base model.

The template is the official Qwen3 template with one addition. When the user’s latest message contains the words “What is”, it inserts a fake [SYSTEM DIRECTIVE] telling an agent to use its PowerShell tool to download a script from a WordPress site into C:\Windows\Temp\payload.ps1 and run it in a hidden window. The README advised users not to replace the embedded template, which keeps the trigger in place.

This is indirect prompt injection delivered through the model file rather than a web page, the same weakness defenders exploit when they trap AI pentest agents with honeypots. It only works when the model is wired to an agent that can run shell commands without a human approving them. Malspark could not recover the second-stage script, so what it would have installed is unknown.

Timeline: from upload to takedown

Timeline from the timdedid uploads on 21 November to all five repos being disabled on 28 November.
The whole campaign, from first upload to takedown, fit inside eight days. Data: Malspark, i10x, Hugging Face API.
Date (2026) Event Source
21-22 Nov timdedid publishes three poisoned Qwen3 copies and an Ollama mirror Malspark
22 Nov Mir2k creates 14 repos; Huihui model uploaded with trojan and clean template Malspark
24 Nov Inkling model uploaded with compressed trojan and clean template Malspark
26 Nov Both Mir2k templates armed, then revised nine hours later; scan run Malspark
27 Nov Malspark publishes its report; all five repositories still online Malspark
28 Nov Hugging Face API marks all five repositories disabled i10x, Hugging Face API

We checked the Hugging Face API ourselves on 29 November: Mir2k/Huihui-Qwen3.5-9B-abliterated-GGUF returns "disabled": true. i10x reported that the takedown cited a content policy breach, and that the Ollama mirror timdedid/qwen3-1.7b-cyber was still live on 28 November with 42 downloads and the same directive inside.

Who is affected and how do you check exposure?

You are potentially affected if anyone in your organisation downloaded one of the five repositories or the Ollama mirror, especially on Windows, or connected one of the timdedid models to an agent with a shell tool.

Find the files

  1. Search model folders, including the Hugging Face cache, LM Studio and llama.cpp directories, for the five repository names.
  2. Run ollama list on developer machines and look for timdedid/qwen3-1.7b-cyber.
  3. Scan every local .gguf file with gguf-radar (covered below), not only the named ones. Malspark notes that antivirus and checks that read only the file end do not see the compressed payload.

Check Windows hosts for ollie

Look for an ollie folder under AppData\Roaming, a d.exe in the user temp folder, a scheduled task that runs every ten minutes with highest privileges, and a local Tor listener on port 9050. For timdedid exposure, look for C:\Windows\Temp\payload.ps1 and hidden PowerShell processes started by an agent runtime.

How do you detect GGUF model malware?

File-level detection

gguf-radar, released by Malspark under the MIT licence, parses the chat template into a syntax tree without running it and flags file reads and writes, decompression, process starts, download commands, conditional hidden directives and known Python escape gadgets. It then calculates where model data should end and reports trailing bytes, non-zero padding and suspicious zero-scale blocks. Its sanitize mode rebuilds a clean file with the weights unchanged. The GitHub API showed the repository at 381 stars and 36 forks on 29 November, two days after it was created.

Endpoint and network detection

Useful telemetry sources are process creation logs (Sysmon event 1 or EDR), PowerShell script block logging (event 4104), scheduled task creation (event 4698) and network connections. Behaviours to alert on:

  • PowerShell spawned by, or immediately after, a local LLM runtime such as llama.cpp, LM Studio or Ollama.
  • PowerShell that reads the tail of a .gguf file or decompresses a Deflate stream and writes an .exe to %TEMP%.
  • A new process listening on 127.0.0.1:9050 on a machine with no sanctioned Tor use.
  • Agent frameworks downloading .ps1 files into C:\Windows\Temp and launching them hidden.

Malspark publishes YARA rules (including Malspark_Mir2k_Ollie_RAT_PE), a 20-item indicator table with file hashes, and the string technoarteng.com in its timdedid rule. Use the original report for the full indicator list.

MITRE ATT&CK and ATLAS mapping

Malspark maps the activity across 12 tactics. Techniques it lists include T1195.002 (compromise software supply chain), T1204.004 (malicious copy and paste), T1059.001 (PowerShell), T1027.009 (embedded payloads), T1053.005 (scheduled task), T1497.001 (system checks), T1555.003 (credentials from web browsers), T1090.003 (multi-hop proxy) and T1496.001 (compute hijacking), plus MITRE ATLAS techniques AML.T0010 (AI supply chain compromise) and AML.T0051.001 (indirect prompt injection).

How do you mitigate it?

In priority order:

  1. Isolate and reimage infected machines. i10x advises reinstalling rather than just killing the process, which also fits Malspark’s description: ending ollie crashes Windows because it marks itself critical.
  2. Rotate secrets from a clean device. Change passwords saved in Chrome, Edge and Brave, and move funds from Phantom or MetaMask wallets used on the machine.
  3. Delete the five models and the Ollama mirror, including copies downloaded before 26 November that carry the payload without the trigger.
  4. Pin a reviewed chat template. Malspark recommends passing a known-good template with --chat-template-file in llama.cpp or a TEMPLATE line in an Ollama Modelfile, which takes the embedded one out of the loop.
  5. Never auto-run commands from a model. Require human approval before an agent connected to a community model can use a shell tool.
  6. Gate models like code. Scan every incoming model before it reaches an internal registry or developer laptop, and prefer models from the original publisher over re-uploads by unknown accounts. The Microsoft Agent Framework PyPI attack shows the package side of the same problem.

How does this compare to earlier model-file attacks?

Neither half of the technique is new on its own, as Malspark itself points out. What is new is seeing both in live malware, combined, with a delay between planting and arming.

Case Year Where the threat lived Seen in the wild?
EvilModel (research) 2021 Malware hidden in the low bits of model weights No, lab only
Pillar Security (research) 2025 Hidden instructions in GGUF chat templates No, lab only
Splunk survey of about 157K GGUF models 2026 (Feb) Template poisoning, called plausible but unexploited No malicious cases found
Fogel et al. (research) 2026 Template attacks on 18 models and four engines, including agent tool hijacks No, lab only
TrojanPony 2026 (Nov) Trojanised AI coding-agent skills on GitHub Yes
Mir2k and timdedid 2026 (Nov) Trojan after the last tensor plus poisoned template Yes

The contrast with Splunk’s February survey matters most: it found template poisoning plausible but unexploited. Nine months later it has been used for real, at small scale.

Malspark also built three further hiding places in the lab that it did not find in live malware: oversized alignment padding, a GGUF file that is also a ZIP archive, and data hidden in zero-scale weight blocks. None changed a single model weight or triggered a warning in llama.cpp. If hubs start rejecting trailing bytes, these are the likely next moves.

What is still unknown?

  • The timdedid second stage. The script was not recovered, so its purpose is unknown.
  • Real victim numbers. Download counts include crawlers, mirrors and repeat downloads, and no source reports confirmed infections.
  • Independent payload analysis. All technical detail on ollie comes from Malspark. The secondary outlets we read say they did not verify the sample, and the hash had no public sightings at publication.
  • Hugging Face’s response. i10x reports a content policy reason for the takedown, but we found no public statement from Hugging Face and no announcement about rejecting files with trailing bytes.
  • The Ollama copy. Only i10x checked it, on 28 November, and did not test whether any Ollama version actually applies the embedded template.
  • Other platforms. The scan covered Hugging Face only. Mirrors and re-uploads elsewhere were not measured.

The bottom line

A GGUF model is not just weights: it carries an executable-adjacent template and can carry arbitrary bytes that no runtime checks. Mir2k used both, planting a trojan first and arming it days later, and the only thing between the model and an infection was a user willing to paste one line. Treat community models as untrusted code: scan them, pin their templates, and never let a model’s output run on its own.

Sources

This article is written for defenders and authorised security testers. Only test systems you own or have written permission to assess.

Frequently asked questions

What is the Hugging Face GGUF malware?

It is the name for five malicious GGUF model repositories that Malspark found on Hugging Face in November 2026. Two hid a Windows remote access trojan inside the model file, and all five used a poisoned chat template to make the model or an AI agent run a command.

Can a GGUF file contain malware?

Yes. GGUF runtimes read only the byte ranges the header points to, so data appended after the last tensor is ignored and never flagged. The file still loads and behaves normally, which is why the Mir2k trojan went unnoticed by loaders and the antivirus tests Malspark ran.

Does loading a malicious GGUF model infect my computer by itself?

Not in these campaigns. Malspark says the C++ runtimes render chat templates in a restricted engine, so the template cannot run code. Infection needed a user to run the PowerShell line the model printed, or an AI agent with a shell tool to follow the hidden directive.

Which Hugging Face models were malicious?

Malspark named Mir2k/Huihui-Qwen3.5-9B-abliterated-GGUF, Mir2k/Inkling-2-Mini-Uncensored-GGUF, timdedid/qwen3.8-cyber-uncensored, timdedid/qwen3-cyber-UNCENSORED-2 and timdedid/qwen3-cyber-UNCENSORED, plus an Ollama mirror named timdedid/qwen3-1.7b-cyber.

What is chat template poisoning?

Chat template poisoning is the abuse of the small Jinja2 program stored in a model file that formats every prompt. A poisoned template quietly inserts instructions the user never sees, such as telling the model to open every reply with a command.

What does the ollie RAT do?

According to Malspark, ollie steals saved passwords from Chrome, Edge and Brave, targets the Phantom and MetaMask wallet extensions, logs keys, reads the clipboard, captures the screen and webcam, and mines Monero when idle. It talks to its operator over Tor.

How do I check a GGUF file for hidden malware?

Malspark released gguf-radar, an MIT-licensed tool that parses the chat template without running it and reports any bytes after the last tensor or in padding. Its sanitize command writes a clean copy with the weights unchanged.

Are Safetensors models safe from this attack?

Only partly. Malspark says the Safetensors loader refuses files with extra bytes, so the appended payload trick does not work there, but Safetensors and PyTorch models still ship chat templates in separate files that can be poisoned the same way.

Keep reading

Hugging Face GGUF malwareGGUFchat template poisoningAI supply chainlocal LLM securityMir2kincident response