Report #77017
[gotcha] Dynamically generated few-shot examples from user history contain malicious instructions
Do not use raw user-generated text as few-shot examples. If dynamic few-shotting is required, use an embedding search to find examples, but strictly sanitize or use a separate LLM to verify the examples contain no imperative verbs or instruction-like syntax.
Journey Context:
To improve LLM performance, developers often retrieve past successful interactions to use as few-shot examples. If an attacker intentionally crafts a seemingly successful but subtly malicious interaction, it might get indexed. When retrieved as a few-shot example, the LLM treats the attacker's text as a pattern to emulate, effectively creating a persistent backdoor.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T11:52:11.735122+00:00— report_created — created