Free · Daily brief + weekly playbookDaily 60-sec AI Voice Brief + Weekly Production AI Agent PlaybookGet the brief →

Malicious Launch Commands Hidden in Chat Templates of GGUF Models

You download an "uncensored" GGUF model from Hugging Face and get invisible instructions along with it. According to Malspark, the chat template hides a system prompt that standard interfaces do not show. In one case, the prompt makes the model download and run a malicious script; in another, it extracts a script embedded in the file itself. Models from unverified sources should therefore be treated as code, not as harmless weights.

AI-processed from TG: @derplearning (Derp Learning); edited by Hamidun News
Malicious Launch Commands Hidden in Chat Templates of GGUF Models
Source: TG: @derplearning (Derp Learning). Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceTG: @derplearning (Derp Learning) ↗
Editor-in-Chief
Key metric #1The chat template lives in the GGUF metadata and is applied to every conversation
Scenario 1the model downloads and runs a malicious script on its own
Scenario 2the script is hidden inside the GGUF and extracted from there

The usual routine: you go to Hugging Face, find a fresh "uncensored" GGUF file, download it, and run it locally. Weights are just numbers, what could happen? Researchers at Malspark have shown that quite a lot can happen: the published models contained hidden instructions that turn a harmless chat into a channel for delivering malicious code. The finding was reported by the Telegram channel Derp Learning, which linked to the Malspark report.

What exactly is hidden in the model

Most chat models have a dialogue template. It determines how user and assistant messages are joined into a single text that the neural network sees. In GGUF, this template is stored directly in the file's metadata and applied automatically when you run the model through llama.cpp, Ollama, LM Studio, and similar programs.

This is where the harmful payload is hidden. An attacker adds a system prompt to the template, meaning an instruction the model receives before each of your messages. Standard interfaces show only your conversation and the replies, so this service text stays out of view. It works like a hidden note to a waiter: you order one thing, but he has been instructed in advance to do another.

Two attack scenarios

According to the post, two variants were found.

In the first, the hidden prompt makes the model download a malicious script and run it. This is dangerous wherever the model has access to tools: a terminal, code execution, a browser, or an agent framework. The more rights you give a local assistant, the easier it is for it to "carry out the task."

In the second variant, the script is embedded in the GGUF file in advance, and the hidden instruction tells the model to extract it from there. No network request is needed in this case, so such a scheme is easier to slip past filters that monitor downloads.

An important caveat: these scenarios apply when the model can actually execute commands. If you simply chat with a model in an isolated window without tools, the worst it will do is produce strange or intrusive text. But agent and coding setups with automatic command execution are now commonplace, and the line between "chatting" and "executing" is quickly blurring.

What developers and teams should do

The main lesson is to treat a model file not as a set of numbers but as an artifact with executable behavior. The practical steps are fairly down to earth:

  • Before running a model, open its metadata and read the chat template field. Any links, shell commands, or mentions of curl, wget, powershell, or base64 are a reason to stop.
  • Do not give a local model access to the terminal or file system without a sandbox: a container, a virtual machine, or a separate user with minimal rights.
  • Download quantizations from authors and organizations you already trust, not from random accounts with trendy names. Verify the repository against the model's official source.
  • In corporate environments, maintain an allowlist of model sources and scan files the same way you scan dependencies and Docker images.
  • If you build products on open models, pin file hashes and do not allow automatic updates from external repositories.

Why this matters right now

Open models have become a mass-market tool, and GGUF has become the de facto standard for local deployment. Around popular weights, an ecosystem of fine-tunes, "uncensored" versions, and quantizations from unknown authors is growing quickly. This is an ideal environment for supply-chain attacks: users go looking for "modified" versions themselves and readily drop their caution.

The danger is amplified by the fact that the hidden prompt is invisible to the eye. Classic antivirus tools are not built to check dialogue templates, and developers are not in the habit of reading model metadata. Until the industry develops standards for signing and verifying models, responsibility rests with those who download them.

The post's irony is accurate: not only those who make open source have learned to earn money from it. For practitioners, the takeaway is simple: treat others' weights with the same caution you would apply to someone else's executable, and do not run them with broad permissions until you have checked what is inside.

Story

Key Questions Answered

What exactly is hidden in the model?

Most chat models have a dialogue template. It determines how user and assistant messages are joined into a single text that the neural network sees. In GGUF, this template is stored directly in the file's metadata and applied automatically when you run the model through llama.cpp, Ollama, LM Studio, and similar programs. This is where the harmful payload is hidden. An attacker adds a system prompt to the template, meaning an instruction the model receives before each of your messages.

What are the key details on Two attack scenarios?

According to the post, two variants were found. In the first, the hidden prompt makes the model download a malicious script and run it. This is dangerous wherever the model has access to tools: a terminal, code execution, a browser, or an agent framework. The more rights you give a local assistant, the easier it is for it to "carry out the task." In the second variant, the script is embedded in the GGUF file in advance, and the hidden instruction tells the model to extract it from there.

What developers and teams should do?

The main lesson is to treat a model file not as a set of numbers but as an artifact with executable behavior. The practical steps are fairly down to earth: Before running a model, open its metadata and read the chat template field. Any links, shell commands, or mentions of curl, wget, powershell, or base64 are a reason to stop. Do not give a local model access to the terminal or file system without a sandbox: a container, a virtual machine, or a separate user with minimal rights.

ZK
Zhemal Khamidun — Head of AI at Alpina Digital · MIPT (academic supervisor of the Tech Entrepreneurship department). Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Unified AI Workspace · Nomad

Test Frontier LLMs & Autonomous Agents in One Workspace

Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.

Try Nomad AI →Launch Nomad Agent
Jemal Hamidun

Editor-in-chief · Cite this analysis

Jemal Hamidun

Head of AI at Alpina Digital · Academic Supervisor of the Tech Entrepreneurship Department at MIPT

Head of AI & CPO of AlpinaGPT at Alpina Digital, Academic Lead of Tech Entrepreneurship at MIPT. Founder of Hamidun News and Vibe Academy.

Ready-to-paste citation for journalists, blogs and Telegram channels

Source: Hamidun News — Malicious Launch Commands Hidden in Chat Templates of GGUF Models https://news.hamidun.com/en/news/18602/malicious-launch-commands-hidden-in-chat-templates-of-gguf-m

What do you think?
Loading comments…