A new type of attack sample has appeared on Hugging Face, the open-source artificial intelligence model hosting platform: the models load normally and answer questions normally, yet a trojan is hidden at the end of the file, and the model’s chat template is used to induce users or coding agents to execute malicious instructions. Security researcher Düzgün scanned all of the platform’s more than 3.27 million public model repositories on November 26 and confirmed that five malicious GGUF models belonged to two accounts. As of the morning of November 29, cumulative downloads had reached 2,807, and the relevant repositories have all been disabled.
Unlike traditional malware, the stealth of these files lies in the fact that the attackers did not provide any executable program for users to click. GGUF is the mainstream format for running open-source large models locally. In addition to weight parameters, the file also contains a Jinja2 template called tokenizer.chat_template, which is executed every time a conversation is rendered. The attackers exploited this template to append instructions in a location users cannot see.
Two attack paths
The account Mir2k uploaded two models labeled “uncensored,” namely Huihui-Qwen3.5-9B and Inkling-2-Mini. An 11.47MB Windows remote-control trojan was appended to the end of the files, embedding about 10.25MB of the full Tor component. When uploaded on November 22 and 24, the templates were still clean, and the payload sat quietly in the files; only on the morning of November 26 did the attackers rewrite the templates, adding trigger instructions written in French that required the model to output a line of PowerShell code verbatim before every answer. If a user copies and executes it, the code searches locally for the largest .gguf file, reads the trailing bytes, writes them into a temporary executable file and launches it.
The other account, timdedid, uploaded three Qwen3 models labeled for cybersecurity purposes. When a user’s question contains “What is,” its template inserts a forged system instruction requiring a coding agent with terminal permissions to invoke PowerShell tools to download a script from a WordPress site and run it in a hidden window. For agents with automatic tool execution enabled, this instruction is executed directly as a system message, with no prompt appearing in the user interface. The second-stage script of this attack was not retrieved, and the final payload remains unclear.
| Account | Number of malicious models | Attack method | Cumulative downloads |
|---|---|---|---|
| Mir2k | 2 | Reply-prefix inducement + executable hidden at end of file | 1,946 |
| timdedid | 3 | Forged system instruction hijacking tool calls | 482 |
| Total | 5 | — | 2,428 |
Note: Download figures are from the scan date of November 27; by the morning of November 29, cumulative downloads had risen to 2,807. Download counts are not equivalent to the number of affected users.
Trojan has full backdoor capabilities
Static analysis of the trojan “ollie” extracted from the Mir2k sample shows that the program first detects virtual environments such as VirtualBox, VMware and Sandboxie, as well as usernames containing the words sandbox or malware, and exits if any are found. On a real machine, it runs every ten minutes as a scheduled task with the highest privileges, with two daemon processes restarting each other, and marks itself as a critical process, so forcibly terminating it causes a system blue screen. It writes out a complete Tor client and establishes an encrypted channel with the operator through an onion service.
Data that may be stolen includes passwords saved in Chrome, Edge and Brave browsers, Phantom and MetaMask wallet extension data, as well as keystrokes, clipboard contents, screenshots and webcam footage; when the machine is idle, it also mines Monero through the Tor network using the RandomX algorithm. The program attempts to bypass UAC elevation using fodhelper.exe but fails because a backslash was lost in the path during compilation. It names itself ollie and places itself in the AppData directory, deliberately confusing itself with the well-known local inference tool Ollama.
It is worth noting that the GGUF file header and tensor table precisely define where the model data ends, and content after that endpoint is not read by any loader and does not affect inference, making it a natural space for hiding payloads. By contrast, loaders for the safetensors format reject files that declare tensors that are not fully filled, and do not have the same vulnerability.
Not an entirely new technique, but the first time it has landed on a real platform
The idea of hiding instructions in chat templates has precedents. Pillar Security demonstrated the risk of GGUF template injection as early as July 2025, and academic research has also measured trigger-word backdoors and tool-call hijacking. But previously these were mostly validations in laboratory environments; this is the first time a real attack has been observed on a public model platform. Mir2k also combined “appending a program at the end of the file” with “a template armed days later,” forming a two-stage structure of laying the mine first and detonating it later. This means users who downloaded the files before the templates were rewritten also had the complete trojan in their files, just lacking the trigger.
In experiments, Malspark also reproduced three other locations where data can be hidden: the alignment padding area, GGUF and ZIP dual-format files, and quantized blocks with zero scaling coefficients. None of the three changes the dequantized weights or triggers warnings from llama.cpp and gguf-py.
Impact on the AI supply chain
The incident has pushed the trust problem in the open-source model download process to the forefront. In the past, enterprises’ and developers’ risk awareness of model files focused mainly on pickle deserialization executing arbitrary code; conventional antivirus software and pickle scanners did not raise alarms for these samples. As models evolve from assistants that offer suggestions into agents with terminal operation permissions, the attack surface has expanded from “what the model will output” to “what the model can make the agent do.”
The open-source tool gguf-radar provides a targeted detection path: it parses templates without executing them, flags dangerous operations, calculates the true end position of model data, and rebuilds a clean file without altering any weight parameters. It also supports remote inspection that reads only the beginning and end of files, without downloading complete models that can run to several GB. The researcher recommends that model platforms and inference runners directly reject GGUF files with extra data at the end; that enterprises put external models through structural inspection before adding them to internal model libraries; and that when using local inference and coding agents, they use low-privilege accounts, turn off automatic tool execution, and override built-in model templates with externally reviewed templates.
For users who have already downloaded the relevant models, the investigation should focus on the Hugging Face cache directory, the model folders of Ollama and LM Studio, as well as d.exe in the temporary directory, the ollie directory under AppData, the resident tor.exe and the local port 9050 listener. If relevant commands are confirmed to have been executed, the host should be treated as compromised: disconnect from the network for isolation, back up and reinstall the system, change all passwords saved in the browser on another clean device, transfer wallet assets to a wallet created with a new seed phrase, and replace API keys and tokens that appeared on that machine.
From an industry perspective, the scale effect of the open-source model ecosystem makes it a high-value attack target. These five malicious repositories accounted for a tiny fraction of the 3.27 million public repositories, but downloads rose from 1,502 to 2,428 in a single day, showing the driving effect of popular model names and “uncensored” labels on download behavior. Mir2k is said to be a newly registered account that pre-created empty repositories named after popular yet-to-be-released models, aiming to seize the spot ahead of time when new models are released. For hosting platforms, how to establish pre-screening of new accounts, sensitive labels and abnormal file structures while maintaining the efficiency of open collaboration will become a practical issue for the next stage of governance.
