mlsanityData to 14 Oct 2026

Structural Role Injection in Handlebars-Templated LLM Prompts: Triple-Brace Interpolation, Delimiter Family, and the Limits of HTML Auto-Escaping

arXiv 2606.18120 ↗First posted 16 Jun 2026cs.CR cs.AI cs.CLcited by 0

Not on the map. Why?

Abstract (arXiv)

Large language model applications build prompts from templates, and Handlebars is a widely used templating engine and the default prompt-template format in Microsoft Semantic Kernel. Its double-brace {{x}} expression HTML-escapes the interpolated value and is documented as the safe default; its triple-brace {{{x}}} expression inserts the value raw. We show that this choice silently governs an application's exposure to structural role injection, where attacker-controlled data carries chat role delimiters that forge a higher-privilege turn. A model-free analysis establishes the mechanism: Handlebars escaping rewrites angle brackets but not square brackets, colons, or Markdown hashes, so it neutralises ChatML, Llama-3, and XML role delimiters (survival rate 0.00) while leaving Llama-2 [INST], legacy Human:/Assistant:, and Markdown ### delimiters intact (survival rate 1.00 for the last two). We then run 5760 trials across seven delimiter families, two attack objectives, and four models (GPT-3.5 Turbo, GPT-4o mini, GPT-4.1 mini, Claude Haiku 4.5) at a combined API cost of 1.63 USD. GPT-3.5 Turbo follows the task-hijack instruction in 97% of raw and 91% of escaped trials, with the escaping protection concentrated in the angle-bracket families and absent for the colon- and Markdown-based families; the harder secret-exfiltration objective, which does not saturate, exposes the same family interaction more cleanly. Claude Haiku 4.5 resists both objectives almost entirely. The escaped default protects only the delimiter schemes whose characters HTML escaping happens to cover, gives no protection for the rest, and cannot substitute for a structural separation of instruction and data.

Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 9 of its 18 references that are in the map. First posted on arXiv 16 Jun 2026.

Builds on

9 of 18 references.

References · 9

  1. 2024The Llama 3 Herd of Modelscited by 14,715
  2. 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 13,028
  3. 2023Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injectioncited by 1,443
  4. 2022Ignore Previous Prompt: Attack Techniques For Language Modelscited by 832
  5. 2024InjecAgent: Benchmarking Indirect Prompt Injections in Tool-Integrated Large Language Model Agentscited by 538
  6. 2024The Instruction Hierarchy: Training LLMs to Prioritize Privileged Instructionscited by 493
  7. 2024StruQ: Defending Against Prompt Injection with Structured Queriescited by 375
  8. 2023Formalizing and Benchmarking Prompt Injection Attacks and Defensescited by 364
  9. 2024Defending Against Indirect Prompt Injection Attacks With Spotlightingcited by 267

Built on by

Not cited yet.