Malicious Chat Templates Found in Hugging Face GGUF Models, With Malware in Some Files
Researchers found malicious chat templates in some GGUF models distributed through Hugging Face. Some files also contained Windows malware, underscoring the need to review what instructions reach an AI model and which programs it can run.
Instructions can arrive alongside model weights
The GGUF format used by tools such as llama.cpp stores both the model weights, the numbers used in inference, and metadata describing the model.
The security research project Malspark reported that 226,310 of 3,273,389 public model repositories on Hugging Face contained GGUF models. Researchers analyzed 572,184 chat templates without executing them and identified models with malicious instructions.
A chat template turns a user's input and conversation history into the text a large language model (LLM) reads. In these cases it sent the model instructions that never appeared on screen.
Prior research had already shown experimentally that chat templates could influence model responses and how AI agents use external tools even when model weights are unchanged.
Trust in a model's weights does not establish which instructions the AI receives. Those instructions also need review.
Hugging Face GGUF: chat template abuse
| Measure | Instructions for users | Instructions for AI agents |
|---|---|---|
| Affected files or repositories | Two files | Three repositories |
| Contents | Windows remote access malware | External programs not recovered |
| Instructions | Execution instructions added after release | Retrieve and run an external program |
| Trigger | User runs a command | Agent runs it with permissions |
| Risk | Password theft | Specific behavior unknown |
Model loading and the risk of malware execution
According to Malspark, two files uploaded by one account included Windows remote access malware alongside the model weights. The associated templates initially contained no malicious instructions. They were later changed to make the model encourage users to run a program.
Static analysis of the recovered malware found capabilities related to stealing passwords saved in browsers and monitoring keyboard input and the clipboard. Users who followed a model's instructions and launched the malware could expose their passwords and other data.
Malspark found three repositories from a second account whose templates tried to induce AI agents with tool access to retrieve and run external programs. Researchers did not recover the programs, so their specific behavior remains unknown.
In an earlier case involving malicious models on Hugging Face, bundled Python code was the attack route. Here, instructions surfaced by the model or passed to agents encouraged external program execution.
Users may decide whether to run commands themselves or let an agent act on their behalf. The scope of execution permissions matters in both cases.
Removals and files already downloaded
All five repositories named in the investigation were disabled on the Hugging Face API as of November 29. The API showed 2,807 total downloads, up from 2,428 in the report. Download counts do not establish how many devices ran malware or how many people were affected.
One affected model was also listed on Ollama as of November 29. Independent testing by i10X found malicious instructions in the Ollama package. The analysis was static and did not establish whether the template takes effect when the model runs in Ollama.
Removal from a hosting platform does not address files already downloaded. Since the templates in this case changed after publication, checking a model only when it is first downloaded can leave later changes unnoticed.
What file scanning covers
Hugging Face says in its documentation that it scans repository files smaller than 2 GB for malware. It starts scanning when changes are committed to a repository.
As shown by the API on November 29, the two model files that reportedly contained Windows malware were about 6.67 GB and 17.48 GB. Both exceeded the documented scanning limit.
Hugging Face scanning limit and sizes of affected GGUF files (November 29, 2026)
Scan coverage is only part of the question. The instructions that reach the model matter as well. A file scan can find no suspicious program even though a chat template tells the model to encourage external program execution.
Model inspection and execution permissions
The Malspark researchers released gguf-radar, an open-source inspection tool. It examines chat templates and suspicious additional data without running the model. It can remove extra data and rebuild a GGUF file without changing the numerical weights recovered from the file. It can also remove or replace chat templates.
As of November 29, gguf-radar 0.1.3 included comparison with an original chat template. Users select the reference model themselves so the comparison does not rely on provenance claimed by the file under inspection. The release also improves detection of instructions to retrieve external programs and fixes a gap that could omit files identified as shards.
Results only apply to the checks the tool runs. Section 3 of the Malspark report lists affected repositories. Anyone who downloaded an affected model should stop using it and refer to the indicators of compromise in section 7.2 to inspect affected devices and files. For environments that use external tools, the researchers also recommend supplying a separately reviewed chat template. If agents can launch external programs, users can configure them to show commands for review before execution.
Local AI lets people run models in environments they control. Preserving that freedom means choosing both whose models to run and whose instructions can cause what to execute.
KioskNews shows a cleaned-up reading view extracted from the publisher’s page — the original always lives on their site, not ours.
