Skip to content
NewCybercrime Report 2026 · Eight Chapters · A Post Is Not An Incident → Explore The ChaptersCybercrime Report 2026 → Explore
Security NewsNews Explainer

Malicious GGUF Models: How Hidden Templates and Payloads Work

Malicious GGUF models can hide prompt instructions and appended Windows code. See Malspark's findings, download-count limits, and model intake checks.

By
Brandefense Research Team
Reviewed by
Brandefense Analyst Team
Published
29 November 2026
Reading time
8 min read
Abstract model file showing separate metadata and data layers

Malicious GGUF models can hide two hazards inside an apparently usable local AI file. Malspark’s November 2026 investigation found poisoned chat templates and, in two models, a Windows program appended after the model weights. The models could still answer normally while their templates tried to steer a user or an agent toward running a command.

Malspark says its November 26 scan covered 3,273,389 public Hugging Face model repositories and found five malicious GGUF models. Those five showed 2,428 downloads as of November 27. Downloads are a platform counter, not a count of distinct people or infected devices. Teams evaluating model-origin threats can place the finding within their cyber threat intelligence platform workflow.

How Malicious GGUF Models Cross a Trust Boundary

A GGUF file stores metadata, including a chat template, before its tensor data. A runtime uses that template to arrange each conversation before the model reads it. Malspark found that attackers changed this metadata to add instructions the person chatting with the model would not see. The observed attack used ordinary template logic, rather than an escape from the runtime’s template engine.

The boundary is between data obtained from a public repository and instructions allowed to influence a local assistant. A developer may inspect model output but never inspect the template preparing each prompt. A coding agent with a shell tool is exposed differently from a person using chat alone. The agent may act on a hidden directive; the person must choose to run a displayed command.

Malspark uses Mir2k and timdedid as campaign labels for the observed repositories. Those labels do not establish the identity of real-world operators. The researchers also reproduced other GGUF hiding locations in synthetic files. Their lab examples are possible design paths, not additional malicious repositories from the public scan.

Observed model-to-host paths
  1. Public modelA person or agent loads an untrusted GGUF artifact
  2. Poisoned templateHidden instructions steer output or a tool call
  3. Execution stepA person runs a line, or an agent uses its shell
  4. Host activityMalspark analyzed a Windows implant in the Mir2k case

Mir2k Planted a File Before Arming Its Template

According to Malspark’s repository-history review, one Mir2k model was uploaded on November 22 and another on November 24. Each initially had a clean chat template while carrying an appended Windows program. On November 26, both templates changed to make the model begin replies with a PowerShell line. Malspark reports a second template change about nine hours later that broadened where the line looked for the model file.

The sequencing matters for triage. A model downloaded before the template change may contain the appended program without the later prompt behavior. A later download can contain both components, according to the research.

A normal answer from the model does not prove that its metadata is safe. The stored artifact and its acquisition date matter when reconstructing exposure.

GGUF loaders use declared tensor ranges and can ignore bytes after the last tensor. Malspark says Mir2k used that trailing space to carry the same Windows program in two forms, including a compressed form. The malicious template then tried to get those bytes out through a displayed command. A scanner that only examines a file’s final few kilobytes can miss the payload, the researchers warn.

Malspark’s static analysis describes the recovered program as a Windows remote access implant with credential theft, screen capture, keylogging, and mining capabilities. The researchers observed persistence and sandbox-detection code. These are capabilities of the analyzed sample, not evidence that every download produced an infection. Their analysis also reports that an attempted privilege bypass failed because of a malformed path.

Timdedid Targeted Agents That Can Use a Shell

Malspark found three byte-identical GGUF models under the timdedid campaign label, published on November 21 and 22. Their template used a trigger phrase in the latest user message. When triggered, it inserted a hidden directive asking an agent to use a PowerShell tool to retrieve and run a script. An ordinary answer could conceal the instruction that reached the agent.

This path depends on an assistant that can act through a shell tool. It is different from an executable automatically running when a GGUF file is loaded. Malspark did not recover the second-stage script, so the study does not establish what it would install. The immediate defensive question is whether model-supplied text can authorize tool actions in an organization’s agent setup.

The two campaign labels describe different execution gates. In Mir2k, the source says a user may copy a command placed at the start of replies. In timdedid, the poisoned template tries to make a tool-enabled agent act.

