Identifying safe GGUF files now requires users to use specialized Python tools like gguf-radar to scan for hidden bytes and suspect tokenizer chat templates. The rise of local large-language models has empowered enthusiasts to run powerful AI on their own hardware, but this autonomy brings significant security risks. Recently, malicious actors have exploited the GGUF file format, which packages model weights and chat templates together. By injecting rogue instructions into these templates, attackers can force an AI to provide responses that look helpful but actually contain destructive code. This method relies on the social engineering aspects of AI interaction, where a user might blindly copy and paste a command generated by their assistant. Security researchers have identified several “uncensored” models on Hugging Face that were weaponized to deliver trojans, proving that local environments are not a safe haven if the source file is compromised. This vulnerability exists because instructions are deeply embedded within the file structure.
1. Compromised GGUF Model Files and Payload Injection
A detailed investigation recently uncovered five malicious repositories distributed by two specific accounts named Mir2k and timdedid. These accounts uploaded popular models like Qwen and Inkling, which were specifically modified to include a hidden payload. The models were “abliterated” or “uncensored”—terms that often attract users looking for fewer restrictions—making them ideal targets for exploitation. While the model weights themselves appeared normal to standard loaders, a secret trojan was appended after the final data block. This extra data remained invisible to the AI during standard inference but waited for a specific trigger to be activated. The researcher Root0ne discovered these anomalies while scanning millions of public repositories, highlighting the threat surface. Although the accounts were eventually disabled, thousands of downloads had already occurred, meaning the files remain on local systems.
The core of this attack lies in the modification of the chat template, which is a small script responsible for formatting the conversation. In the case of the Mir2k models, the attacker updated these templates to include a French instruction that forced the AI to prepend every response with a malicious PowerShell command. Because the instruction was hidden within the system prompt, the user would never see the order given to the AI; they would only see the resulting command in the chat window. If a user followed the AI’s advice and executed that line, the PowerShell script would scan the user’s directory for the original GGUF file, extract the hidden binary data from the end, and save it as an executable in a temporary folder. This sophistication demonstrates how attackers leverage the trust users place in local software to bypass traditional security perimeters that focus on network traffic or downloads.
2. Malware Functionality and Agent Exploitation
Once the PowerShell command is executed and the payload is extracted, it launches a program identified by researchers as “ollie.” This malware is a multifaceted information stealer specifically designed to harvest sensitive data from a victim’s machine. It focuses heavily on web browsers like Google Chrome, Microsoft Edge, and Brave, targeting saved passwords, cookies, and autofill information that could grant access to personal accounts. Beyond standard credentials, the malware is programmed to search for cryptocurrency wallet extensions, including popular options like MetaMask and Phantom. By compromising these digital wallets, the attackers can potentially drain funds without the user ever realizing their local AI model was the source of the breach. The integration of such aggressive data extraction tools within an AI model file marks a significant shift in how malware authors adapt to the modern tech stack.
The second malicious account, timdedid, employed a different but equally dangerous strategy by targeting AI agents rather than human users. These models were promoted as specialized tools for security researchers, often with “cyber” or “uncensored” labels. Unlike the Mir2k models that required manual execution of a command, these versions were designed to interact with agents that have permission to run shell scripts automatically. The chat template was configured to wait for a specific trigger phrase, such as “What is,” in the user’s message. Once triggered, the model would output a command directing the agent to download and execute a script from a remote site. This approach exploits the trend of giving AI models autonomous access to terminal environments, where the agent might perform the malicious action without any secondary confirmation from the human supervisor who is overseeing the task.
3. Verification Steps and Strategic Security
Protecting a system from poisoned models begins with the removal of known malicious files from Mir2k or timdedid. For all other local models, a manual inspection of the chat template is recommended using the gguf-dump --json --no-tensors command. To enhance security, users can also utilize the gguf-radar tool, which requires Python 3.10 or newer. This scanner looks for suspicious byte sequences and analyzes chat templates for malicious patterns without executing them. It is crucial to remember that a clean scan is not a total guarantee, but it adds a vital layer of defense. If a template includes hardcoded PowerShell commands or references to unknown URLs, it must be discarded immediately. If users suspect infection, they should check temporary folders for d.exe and search for “ollie” folders in the Roaming directory. If found, the machine must be taken offline and account credentials updated from a clean device.
The emergence of weaponized GGUF models demonstrated that the convenience of local AI came with a price that many users were unprepared to pay. This incident proved that traditional antivirus software often failed to recognize malicious payloads when they were bundled within large binary model files. Moving forward, the developer community prioritized the creation of more robust validation frameworks and sandboxed environments for model inference. Experts recommended that individuals treat every third-party model with the same level of caution as an unknown executable file. Organizations successfully mitigated these risks by implementing strict allowlists for approved models and using custom chat templates that overrode those provided in GGUF files. By adopting layered security protocols, the industry shifted toward a more resilient architecture where local AI usage remained productive without compromising system integrity.
