Report #38063
[gotcha] Dynamic few-shot examples retrieved from a database poison the LLM's behavior
Strictly curate and sanitize dynamic few-shot examples. Do not use user-generated content as few-shot examples without human review, and isolate few-shot examples in the prompt structure so they cannot contain overriding instructions.
Journey Context:
To improve accuracy, systems retrieve similar past interactions to use as few-shot examples. If an attacker interacts with the system in a benign way but includes hidden instructions in their query/response, and that interaction gets stored and retrieved as a few-shot example for a future user, the LLM will follow the attacker's instructions embedded in the example. This is a persistent, spreading attack. The LLM sees the example as 'correct behavior' to mimic, making it highly effective.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T18:22:02.750795+00:00— report_created — created