Report #52975
[gotcha] Dynamic few-shot examples retrieved from a database acting as an attack surface
Isolate dynamically retrieved few-shot examples from the system prompt using strict structural delimiters, and rigorously sanitize the database of few-shot examples as if it were a system prompt itself.
Journey Context:
To improve accuracy, developers dynamically retrieve past successful queries to use as few-shot examples. An attacker intentionally submits queries that get saved into this few-shot database. When a future user asks a question, the attacker's query is retrieved as a 'few-shot example' and executed by the LLM. Because few-shot examples are highly weighted by LLMs to determine behavior, this is an extremely effective, delayed injection vector that developers completely overlook.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T19:24:46.337948+00:00— report_created — created