An adversary compromises a third-party data provider whose web content is regularly scraped and included in an LLM's retrieval-augmented generation (RAG) corpus. The attacker embeds invisible instructions in several web pages — instructions that, when retrieved and included in the model's context, cause it to exfiltrate user queries to an external URL via markdown image rendering. Which TWO statements BEST characterize this attack and an effective mitigation? (Select TWO)
- A. Using a larger context window would reduce the model's susceptibility to injected instructions by diluting their influence
- B. Sanitizing and escaping retrieved documents before inserting them into the prompt context mitigates the injection vector✓ Correct
- C. This is a training data poisoning attack, because the attacker modified content that will be ingested by the model
- D. Enforcing a strict Content Security Policy (CSP) on the client rendering the markdown is sufficient to fully prevent data exfiltration in this scenario
- E. Disabling the model's internet access entirely is the only viable mitigation for RAG-based injection attacks
- F. This is an indirect prompt injection attack, because the malicious instructions enter the model's context through retrieved external content rather than directly from the user✓ Correct
Explanation
Correct: This is a textbook indirect prompt injection — the attacker does not interact with the model directly; instead, they poison external content that the application retrieves and inserts into the prompt, causing the model to follow attacker-controlled instructions. Sanitizing and escaping retrieved documents (e.g., stripping HTML, removing instruction-like patterns, applying an input filter before context insertion) is the most direct mitigation at the retrieval/ingestion layer. | Calling this training data poisoning is incorrect: the attack occurs at inference time via the RAG pipeline, not during the model's training or fine-tuning phase. Training data poisoning requires the attacker to influence the dataset used to update model weights. | Disabling internet access would eliminate one retrieval source but is not the only viable mitigation and is often impractical; RAG systems can also pull from internal document stores that may be compromised. Sanitization is a more targeted and practical control. | A CSP on the client helps prevent rendered markdown from loading external resources in a browser, which is a valid defense-in-depth layer, but it does not address the injection vector itself — the model may still process and act on the instructions in other ways (e.g., API calls, tool use), making it insufficient as a standalone control. | A larger context window has no security properties; the model does not inherently deprioritize or 'dilute' injected instructions based on context length.