Report #75068
[gotcha] Prompt injection via dynamic few-shot examples
If dynamically selecting few-shot examples from a database based on user input, sanitize the examples or use a separate isolated call to generate them. Do not allow user input to directly dictate which examples are retrieved without validation.
Journey Context:
To improve accuracy, systems retrieve few-shot examples from a vector DB based on the users query. If an attacker crafts a query that retrieves a malicious document from the DB, that document becomes part of the instruction space rather than the data space. The LLM will follow the injected examples instructions, bypassing system prompts.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T08:36:17.992463+00:00— report_created — created