Report #24706
[gotcha] Dynamic few-shot examples overriding system prompt instructions
Ensure few-shot examples are sourced from a trusted, immutable store and explicitly labeled as examples in the prompt hierarchy. Never use user-generated content as few-shot examples without sanitization.
Journey Context:
To improve LLM performance, developers dynamically retrieve few-shot examples from a database. If an attacker can inject a malicious string into that database, the LLM will treat it as a highly weighted example. Because LLMs are heavily biased to follow the pattern of provided examples, a single malicious few-shot example can completely override the system prompt's instructions, acting as a powerful indirect injection vector.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T19:52:39.382279+00:00— report_created — created