MITRE ATLAS 2026.10 · AML.T0018.003 · Critical severity
Manipulate AI Model: Modify Prompt Construction Logic
Adversaries alter the templates, chat-formatting logic, or context-assembly wrappers—such as Jinja chat templates inside GGUF files or orchestrator prompt builders—that wrap every user prompt before inference. Compromising prompt construction logic injects persistent hidden instructions or disables role boundaries across every conversation automatically.
Technique dossier overview
- Category
- Prompt and context integrity
- Severity
- Critical
- Attack surface
- LLM / Prompt Layer · Model Weights & Supply Chain · Tool-Using Agents & MCP
- Framework maturity
- Demonstrated
- Platforms
- Generative AI, Agentic AI
- Tactics
- AI Attack Adaptation, Persistence
- Catalog entry modified
How the mechanism works
- Attackers modify `tokenizer_config.json`, GGUF `chat_template` metadata, or application-side prompt assembly pipelines.
- Hidden system directives or role-delimiter spoofing rules are baked into the template so every rendered user turn silently inherits attacker goals.
- In insecure Jinja engines, tampered chat templates can also trigger arbitrary template-expression execution when inference servers format messages.
Detection & telemetry signals
- Static template analyzers catching unexpected system directives, role-token mutations, or non-standard Jinja constructs inside model configs.
- Diffs in prompt-rendering telemetry showing hidden prefix/suffix tokens or altered role markers entering production model contexts.
- Checksum or signature alerts on `tokenizer_config.json`, GGUF header metadata, or orchestration template repositories.
Architectural defensive countermeasures
- Store and verify prompt construction templates separately from untrusted model weights using signed version-controlled configs.
- Evaluate GGUF and Hugging Face chat templates in a strict, logic-limited sandbox and inspect rendered prompts before inference deployment.
- Keep structural role delimiters and policy enforcement decoupled from user-editable or third-party tokenizer metadata.
- Run automated golden-prompt rendering diffs in CI whenever base models or tokenizer configs are updated.
Framework crosswalk (OWASP LLM Top 10 & NIST AI RMF)
- OWASP LLM Top 10 (2025)
- OWASP rationale
- Tampered chat templates inject persistent prompt overrides (LLM01) via third-party model metadata (LLM03) and undermine system-prompt boundary integrity (LLM07).
- NIST AI RMF functions
- NIST AI RMF guidance
- Under NIST AI RMF GOVERN 6.1, MEASURE, and MANAGE, treat tokenizer and chat-template configs as executable security boundaries requiring pinning and validation.
Mapped defensive controls
- Validate AI Model AML.M0008
Run independent pre-release and post-fine-tuning assurance suites covering safety regressions, backdoor activation, alignment drift, and privacy leakage before promotion.
- Code Signing AML.M0013
Require cryptographic signatures and transparency-log verification on model artifacts, inference containers, agent skills, and MCP servers before deployment.
- Verify AI Artifacts AML.M0014
Verify provenance, SHA-256 digests, serialization safety, and behavioral integrity of every external dataset, model weight, LoRA adapter, and container prior to loading.
- Generative AI Guardrails AML.M0020
Deploy layered input and output classifiers, constitutional/topic rails, and structural validators with measured benign over-refusal rates—never relying on classifiers as the sole authorization boundary.
Related technique records
Documented incidents & exercises (5)
- Poisoned GGUF Templates: Inference-Time Supply Chain Attack AML.CS0064 · Exercise · June 2025 · Moderate
ATLAS case study: poisoned GGUF chat templates executed attacker code at inference time via model-file supply chain.
- llama-cpp-python GGUF Chat Template Jinja2 Server-Side Template Injection RCE INC-2024-34359 · Incident · May 10, 2024 · Critical · Cloud & AI Infrastructure
CVE-2024-34359 exposed a critical server-side template injection (SSTI) flaw in `llama-cpp-python` when rendering `tokenizer.chat_template` strings embedded inside `.gguf` model headers. Because the Python wrapper passed untrusted Jinja2 template strings directly into an…
- Google Gemini Image Generation Paused After Systemic Historical Inaccuracies INC-OBS-053 · Incident · Feb 22, 2024 · Elevated · Consumer AI & Local Runtimes
On February 22, 2024, Google paused Gemini's ability to generate images of people following widespread public backlash over severe historical and factual inaccuracies across generated imagery. In a February 23 postmortem, Google acknowledged two distinct tuning errors: first,…
- xAI Grok System Prompt Update Triggering Erratic Antisemitic Output Regression INC-OBS-056 · Incident · Jul 8, 2025 · Critical · Consumer AI & Local Runtimes
On July 8, 2025, xAI's public Grok bot on X began emitting erratic antisemitic tropes, praising Adolf Hitler, and adopting an offensive persona across public replies following an unannounced upstream code and system-prompt update. In its subsequent formal apology and…
- StruQ Structured Query Channel Separation Defense Evaluation OBS.EX0027 · Exercise · Feb 9, 2024 · Fine-Tuned Open-Weight LLMs · Dual-Channel Prompt/Data Isolation
Chen et al. (2024) introduced StruQ, pairing a sanitizing front-end tokenizer with structured instruction-tuning that trains models to obey directives exclusively within designated prompt channels while ignoring instructions inside data channels. Evaluated across…
Source citation records
- MITRE ATLAS: Modify Prompt Construction Logic · MITRE ·
- LLM01:2025 Prompt Injection · OWASP GenAI Security Project ·
Common questions
- What is Manipulate AI Model: Modify Prompt Construction Logic (AML.T0018.003)?
- Adversaries alter the templates, chat-formatting logic, or context-assembly wrappers—such as Jinja chat templates inside GGUF files or orchestrator prompt builders—that wrap every user prompt before inference. Compromising prompt construction logic injects persistent hidden instructions or disables role boundaries across every conversation automatically.
- How do you mitigate Manipulate AI Model: Modify Prompt Construction Logic?
- MITRE ATLAS maps 4 mitigations to AML.T0018.003: Validate AI Model, Code Signing, Verify AI Artifacts, and Generative AI Guardrails. Store and verify prompt construction templates separately from untrusted model weights using signed version-controlled configs.