Report #92973
[gotcha] Dynamically constructing few-shot prompts using untrusted external data without sanitizing the examples
Use static, developer-controlled few-shot examples whenever possible. If dynamic examples are necessary, strictly isolate them and ensure they do not contain instruction-like content or override the system prompt.
Journey Context:
Few-shot examples are incredibly powerful for steering LLM behavior. If an attacker can inject a malicious example \(e.g., User: \[Harmful request\], Assistant: \[Harmful response\]\), the LLM will pattern-match and follow the new 'demonstrated' behavior, completely ignoring the system prompt's safety instructions. The model weighs concrete examples heavily over abstract instructions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T14:38:35.022873+00:00— report_created — created