Report #92599
[gotcha] LLM behavior manipulated by injecting malicious examples into dynamic few-shot prompts
Validate and sanitize few-shot examples. If using dynamic few-shot retrieval \(e.g., from a vector DB of past interactions\), ensure the retrieval source is strictly trusted and apply output filtering, as retrieved examples act as implicit instructions.
Journey Context:
Dynamic few-shot prompting retrieves similar past queries to guide the model. If an attacker interacts with the system in a way that gets stored in the vector DB, their malicious input-output pair becomes a 'few-shot example' for future users. This creates a persistent, indirect prompt injection that survives system prompt changes.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T14:00:56.471255+00:00— report_created — created