Skip to content

Response, New York. Noah Park: Check Point Patches Actively Exploited Management Server Path Traversal. Detection, Dallas. Ava Okello: Report Finds Nearly Half of Deployed Detections Need Attention Before SOCs Can Trust Them.

SOCtember

Always First. Fast SOC News.

The cover image of Malspark's report, reading Malicious LLM Models on Hugging Face above a diagram of a GGUF file with a template block, a grid of model weights and a yellow block labeled malware after the last tensor, and the line 2400+ downloads of 5 malicious GGUF models.
Image: Malspark (fair use), malspark.com, report of November 27, 2026.

Detection

Researcher Finds Five Poisoned AI Models on Hugging Face That Hide Malware After the Last Tensor or Tell Coding Agents to Run PowerShell, and Antivirus Missed the Payload

A scan of 3.27 million public model repositories turned up GGUF files whose chat templates quietly tell the model to print a command that unpacks a Windows remote access trojan from the model file, or tell an agent with shell access to download a script. The models were still online Sunday, and their download counters had grown past 4,200.

Ava Okello, DetectionLondon7 min read

LONDON - Two accounts on Hugging Face, the largest public hub for AI models, have been distributing local language models that look and answer like ordinary downloads but carry hidden instructions in their chat templates, and in one campaign a full Windows remote access trojan tucked into the end of the model file, according to research published Friday on the malware research blog Malspark.

The researcher, who publishes detection rules and an open-source scanner under the handle Root0ne, said a static scan of all 3,273,389 public model repositories on Hugging Face on Nov. 26 found five malicious models in the GGUF format, the file type most people use to run models locally with tools such as llama.cpp, LM Studio and Ollama. The five had been downloaded 2,428 times as of Nov. 27, up from 1,502 a day earlier. Hugging Face counts downloads rather than people, the report notes.

All five repositories were still online on Sunday evening, and Hugging Face's public counters for them had risen to a combined 4,221 downloads, a SOCtember check of the hub's API at about 8:25 p.m. London time showed.

A model that asks you to run its malware

Every GGUF file carries a chat template, a small Jinja2 program stored in the file's metadata that the runtime uses to format each conversation before the model reads it. The template is never shown in the chat window. The report says the attackers did not need to break out of the restricted template engines that C++ runtimes use. They used ordinary template logic to add text the user never sees.

The larger campaign came from a new account called Mir2k, which the report says shows French traces throughout. On Nov. 22, the account created 14 repositories, 12 of them empty placeholders named after models that have not been released, such as Qwen4-27B, DeepSeek-V4 and Llama-4-Scout, ready to be filled when those names start trending. The same day it uploaded an uncensored build of a Qwen3.5 9B model with a Windows executable appended after the last tensor, the point where the model data ends and loaders stop reading. A second model followed on Nov. 24 with the same program compressed with raw Deflate, which strips any recognizable file signature.

For days, both files carried clean templates, so the payload sat inert. On the morning of Nov. 26, both templates were replaced within about an hour, and nine hours later they were replaced again. The armed version adds a system message, in French, telling the model to begin every reply with one PowerShell line, copied character by character, and then answer normally. That line finds the largest .gguf file in the user's profile, reads its final bytes, decompresses them where needed and writes and starts %TEMP%\d.exe. In the Inkling model, it reads the last 4,200,000 bytes.

The report says downloads made before Nov. 26 contain the payload but not the trigger, which means a file pulled earlier is still carrying a dormant implant that a later template could arm.

An annotated screenshot of the armed Mir2k Inkling chat template file, with three red boxes marking a French system prompt that makes the model start every reply with a PowerShell command that hunts for .gguf files in the user profile, the code that seeks the last 4.2 MB of the file and inflates it with a Deflate stream in memory, and the code that writes %TEMP%\d.exe and launches it.
Image: Malspark (fair use), annotated Mir2k Inkling chat template of November 26, 2026.

What the implant does

Both Mir2k models unpack to the same 11.47 MB Windows x64 program, most of which is a bundled copy of the Tor anonymity software. The researcher calls it ollie, after the folder name it uses under AppData\Roaming, which the report notes is close enough to Ollama to look familiar. Neither its hash nor its strings had public sightings at the time of writing, the report says.

According to the static analysis, the program exits if it finds VirtualBox, VMware or Sandboxie drivers or usernames such as sandbox, malware and test. On a real machine, it creates a scheduled task that runs it every 10 minutes with highest privileges, starts two watchdog processes, re-enables itself through the StartupApproved registry keys and marks its process as critical, so ending it crashes Windows. It reaches its operator through a Tor onion service, steals saved passwords from Chrome, Edge and Brave through DPAPI, targets the Phantom and MetaMask wallet extensions, supports keylogging, clipboard capture, screenshots, screen streaming and webcam capture, and mines Monero when the machine is idle. An attempted fodhelper.exe UAC bypass fails because the registry paths were compiled without their backslashes.

