AINovember 29, 2026 · 4 min read

Poisoned AI models on Hugging Face hid a Windows trojan after their weights

A researcher's scan of every public Hugging Face model found five GGUF files built to infect users: two hid a Windows trojan past the model weights, and three tried to hijack AI agents. Hugging Face has disabled all five.

A laptop and a small desktop PC with a lit graphics card on a dark wooden desk at night, the kind of setup used to run AI models locally
Illustration: Venture Block

Five AI models posted to Hugging Face between Nov. 21 and Nov. 24 were built to infect the computers of people who downloaded them, according to a scan published on Nov. 27 by the security researcher behind Malspark. Two of them carried a full Windows remote access trojan tucked into the end of the model file, and the models had been downloaded 2,428 times by the time the findings went public.

The researcher scanned all 3,273,389 public model repositories on the hub on Nov. 26, including 226,310 repositories of GGUF files, a format widely used to run open models locally in tools such as llama.cpp, LM Studio and Ollama. The scan parsed 572,184 chat templates without executing them and read file headers and endings through HTTP range requests, so no model had to be downloaded in full. After manual review, five repositories from two accounts were left. Hugging Face's own API now lists all five as disabled, which CuriousLM first reported on Nov. 28.

Two blind spots in one file

The attack combines two weaknesses in how GGUF files are read. The first is the chat template, a small Jinja2 program stored in the file's metadata that formats every conversation before the model sees it. Users never see what it adds. The second is that a GGUF header tells the runtime exactly where the model weights end, and runtimes ignore anything after that point. Bytes appended past the last tensor don't change how the model loads or behaves, and no runtime warns about them. The Safetensors format closes that gap, because its loader rejects a file whose declared tensors don't fill it exactly.

The account Mir2k used both. On Nov. 22 it created 14 repositories, 12 of them empty placeholders named after models that haven't shipped yet, such as Qwen4-27B and DeepSeek-V4, ready to be filled when those models appear. The same day it uploaded an "abliterated" build of Huihui Qwen3.5 9B with a Windows program appended after the weights. On Nov. 24 it added an "uncensored" build of Thinking Machines' Inkling 2 Mini, with the same program compressed using raw Deflate so that no recognizable file signature remained.

For several days both files carried the payload with nothing to start it, since their templates were clean. On the morning of Nov. 26, Mir2k replaced both templates, then replaced them again about nine hours later. The new template adds a hidden system message, written in French, telling the model to begin every answer with one PowerShell line. That line finds the largest .gguf file in the user's profile, reads the bytes hidden at its end, writes them to the temp folder as d.exe and runs it. Anyone who pasted the line into a terminal installed the malware. Copies downloaded before Nov. 26 contain the payload but not the trigger.

What the trojan does

Both models unpack the same 11.47 MB program, 10.25 MB of which is a bundled copy of the Tor client. According to Malspark's static analysis, it exits if it detects a virtual machine or sandbox. Otherwise it schedules itself to run every 10 minutes with the highest privileges and marks its process as critical, so killing it crashes Windows. It talks to its operator over a Tor onion service and can send saved passwords from Chrome, Edge and Brave, target the Phantom and MetaMask wallet extensions, log keystrokes, capture screenshots and webcam images, and mine Monero when the machine is idle. It stores its files in folders named "ollie", close enough to Ollama to look familiar.

The second account, timdedid, aimed at AI agents rather than people. On Nov. 21 and 22 it published three identical copies of a Qwen3 1.7B model pitched at security users, plus a mirror on Ollama's library. Their template stays quiet until the user's message contains the words "What is", then inserts a fake system directive telling any agent with a PowerShell tool to download a script from a WordPress site and run it in a hidden window. The researcher could not recover that second-stage script, so what it would have installed is unknown. Agents with shell access have become a recurring weak spot this month, as when Together AI said a coding agent leaked the key to stored customer prompts.

Known in the lab, now seen in the wild

Neither technique is new on paper. Pillar Security described poisoned GGUF chat templates in July 2025, and a 2026 paper on inference-time backdoors tested template attacks across 18 models and four inference engines. Hiding malware inside model weights dates to the EvilModel research of 2021. Malspark says it found no earlier public report of the combination Mir2k used: an executable appended after the last tensor, with the template switched on days later.

The download count also needs a caveat. Hugging Face counts downloads, not people, so the number of affected users is at most 2,428 and likely lower. The researcher says antivirus engines and checks that only read the last few kilobytes of a file did not catch the compressed payload.

Alongside the report, the researcher released gguf-radar, an MIT-licensed tool that inspects a GGUF file's template and structure without running anything, flags bytes after the last tensor and hidden directives, and writes a clean copy with the weights unchanged. The practical advice is short: treat any command a model suggests as untrusted, and for agents with tools, load a reviewed template with llama.cpp's --chat-template-file option or an Ollama Modelfile instead of the one embedded in the download. The report also asks model hubs and runtimes to reject GGUF files that carry data past the last tensor, which would shut down the method Mir2k used.

Newsletter

The Block Brief

The stories that matter in startups and venture, in your inbox. Free.

Check your inbox to confirm.

Something went wrong. Try again.

More in AI