Indirect Prompt Injection via External Content
Indirect prompt injection embeds malicious instructions in content the AI agent retrieves from external sources. The instructions travel through a trusted retrieval channel rather than arriving directly from the user, bypassing input validation that only checks user-supplied content. A web page the agent browses, a document uploaded to the knowledge base, an email the agent reads, a search result it processes — any external content that gets injected into the model's context is a potential attack vector.
Inject via Web Pages the Agent Browses
Host a page containing embedded prompt injection payloads. The payloads can be hidden in HTML comments, white-on-white text, or metadata that the agent processes but a human reader would not notice:
Inject via Search Results
If the agent performs web searches, plant content at a URL that ranks for the search terms the agent is likely to query. When the agent retrieves your page as a search result, the injected instructions execute:
Inject via Uploaded Documents
Embed injection payloads in documents uploaded to the RAG knowledge base. The payload gets chunked, embedded, and retrieved when semantically relevant queries are made:
After uploading, trigger retrieval of the malicious document by querying on its topic:
Inject via Email Content
When the agent has access to an email tool, craft an email containing injection payloads and send it to an address the agent monitors. When the agent reads the email as part of normal operation, the payload executes:
If the agent confirms it can read emails, send an email to the monitored address with the injection payload in the body or subject line. The payload executes in the agent context when it processes the inbox — with the full tool permissions of the agent rather than the permissions of the email sender.
References
-
OWASP Top 10 for LLM Applicationsowasp.org/www-project-top-10-for-large-language-model-applications (opens in new tab)
LLM01: Prompt Injection covering indirect injection via external content
-
Not what you signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injectionarxiv.org/abs/2302.12173 (opens in new tab)
Original indirect prompt injection research paper with attack taxonomy
Was this helpful?
Your feedback helps improve this page.