A RAG system breaks when it treats the system prompt as the main access control layer. Malicious prompts can still attempt override, and poisoned retrieved content can carry hidden instructions. If retrieval is not permissioned correctly, the model may surface data that should never have been indexed or returned. The failure is a security boundary that exists in policy but not in enforcement.
Why the prompt cannot be the security boundary
A system prompt can influence model behavior, but it is not an enforcement layer. If retrieval can surface sensitive material without access checks, the model may still receive and process it, regardless of how carefully the prompt is worded. The real boundary must sit in retrieval permissions, source filtering, and downstream access control, not in instructions alone.
That distinction matters because a prompt can be overridden, ignored by malicious content, or bypassed by indirect prompt injection inside retrieved documents. In practice, the risk is not just “bad answers”, it is unauthorized disclosure of data that the system was never supposed to expose at all.
For a broader control lens, teams should map this to NIST Cybersecurity Framework 2.0 by treating retrieval authorization as part of protect and govern, not as a prompt-writing exercise.
Where RAG systems fail in practice
RAG breaks in two common ways when the prompt is treated as the main control. First, poisoned or untrusted retrieved content can contain hidden instructions that compete with the system prompt. Second, if the search layer has not been permissioned correctly, the retriever may return documents, chunks, or embeddings tied to data the user should never see.
The second failure is the more serious one from a security standpoint. Once sensitive content is indexed and retrievable without a proper authorization decision, the model becomes a distribution path for exposure. The issue is not whether the model “understands” secrecy, but whether the pipeline prevents the wrong content from entering the context window in the first place.
That is why prompt-injection defenses belong alongside retrieval hardening, as reflected in the threat models discussed in OWASP Agentic AI Top 10 and the AI adversarial techniques catalogued in MITRE ATLAS adversarial AI threat matrix.
What the control model needs instead
RAG should enforce least privilege at the data layer, then carry those decisions through indexing, retrieval, and response generation. That means classifying source material, restricting what gets indexed, applying per-user or per-role retrieval checks, and separating trusted system instructions from untrusted retrieved text. If the retriever cannot prove entitlement, the content should not be surfaced.
Teams also need operational evidence that the control is actually working. The practical test is simple: can you show which identities, roles, or services are allowed to retrieve which corpus segments, and can you demonstrate that denied content never reaches the model context? If not, the system is relying on policy language rather than enforcement.
For implementation guidance on account and access control discipline, CIS Controls v8 is useful for tying retrieval access, logging, and account governance back to concrete safeguards. Where the question is specifically about non-human access paths and secret-bearing automation, OWASP Non-Human Identity Top 10 is the more precise reference.
Risk and Threat Considerations
When retrieval is not permissioned correctly, the model can become a high-speed exfiltration path for sensitive data. The threat is not limited to accidental leakage, because attackers can use prompt injection, poisoned documents, or malformed retrieved content to steer the model toward disclosing or summarising material it should never expose.
Failure mechanism: The system trusts prompt instructions more than retrieval authorization, so untrusted context can override or bypass intended policy while the model still appears to be following governance rules.
Impact: Sensitive documents, credentials, or restricted business data can be indexed, returned, or paraphrased to unauthorized users, creating confidentiality loss and a false sense of control.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Agentic AI Top 10 and OWASP Non-Human Identity Top 10 address the attack and risk surface, while NIST CSF 2.0 and CIS Controls v8 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| NIST CSF 2.0 | PR.AC — Access Control | Retrieval must enforce who can access sensitive corpus content before it enters context. |
| PR.DS — Data Security | Sensitive source data must be protected from unauthorized indexing and disclosure through RAG. | |
| DE.CM — Security Continuous Monitoring | RAG pipelines need monitoring to detect abnormal retrieval and disclosure behavior. | |
| Recommendation — Apply PR.AC controls to gate retrieval by entitlement, not by prompt wording. Protect source data so sensitive content is filtered, classified, and restricted before retrieval. Monitor retrieval activity for unauthorized access patterns and exposure of restricted content. | ||
| OWASP Agentic AI Top 10 | A1 — Prompt Injection | Retrieved content can carry instructions that override or manipulate model behavior. |
| A3 — Data Leakage | RAG can disclose restricted data when retrieval is broader than user entitlement. | |
| Recommendation — Treat retrieved text as untrusted and isolate it from system instructions. Constrain what the model can retrieve so restricted data cannot be exposed. | ||
| OWASP Non-Human Identity Top 10 | NHI-02 — Secrets Exposure | Sensitive corpus data may include credentials or secret material that must not be retrievable. |
| Recommendation — Remove secret-bearing content from retrievable sources and prevent it from entering context. | ||
| CIS Controls v8 | 6 — Access Control Management | RAG access should follow enforced account and entitlement control, not informal policy. |
| 3 — Data Protection | Sensitive documents must be classified and protected before they are indexed or retrieved. | |
| Recommendation — Restrict retrieval access by role and remove broad access to sensitive sources. Classify sensitive content and prevent it from being indexed without protection. | ||
Practitioner Guidance
What to verify: Confirm that retrieval authorization is evaluated before chunks are indexed or returned, not after generation. If a denied user can influence what the model sees, the design is already broken, even if the final answer is filtered.
Decision rule: If the content is sensitive enough that direct retrieval would be unacceptable in a search tool, it is sensitive enough to block from RAG context unless entitlement is explicitly proven. Treat the retriever as a security control, not a convenience layer.
Common mistake: Teams harden the system prompt, then assume prompt injection is the main problem. In reality, the larger control gap is usually unauthorized data access through indexing, embeddings, or broad corpus retrieval.
Practitioner takeaway: The secure design principle is to prevent unauthorized content from reaching context at all, because once the model can see it, the prompt is no longer the boundary.
Related resources from NHI Mgmt Group
- What breaks when organisations rely on obscurity to protect sensitive data?
- What breaks when organisations rely on user judgment alone to protect sensitive data in AI prompts?
- What breaks when organisations rely on access controls alone to protect sensitive patient data in help desk tools?
- What breaks when DLP relies on static signatures for unstructured and context-sensitive data?
Deepen Your Knowledge
Reviewed and updated by the NHIMG editorial team on September 17, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org