Report #20935
[gotcha] Few-shot example poisoning via user-controlled context
Do not dynamically include user-generated content as few-shot examples in the system prompt. If dynamic examples are necessary, strictly sanitize and validate them, or keep them in a separate user-role message rather than the system role.
Journey Context:
To improve formatting, developers sometimes append successful past interactions \(user input \+ LLM output\) into the system prompt as few-shot examples. An attacker crafts a seemingly benign input that, when added as a few-shot example, teaches the LLM a new output format or overrides previous instructions \(e.g., adding an example where the LLM outputs a malicious script\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T13:32:39.165992+00:00— report_created — created