Both begin with trusting an embedded template. Neither supports treating a download count as a count of compromised endpoints.

What the Repository Scan Actually Measured

Malspark says it scanned public model repositories on November 26, including 226,310 GGUF repositories, and parsed 572,184 chat templates statically. It read GGUF headers and file ends with HTTP Range requests instead of downloading all weights. Researchers manually excluded security test repositories, benign persona prompts, and published research samples before reporting five malicious models. That review narrows the finding but does not measure infections.

Malspark public-repository scan

The five repositories remained online when Malspark checked on November 27, the report says. Its listed download counts total 2,428 at that point. The count was 1,502 at the November 26 scan, so the counter changed during the observation window. That change shows repository activity, not how many people loaded a model or executed a command.

Only two of the five models held the recovered Mir2k Windows program, according to the study’s table. The three timdedid copies used the agent-directed template path, and their second stage was unavailable for analysis. Those differences matter when setting detection priorities. A host investigation for Mir2k follows a different evidence trail from reviewing tool actions by a coding agent.

How to Check Models Without Running Them

For a downloaded GGUF file, first preserve its source, acquisition time, and local copy for review. Malspark recommends static inspection before loading the model. Its gguf-radar tool parses template logic without executing it and checks for data beyond declared tensor bounds. The researchers say it can rebuild a clean GGUF file while keeping dequantized weights unchanged.

That rebuild is useful after a team understands what it removes. Replacing the embedded template with a reviewed one addresses hidden prompt instructions. Removing trailing bytes addresses the appended-file path seen in Mir2k. We recommend retaining the original for evidence, checking the rebuilt artifact in a controlled environment, and documenting the decision to accept or reject the model.

Review the model’s provenance and template separately from its conversational quality. A convincing answer does not reveal whether the template inserted an unseen system message. Inspect the structural boundary after the final tensor, rather than only a tail sample. Malspark also tests non-zero padding and zero-scale blocks, but describes those cases as lab reproductions rather than observed malicious models.

For agents, record shell-tool invocations and look for actions originating immediately after model-generated text. Require a trusted, reviewed template when a local model is given tool access. Malspark notes that llama.cpp and Ollama can use an explicitly supplied template in place of an embedded one. This control addresses hidden instructions while structural inspection addresses hidden bytes.

Model intake review
  • Record provenanceSave the model source, version, and download time before analysis.
  • Inspect structureReview template logic and bytes beyond declared model data.
  • Constrain agentsUse a reviewed template and approve shell actions.
  • Investigate hostsReview execution and endpoint evidence tied to the model.

How Should Defenders Interpret a Possible Exposure?

Identify which file version entered the environment and whether chat software or a tool-enabled agent loaded it. A download of a repository is only a lead. A displayed command requires a user action in the Mir2k path, while the timdedid path calls for agent tool logs. On Windows endpoints, review execution and persistence evidence before concluding that the recovered implant ran.

Separate model acceptance from incident response. The first decision concerns whether an untrusted artifact can enter a model registry or developer machine. The second concerns whether a command actually executed and what the host did afterward. Teams can use their existing software supply chain risk process to assign those checks to model owners and endpoint responders.

This case differs from the earlier Hugging Face model malware report, which covered a separate campaign and trust setting. The practical lesson here is combined inspection of metadata, file structure, and agent permissions. Malspark’s evidence supports the observed files and static capabilities; the public download counter does not establish a victim tally.

Frequently Asked Questions

Does loading a malicious GGUF file automatically execute the appended program?

Malspark describes a separate execution step. The Mir2k template placed a command in replies, and the timdedid template tried to direct a shell-enabled agent.

Do 2,428 downloads mean 2,428 infected people?

No. Malspark's November 27 figure is a platform download count for five models. It does not establish distinct users, command execution, or infections.

What should a team inspect before using a community GGUF model?

Review the embedded chat template and bytes outside declared tensor data. Record provenance and keep model-origin instructions away from unapproved shell actions.

Sources

  1. Malspark, GGUF LLM Models with Hidden Malware on Hugging Face, November 2026
Share this articleLinkedInXEmail
Brandefense logo

Stay Ahead of Digital Threats.

Take control of your digital security with an exclusive demo of our AI-driven threat intelligence platform.

Open The Full Demo Form →