Attack scenario · AI security

Indirect prompt injection through retrieved documents

What is indirect prompt injection and how does it reach a RAG assistant? An attacker plants instructions inside a document that a retrieval-augmented assistant later reads, causing it to mislead users or leak data.

Fictional, educational scenarioData exposureUnauthorized actionsLast updated · ATT&CK v20.1

Attack path · 4 stages

  1. 1

    Plant instructions in content

    T1698AML.T0070

  2. 2

    Assistant retrieves the poisoned content

    T1698AML.T0051.001

  3. 3

    Model follows injected instructions

    T1698AML.T0051.001

  4. 4

    Data leaves through rendering

    T1700AML.T0077

For leadership

Executive summary

AI assistants that answer questions from company documents treat whatever they retrieve as context. If an outsider can get text into those documents — a support ticket, a shared file, a web page — they can embed instructions the assistant may follow: hiding information, giving false answers, or inserting links that leak data. There is currently no complete technical fix for this class of attack, so the safeguards are architectural: limit who can add content to knowledge sources, limit what the assistant can do after reading untrusted content, and make sure it can never access more than the person asking is allowed to see.

For engineers

Technical summary

Content ingested into a vector index (for example from an S3 bucket fed by a ticketing integration) contains adversarial instructions. When retrieved, the model may follow them (ATLAS AML.T0051.001; ATT&CK T1698). Output rendering of attacker-chosen URLs (for example markdown images) can exfiltrate conversation data.

Environment and assumptions

Fictional company: an internal support assistant built on Amazon Bedrock answers questions using a knowledge base synced from an S3 bucket. A ticketing integration writes customer-submitted ticket text into that bucket. The chat UI renders markdown, including images.

  • An external party can submit text that is ingested into the knowledge base.
  • The assistant has no tools beyond retrieval in this scenario.
  • Fictional and simplified for education; no specific product vulnerability is implied.

Interactive

Attack sequence

Select a stage, or use the arrow keys, to see preconditions, evidence and controls.

Stage 1

Plant instructions in content

The attacker submits a support ticket containing hidden instructions (for example white text or an HTML comment) addressed to "the assistant".

Preconditions
  • External content flows into the knowledge source without review
Required access
  • Ability to submit a ticket.
Potential evidence
  • Ticket content; S3 object writes by the integration
Defensive controls
  • Separate untrusted sources into their own index
  • Content sanitization on ingestion
Text version of the attack sequence
  1. Plant instructions in content (T1698; AML.T0070). The attacker submits a support ticket containing hidden instructions (for example white text or an HTML comment) addressed to "the assistant". Preconditions: External content flows into the knowledge source without review. Evidence: Ticket content; S3 object writes by the integration. Controls: Separate untrusted sources into their own index; Content sanitization on ingestion.
  2. Assistant retrieves the poisoned content (T1698; AML.T0051.001). An employee asks a related question; the poisoned chunk is retrieved and placed in the model’s context. Preconditions: Semantic similarity to employee questions. Evidence: Retrieval logs showing source documents per answer. Controls: Provenance labels on retrieved chunks; Treat retrieved text as data, not instructions.
  3. Model follows injected instructions (T1698; AML.T0051.001). The model produces a misleading answer or includes a markdown image whose URL encodes parts of the conversation. Preconditions: Model complies with the injected instruction. Evidence: Model invocation logs (prompt and response). Controls: Guardrails as defense in depth; Output filtering of URLs / images.
  4. Data leaves through rendering (T1700; AML.T0077). The user’s browser fetches the attacker’s image URL, sending encoded data to the attacker. Preconditions: Client renders external images from model output. Evidence: Proxy logs for requests to unknown domains from the chat UI. Controls: Disable external image rendering; allow-list link domains.

Technique mapping

MITRE ATT&CK and ATLAS techniques referenced in this scenario
IDTechniqueTactics (official)Stages
T1698Indirect Prompt InjectionExecution1, 2, 3
T1700AI-Enabled ExfiltrationExfiltration4
AML.T0070RAG Poisoning (MITRE ATLAS)ATLAS: 1 tactic1
AML.T0051.001LLM Prompt Injection: Indirect (MITRE ATLAS)ATLAS: 1 tactic2, 3
AML.T0077LLM Response Rendering (MITRE ATLAS)ATLAS: 1 tactic4

Technique names and tactic assignments come from the imported MITRE data. Mapping a stage to a technique is Securitain’s analysis.

Why the attack can succeed

  • Models cannot reliably distinguish instructions from data in their context.
  • Untrusted external content was mixed with trusted internal knowledge.
  • The client rendered attacker-controlled URLs automatically.

What prevents or limits the attack

What may detect the attack

Detection signals and telemetry sources
SignalTelemetry sourceNotes
Retrieved chunks containing instruction-like patterns aimed at the assistantIngestion-time scanning; retrieval logs—
Responses containing URLs to unapproved domainsModel invocation logs / output filters—

Telemetry only helps if it is enabled before the incident and someone acts on it. Listing a signal here does not mean it is collected or monitored in your environment.

What Securitain may assess

  • Securitain can assess todayPublic and cross-account exposure checks on S3, KMS, SQS, SNS and Secrets Manager resource policies. Learn more
  • Outside Securitain’s current scopeSecuritain does not perform prompt-injection testing, agent execution tracing or AI-specific scanning. It can review the AWS IAM permissions an agent’s role holds, which bounds what a manipulated agent could do.

For leadership

Executive implications

integrity
Employees may act on incorrect answers.
confidentiality
Conversation content can be leaked to an external party.
operations
Trust in internal AI tools may be undermined.

No financial loss estimates are given; impact depends on the data, contracts and regulation involved.

Next steps

  1. Map every source feeding each knowledge base and who can write to it.
  2. Separate externally sourced content.
  3. Disable automatic rendering of external images in AI chat interfaces.

References

MITRE ATT&CK® and ATT&CK® are registered trademarks of The MITRE Corporation. ATT&CK data © 2026 The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation (ATT&CK v20.1). MITRE ATLAS™ data (v2026.10) © MITRE, used under the Apache License 2.0. Securitain is not affiliated with or endorsed by MITRE. Explanations, scenarios and control mappings on this page are Securitain’s own analysis. Sources and licensing

Stay in the loop

Cloud security insights, early access & compliance updates

Weekly InsightsEarly AccessExpert Content
No spam, everUnsubscribe anytimeWeekly updates
Chat with Securitain