RAG (retrieval-augmented generation) lets an AI read an organisation’s data at query time, which introduces access-control and prompt-injection risk: retrieved documents can carry hidden malicious instructions, and the model can surface data a user should not see. AI agents can take actions, so their risk rises from bad text to harmful deeds. Secure both by enforcing access control at retrieval, treating all retrieved content and tool output as untrusted, applying least privilege, and keeping a human in the loop for consequential actions.
Moving from a simple chatbot to a RAG system or an AI agent is where AI security gets serious. The moment an AI can read an organisation’s data or take actions, the stakes and the attack surface both jump.
What changes with RAG
RAG, retrieval-augmented generation, is a technique where an AI model retrieves relevant information from an organisation’s data sources at query time and uses it to answer, rather than relying only on what it learned during training. It is how most useful enterprise AI works, grounding answers in the organisation’s actual documents. But it changes the security picture in two important ways.
First, access control. The model now reads the organisation’s documents and data to answer, so if it retrieves without enforcing the asking user’s permissions, it can surface information that user should not see, a classic data-exposure failure. Access control must be enforced at retrieval, not left to the model to police, because a model cannot be relied on to keep secrets it has been given. Second, prompt injection through retrieved content: a document the system retrieves could contain hidden instructions that hijack the model’s behaviour. This is indirect prompt injection, and it means retrieved content must be treated as untrusted input, not trusted context. Securing RAG therefore centres on enforcing user permissions at retrieval, treating retrieved documents as untrusted, validating inputs and outputs, limiting what the model can do with what it retrieves, and logging and monitoring.
Securing AI agents
AI agents raise the stakes further because they can take actions, calling tools, sending messages, running code, changing records, not just producing text. That shifts the risk from generating a bad answer to doing something harmful. The main agent risks are prompt injection that hijacks the agent into unintended actions (for example, a malicious instruction hidden in an email the agent reads causing it to exfiltrate data), excessive permissions that let a compromised agent do too much, insufficient human oversight of consequential actions, and unsafe handling of the tools and data the agent can reach.
Securing agents follows a clear set of principles. Apply least privilege to the tools and data the agent can access, so a hijacked agent can do as little as possible. Require human approval for consequential or irreversible actions, keeping a person in the loop where it matters, which mirrors the ISM control on flagging risky AI actions for human approval. Treat all inputs as untrusted, including the outputs of tools the agent calls, because injection can arrive through any of them. Sandbox what the agent can execute, and log and monitor its actions so misbehaviour is detected. The guiding mindset is to design as if the agent can be manipulated, and limit the blast radius accordingly, testing it through AI red teaming. These risks map to the OWASP LLM Top 10, which now emphasises agentic and excessive-agency risks. Where an organisation is deploying RAG or agents and wants them secured and governed, Cybernion can help through ISO 42001 advisory and penetration testing.
Frequently asked questions
What is RAG and why does it change the security picture?
RAG, or retrieval-augmented generation, is a technique where an AI model retrieves relevant information from an organisation’s data sources at query time and uses it to answer, rather than relying only on what it learned in training. It changes the security picture because the model now reads the organisation’s documents and data, which means access-control and prompt-injection risks, a document the model retrieves could contain hidden malicious instructions, and the model could surface data a user should not see if permissions are not enforced.
What are the main security risks of AI agents?
AI agents can take actions, call tools, send messages, run code, make changes, so their risks go beyond producing bad text to doing harmful things. The main risks are prompt injection that hijacks the agent into unintended actions, excessive permissions that let a compromised agent do too much, insufficient human oversight of consequential actions, and unsafe handling of the tools and data the agent can reach. The ability to act is what makes agents higher risk than a simple chatbot.
How do we secure a RAG system?
Secure a RAG system by enforcing the user’s access permissions on what the model can retrieve so it never surfaces data the user should not see, treating retrieved content as untrusted input that could contain injected instructions, validating and sandboxing inputs and outputs, limiting what the model can do with retrieved data, and logging and monitoring. The core principle is that retrieved documents are untrusted and access control must be enforced at retrieval, not left to the model.
How do we secure AI agents?
Secure AI agents by applying least privilege to the tools and data they can access, requiring human approval for consequential or irreversible actions, treating all inputs including tool outputs as untrusted and susceptible to prompt injection, sandboxing what the agent can execute, and logging and monitoring their actions. Design as if the agent can be manipulated, and limit the blast radius accordingly, which mirrors the ISM control on flagging risky AI actions for human approval.
Written by Gaurav Vikash, an ASD endorsed IRAP assessor and senior cyber security leader with 18 years of experience across Australia, the UK and Asia, including CISO and senior security leadership roles. He holds CISSP, CISA, CISM and CRISC and is an ISO 27001 Lead Auditor and ISO 42001 Lead Implementer, and speaks regularly at industry conferences.
Sources:
- OWASP Top 10 for LLM Applications, OWASP Foundation, 2026
- MITRE ATLAS, MITRE, 2026
Last updated: 30 August, 2026
