Report #27299
[gotcha] Few-shot example poisoning via user-generated content
Validate and sanitize any dynamically retrieved few-shot examples. Avoid using user-generated content as few-shot examples without strict filtering and isolation from the system prompt.
Journey Context:
Developers often use dynamic few-shot prompting, retrieving examples from a database based on user input. If the database contains user-generated content, an attacker can submit a malicious 'example' \(e.g., a bad question and a malicious answer\). When this example is retrieved and injected into another user's prompt, it teaches the LLM to behave maliciously.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T00:13:07.853746+00:00— report_created — created