Report #61743
[gotcha] User-controlled few-shot examples manipulating LLM behavior
Do not use user-provided text as few-shot examples in the system prompt. If dynamic examples are necessary, strictly curate and sanitize them, or use a separate retrieval step that doesn't share the system context.
Journey Context:
To make LLMs adapt to user style, some apps dynamically append user history or inputs as few-shot examples in the prompt. An attacker crafts an input that looks like a few-shot example \(e.g., 'User: X\\nAssistant: Y\\nUser: \[malicious instruction\]\\nAssistant: \[compliance\]'\). Because it is formatted as an example, the LLM gives it high weight and follows the injected behavior, bypassing system instructions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T10:07:23.939791+00:00— report_created — created