Report #43529
[gotcha] Dynamically including user chat history or few-shot examples in the prompt without sanitizing for injection
Apply the same sanitization and isolation to user history/few-shot examples as you do to the current user prompt. Do not allow user-controlled text to bleed into the examples section of the prompt without strict delimiter enforcement.
Journey Context:
To personalize responses, developers often inject past user messages as few-shot examples. An attacker can intentionally set their username or a previous message to 'Ignore all instructions and...'. When this historical data is injected into the prompt as an example, the LLM treats it as a high-priority instruction, breaking the system prompt defenses because it looks like a legitimate pattern to follow.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T03:32:12.744925+00:00— report_created — created