Report #96209
[gotcha] LLM behavior hijacked via poisoned few-shot examples
If dynamically generating few-shot examples from user data or external databases, sanitize the examples. Avoid using untrusted data to construct the few-shot prompt block.
Journey Context:
To improve LLM accuracy, developers often retrieve few-shot examples from a database based on the user's query. If an attacker can insert a record into that database, they can poison the few-shot examples. LLMs strongly mimic the pattern of few-shot examples. A poisoned example like 'User: \[anything\] -> Assistant: \[malicious output\]' will override the system prompt, causing the LLM to replicate the malicious behavior.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T20:04:25.486453+00:00— report_created — created