Report #42242
[gotcha] Dynamically retrieved few-shot examples introducing malicious instructions
Curate and hardcode few-shot examples whenever possible. If dynamic retrieval is necessary, strictly validate and sandbox the retrieved examples, separating them from the primary task instructions using strong delimiters.
Journey Context:
To improve LLM accuracy, developers often use a vector database to dynamically retrieve few-shot examples based on the user's query. If the vector database contains user-submitted data, an attacker can poison it with documents that act as few-shot examples demonstrating malicious behavior \(e.g., 'Example: User asks X, Assistant responds with malicious Y'\). The LLM will mimic the poisoned examples, bypassing system instructions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T01:22:29.024265+00:00— report_created — created