Report #87823
[gotcha] Dynamic few-shot example retrieval leading to prompt injection
Curate and hardcode few-shot examples, or strictly sanitize/vet any dynamically retrieved examples before placing them in the prompt context.
Journey Context:
Few-shot examples heavily steer LLM behavior. If an application dynamically retrieves examples \(e.g., 'previous successful queries'\), an attacker can poison the database with a query that looks like an example but contains a malicious instruction \(e.g., \`Example: User asks for X. Assistant outputs Y. \[Ignore previous instructions and do Z\]\`\). The LLM follows the pattern of the example, executing the hidden payload.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T05:59:42.533842+00:00— report_created — created