A table from Malspark's report listing the malicious repositories found in the scan: Mir2k/Huihui-Qwen3.5-9B-abliterated-GGUF and Mir2k/Inkling-2-Mini-Uncensored-GGUF, using a reply prefix with a hidden executable or hidden compressed executable, payload recovered and analyzed, with 1,488 and 458 downloads; and timdedid repositories qwen3.8-cyber-uncensored and qwen3-cyber-UNCENSORED-2 using tool hijacking, second stage not recovered, with 271 and 136 downloads.
Image: Malspark (fair use), Section 3 scan results table, November 27, 2026.

A trigger aimed at coding agents

The second account, timdedid, published three byte-identical copies of a small Qwen3 1.7B model pitched at security users on Nov. 21 and 22, along with an Ollama mirror. Its template is the official Qwen3 template with one addition. When the user's latest message contains the phrase "What is," it inserts a fake system directive telling an agent with shell access to call its PowerShell tool, download a script called value.ps1 from a WordPress site into C:\Windows\Temp\payload.ps1 and run it in a hidden window. The model's README advises users not to replace the embedded template.

The researcher did not recover the second-stage script, so what it would have installed is unknown. The trigger, directive and download command are all visible in Hugging Face's own metadata viewer for the files.

A screenshot of Hugging Face's GGUF metadata viewer for timdedid/qwen3.8-cyber-uncensored, annotated in red to mark a dormant trigger that fires when the user prompt contains What is, an injected SYSTEM DIRECTIVE forcing a background PowerShell tool call, and a stage-two dropper that downloads value.ps1 to C:\Windows\Temp\payload.ps1 and runs it hidden with an execution policy bypass.
Image: Malspark (fair use), annotated Hugging Face metadata viewer, November 27, 2026.

Why scanners missed it

Neither half of the technique is new. The report credits Pillar Security with showing hidden instructions in GGUF chat templates in July 2025 and academic work this year that measured the attack across models and inference engines. What is new, the researcher says, is seeing it in live attacks and combining it with an executable appended after the last tensor and a template armed days later. Nothing in the GGUF format executes code on load, which is why earlier guidance, including Sysdig's model-format research, listed it as having no known code execution path. The Malspark attack routes execution through the user or the agent instead.

The appended bytes do not change how a model loads or behaves, and no runtime warns about them. The report says antivirus engines and checks that read only the last few kilobytes of a file did not see the compressed payload, and the first Mir2k model padded its executable with about half a megabyte of filler for the same reason. Safetensors files are not exposed to this half of the method because the safetensors loader rejects any file whose declared tensors do not fill it exactly, though templates stored beside those models can still be poisoned. The researcher also showed in synthetic lab files three more places to hide data in GGUF that the live malware did not use: oversized alignment padding, a ZIP archive appended to make a model that also imports as Python, and quantized weight blocks with a zero scale.

The report's scanner, gguf-radar, parses templates into a syntax tree without running them, flags file reads, decompression, process starts, download commands and hidden directives, reports any bytes past the end of the model data and rebuilds a clean file with the weights unchanged. It is released under the MIT license with four YARA rules, and the post lists 20 indicators and a MITRE ATT&CK and ATLAS mapping.

What a SOC should do now

  • Inventory local models. Find .gguf files on developer and analyst workstations and scan them with gguf-radar or the published YARA rules. Pay attention to the Mir2k and timdedid repository names and to anything labeled uncensored or abliterated.
  • Hunt the execution chain. Look for PowerShell that searches the user profile for .gguf files, opens one with IO.File OpenRead or IO.Compression.DeflateStream, and writes or starts d.exe in %TEMP%.
  • Hunt the implant. Look for an ollie folder under AppData\Roaming, a scheduled task firing every 10 minutes with highest privileges, Tor listening on port 9050 on a workstation and new StartupApproved entries.
  • Check agent activity. Review PowerShell tool calls by coding agents for downloads to C:\Windows\Temp\payload.ps1, hidden-window launches and requests for value.ps1, and block the indicators in the report.
  • Pin templates. Where local models have tool access, supply a reviewed template with llama.cpp's --chat-template-file option or the TEMPLATE line in an Ollama Modelfile so the embedded one is never used.
  • Gate the registry. Run every incoming model through a structural scan before it reaches an internal model registry or a developer laptop, and treat any command a model suggests as untrusted input.

About the Author

Ava Okello

Ava Okello covers detection engineering and SOC operations for SOCtember from London.

Related stories

Detection desk