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
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.
In the AI security vulnerabilities reported to Microsoft, indirect prompt injection is one of the most widely-used techniques.
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.
Spotlighting involves specific changes to the system prompt and a corresponding transformation of the external text.
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.
In use
Microsoft
Microsoft’s multi-layered defense includes: Preventative techniques like hardened system prompts and Spotlighting to isolate untrusted inputs.
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.
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.
Any difference between instructions and user input, or text wrapped in delimiters v.s. other text, is flattened down to that sequence of integers.
Sources
- Defending Against Indirect Prompt Injection Attacks With SpotlightingKeegan Hines, Hines et al., Mar 20, 2024
- The Attacker Moves Second: Stronger Adaptive Attacks Bypass Defenses Against LLM Jailbreaks and Prompt InjectionsMilad Nasr, Nasr et al., Oct 10, 2025
- How Microsoft defends against indirect prompt injection attacksAndrew Paverd, Microsoft, Jul 29, 2025
- Mitigate jailbreaks and prompt injectionsAnthropic
- Delimiters won’t save you from prompt injectionSimon Willison, May 11, 2023
Added Nov 14, 2026