Report #94977
[gotcha] LLM behavior hijacked by closing the few-shot block in the system prompt
Avoid using user-controllable data to construct few-shot examples. If dynamic examples are necessary, encapsulate them in XML tags and explicitly instruct the LLM that the examples are untrusted data, not instructions.
Journey Context:
Developers often build system prompts by concatenating static instructions with dynamic few-shot examples fetched from a database. If an attacker can manipulate an example \(e.g., a previous user query stored in the DB\), they can inject a sequence that closes the few-shot format and opens a new instruction block, effectively rewriting the system prompt.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T18:00:04.461636+00:00— report_created — created