36One call

Spotlighting

Mark untrusted text inside the prompt so the model can tell it apart from your instructions.

Hines et al., Nasr et al., Microsoft, Anthropic, Simon Willison

markedExternal textCodeSpotlightingContextSystem promptModel callLLMAnswer
How to read this

The problem

A model cannot tell your instructions from instructions hidden in the text it is asked to read.

The prompt injection problem stems from the LLM’s inability to distinguish between valid system instructions and invalid instructions that arrive from external inputs.
Hines et al.Defending Against Indirect Prompt Injection Attacks With SpotlightingMar 20, 2024
In the AI security vulnerabilities reported to Microsoft, indirect prompt injection is one of the most widely-used techniques.
MicrosoftHow Microsoft defends against indirect prompt injection attacksJul 29, 2025

Therefore

We introduce spotlighting, a family of prompt engineering techniques that can be used to improve LLMs’ ability to distinguish among multiple sources of input.
Hines et al.Defending Against Indirect Prompt Injection Attacks With SpotlightingMar 20, 2024
Spotlighting involves specific changes to the system prompt and a corresponding transformation of the external text.
MicrosoftHow Microsoft defends against indirect prompt injection attacksJul 29, 2025
JSON escaping provides unambiguous delimiters between the untrusted payload and the surrounding structure, so an attacker cannot close a quote or tag to “break out” into an instruction context.
AnthropicMitigate jailbreaks and prompt injections

In use

Microsoft

Microsoft’s multi-layered defense includes: Preventative techniques like hardened system prompts and Spotlighting to isolate untrusted inputs.
MicrosoftHow Microsoft defends against indirect prompt injection attacksJul 29, 2025

Where it breaks

People have written many attacks that get past it, and an attacker who knows the delimiters can forge them.

human participants generated 265 successful attacks against Spotlighting and 178 against Prompt Sandwiching.
Nasr et al.The Attacker Moves Second: Stronger Adaptive Attacks Bypass Defenses Against LLM Jailbreaks and Prompt InjectionsOct 10, 2025
If an adversary gains knowledge of our system prompt, and therefore an understanding of the delimiting strategy, then it would be simple to craft a string that contains our delimiters and overrides our instructions.
Hines et al.Defending Against Indirect Prompt Injection Attacks With SpotlightingMar 20, 2024
Any difference between instructions and user input, or text wrapped in delimiters v.s. other text, is flattened down to that sequence of integers.
Simon WillisonDelimiters won’t save you from prompt injectionMay 11, 2023

Sources

  1. Defending Against Indirect Prompt Injection Attacks With SpotlightingKeegan Hines, Hines et al., Mar 20, 2024
  2. The Attacker Moves Second: Stronger Adaptive Attacks Bypass Defenses Against LLM Jailbreaks and Prompt InjectionsMilad Nasr, Nasr et al., Oct 10, 2025
  3. How Microsoft defends against indirect prompt injection attacksAndrew Paverd, Microsoft, Jul 29, 2025
  4. Mitigate jailbreaks and prompt injectionsAnthropic
  5. Delimiters won’t save you from prompt injectionSimon Willison, May 11, 2023

Added Nov 14, 2026