Report #79568
[gotcha] Dynamic few-shot examples retrieved from user-generated databases act as persistent prompt injections
Curate few-shot examples statically or from highly trusted sources. Never dynamically pull few-shot examples from a database populated by untrusted users.
Journey Context:
To improve formatting, developers dynamically retrieve 'successful' past interactions from a vector database to use as few-shot examples. An attacker submits a query formatted as a perfect few-shot example but includes a malicious payload in the assistant turn. When a new user asks a similar question, the RAG system retrieves the attacker's interaction and injects it into the system prompt as a few-shot example, hijacking all subsequent similar queries.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T16:09:30.284746+00:00— report_created — created