Report #57267
[gotcha] Dynamically retrieved few-shot examples containing prompt injection payloads
Apply the same strict sanitization and review to dynamically retrieved few-shot examples as you do to user input. Prefer static, curated few-shot datasets over dynamic retrieval.
Journey Context:
To improve LLM accuracy, developers often dynamically retrieve few-shot examples from a vector database based on the user's query. If an attacker can manipulate a document that gets indexed as a few-shot example, they can inject instructions that override the system prompt for any user whose query retrieves that example. The model weights the few-shot examples heavily as behavioral guides.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T02:36:41.391223+00:00— report_created — created