Malspark disclosed on November 27, 2026, that it had found five malicious GGUF models on Hugging Face, including two carrying a Windows remote-access trojan hidden after the model's tensor data. The files had accumulated 2,428 downloads, a distribution count that should not be confused with victims or infected computers.
The security project says its November 26 scan covered 3,273,389 public model repositories, including 226,310 GGUF repositories. Its findings describe two connected supply-chain risks: chat templates that insert malicious instructions into conversations, and executable bytes stored inside otherwise usable model files.
Hugging Face subsequently disabled all five repositories. On The Wire verified the disabled pages and API status on November 28, but found no public Hugging Face statement in the sources it reviewed.
What Malspark Found in the GGUF Models
Malspark identified two repositories under the account Mir2k and three under timdedid, with different routes from a downloaded model to potential command execution.
The Mir2k files carried the same Windows program, which Malspark calls ollie. Their chat templates were initially clean, according to the report, then changed on November 26 to instruct the model to begin each response with a PowerShell command. A user running that command would extract and launch the hidden program.
The timdedid repositories contained three byte-identical copies of a small Qwen3 model from Alibaba's Qwen family. Their templates used a trigger phrase to insert instructions aimed at an agent with shell access.
The available source excerpts identify the accounts and per-repository download totals, but do not expose all five full repository names. The table therefore distinguishes each entry by its reported download count without supplying unverified names.
| Repository entry | Reported attack content | Downloads, Nov. 27 | Downloads, Nov. 28 |
|---|---|---|---|
| Mir2k, first entry | Appended Windows program and poisoned template | 1,488 | 1,711 |
| Mir2k, second entry | Same program, compressed, and poisoned template | 458 | 574 |
| timdedid, first copy | Triggered chat-template injection | 271 | 288 |
| timdedid, second copy | Triggered chat-template injection | 136 | 151 |
| timdedid, third copy | Triggered chat-template injection | 75 | 83 |
The November 27 figures come from Malspark. The November 28 figures come from On The Wire's Hugging Face API checks at 13:09 GMT. Those later counts total 2,807 downloads, but the difference does not establish when additional downloads occurred relative to disabling.
Malspark attributes password theft, targeting of Phantom and MetaMask wallet extensions, Tor-based communications, and idle-time Monero mining to its static analysis of the Mir2k program. Those behavior findings are Malspark's analysis; the independent follow-up verified repository status, not malware execution.
How GGUF Chat Template Poisoning Works
GGUF chat-template poisoning works by changing the conversation text presented to a model before it generates a response.
A GGUF file can store a chat template under the metadata key tokenizer.chat_template. The template is a small Jinja2 program that formats messages into the text the model receives. That makes it an important trust boundary: a person can see one conversation in the interface while the template supplies additional instructions behind it.
Malspark says the attacks did not require breaking out of the restricted template-rendering engine used by C++ runtimes. Ordinary template logic was enough.
A Trigger for Tool-Enabled Agents
The timdedid templates looked for the phrase What is in a user message. On a match, the template inserted a hidden [SYSTEM DIRECTIVE] telling an agent with shell access to download and execute a PowerShell script.
The execution path depended on the surrounding system. A chat-only application without tools could not carry out the requested shell operation itself. An agent permitted to execute commands had a more consequential capability available for the injected instruction to target.
Malspark did not recover the second-stage script. Its final payload and any resulting compromise remain unknown.
A Command Intended for the User
The Mir2k templates inserted a system message telling the model to start every answer with a PowerShell line. That line connected the poisoned conversation to the executable already inside the downloaded GGUF file.
Here, the user was the intended execution step. Loading the model and running the printed command were separate actions.
The practical distinction matters: these findings describe ways to steer a user or tool-enabled agent toward execution. They are not evidence that opening any affected GGUF file automatically ran the Windows malware.
Why Appended Malware Can Survive Normal Model Loading
GGUF files contain a header, metadata, a tensor table, alignment padding, and model weights. Malspark's report explains that the tensor table defines the byte ranges the runtime needs, leaving additional bytes after the final tensor outside normal model loading.
That allows a file to serve two purposes. A model loader reads the declared tensor data, while a separate extraction command reads the hidden program appended beyond it.
Malspark describes two forms in the Mir2k files:
- An uncompressed Windows executable followed by filler. Roughly half a megabyte of extra data followed the program, frustrating checks that inspect only the last few kilobytes.
- The same executable compressed with raw Deflate. Compression removed recognizable executable-file signatures from the stored payload. The PowerShell command could decompress it using
IO.Compression.DeflateStream.
A model loading successfully is therefore weak evidence of file safety. The loader can correctly process every tensor while ignoring unrelated bytes elsewhere in the file.
Malspark contrasts that behavior with Safetensors, whose loader rejects files when the declared tensors do not fill the expected file contents exactly. That distinction concerns appended data. Chat-template poisoning can also affect other model packaging formats when templates are distributed in separate files such as tokenizer_config.json or chat_template.jinja.
File Size Adds a Separate Scanning Gap
On The Wire cited Hugging Face documentation saying its malware scanner processes repository files smaller than 2 GB. The two Mir2k files were listed at 6.67 GB and 17.5 GB, above that threshold.
That documented size limit provides a concrete reason to question malware-scanning coverage for these files. It does not explain every possible detection failure. Malspark separately reported that antivirus and pickle checks produced no alerts on the live Mir2k files in its tests.
The two attack patterns also need different inspection methods. Searching for executable signatures addresses a different problem from detecting a template that tells an agent to run a command.
How to Check Downloaded GGUF Files
Malspark released the open-source gguf-radar scanner, indicators, YARA rules, and a cleaning workflow alongside its disclosure. Its report says gguf-radar inspects suspicious templates and hidden data without executing the model's payload.
For users who downloaded files from either account, the useful checks are layered:
- Scan the local GGUF files. Use the gguf-radar workflow linked from Malspark's report to inspect templates and data outside the expected model structure.
- Compare hashes with the published indicators. Check against the relevant indicators in Section 7.2, keeping track of whether an indicator describes a model file or an extracted payload.
- Apply the supplied YARA rules. Use Malspark's rules alongside structural inspection, since known signatures and malformed or suspicious packaging answer different questions.
- Check the endpoint as well as the download. A file inspection identifies what is stored locally; endpoint indicators help investigate whether malicious activity occurred.
- Review commands already executed. Pay particular attention to PowerShell commands copied from model responses or run by a tool-enabled agent.
A matching hash identifies a known artifact. A non-match is narrower evidence: changing a template or appended bytes changes the complete file's hash, so hash checking alone cannot rule out the same technique in a modified file.
Malspark also describes rebuilding a clean GGUF while preserving the model weights and removing suspicious template or trailing data. That addresses the downloaded artifact. It cannot undo activity from a command that has already executed.
Override Embedded Templates in Tool-Using Setups
The llama.cpp project supports --chat-template-file for supplying a custom Jinja template instead of relying on the model's embedded template. On The Wire also identifies TEMPLATE in an Ollama Modelfile as an override route.
The relevant llama.cpp option takes this form:
--chat-template-file custom.jinja
This is an option to add to an appropriate llama.cpp invocation, not a complete command. The file custom.jinja must contain a reviewed template suitable for the model.
The security benefit comes from controlling the formatting instructions applied to conversations. It is especially useful for agents with shell access, where hidden instructions can cross from model output into operating-system actions.
A template override addresses the documented template-injection route. It neither removes appended malware nor makes arbitrary model-generated commands safe.
What the Download Count and Public Response Show
Malspark's 2,428-download figure measures downloads recorded by Hugging Face as of November 27. It is not a count of unique people, successful payload executions, or compromised systems.
The disclosure also appeared on Hacker News with 259 points and 84 comments. That shows developer circulation of the report, not independent confirmation of infections. The victim wording in the linked report's headline goes beyond what its download count can demonstrate.
On The Wire found all five Hugging Face repositories disabled on November 28, with the API reporting disabled: true. The pages did not establish when access was disabled. Its review found no public company comment, while noting it could not search Hugging Face's posts on X.
The follow-up also found an Ollama listing named timdedid/qwen3-1.7b-cyber, described as a mirror, still available with 42 downloads at its check. Disabling the Hugging Face pages therefore should not be read as proof that every distribution route had disappeared.
What the Findings Mean for Local AI Security
Malspark's findings put model metadata and file boundaries at the center of a concrete supply-chain problem. The weights can remain usable while surrounding content tries to influence what a user or agent executes.
The report acknowledges earlier laboratory work on poisoned chat templates and malware hidden in model files. Its contribution is the reported discovery of these techniques in publicly distributed repositories, including Mir2k's combination of appended malware and templates changed after upload.
The delayed template change has a practical consequence: approval of one file revision cannot automatically cover later revisions. A model name and a successful loading check say little about whether its current template and trailing bytes match an earlier inspected artifact.
Zeniteq's previous coverage of an OpenAI agent hacking incident involving Hugging Face and the subsequent OpenAI report provides separate context on AI security. This disclosure concerns a different trust boundary: downloaded files and the instructions packaged with them.
For local model builders, the evidence supports a specific operating rule: inspect the artifact, control the template, and review command execution separately. Each protects a different step in the attack chain.
Frequently Asked Questions
3 questions
1How Can I Check a Downloaded GGUF File?
Use Malspark's gguf-radar scanner, compare relevant hashes with its published indicators, and apply its YARA rules. Inspect both the chat template and unexpected data outside the declared tensors. Malspark says its scanner performs those checks without running the payload; a clean antivirus result alone does not cover the documented techniques.
2What Should I Do If I Used an Affected Model?
Scan the downloaded file and check the machine against Malspark's endpoint indicators. Review any PowerShell commands run manually or by an agent. Model loading and payload execution are separate events in the reported attacks, so downloading a file alone is not evidence that the machine was compromised.
3Can a Template Override Prevent These Attacks?
A reviewed template supplied through llama.cpp's --chat-template-file option or an Ollama Modelfile's TEMPLATE setting can bypass the embedded template used in the documented injection route. It does not remove an appended executable, investigate previous execution, or guarantee that other model-generated commands are safe.
Sources (3)
- 01malspark.com3,273,389 public model repositories, including 226,310 GGUF repositories (opens in a new tab)
- 02onthewire.aiOn The Wire verified the disabled pages and API status on November 28 (opens in a new tab)
- 03news.ycombinator.comappeared on Hacker News with 259 points and 84 comments (opens in a new tab)