Security

AI Agent Security: How Prompt Injection Becomes an Attack Path

OrasecAugust 7, 20263 min read

Written by the OraSec security research team — offensive security engineers and penetration testers.

AI Agent Security: How Prompt Injection Becomes an Attack Path

AI agents can do more than answer questions. They can read files, call APIs, access repositories, use tools, and trigger workflows.

If an attacker influences what an agent reads, the agent may take an unintended action using its own permissions. This is why AI agent security matters.

What Is AI Agent Security?

AI agent security protects AI systems that can access data, use tools, call APIs, and perform actions.

Unlike a chatbot, an AI agent may connect to cloud services, source code, internal APIs, databases, or CI/CD pipelines.

The key question is what the agent can do if it is manipulated.

Also Read: How Prompt Injection Attacks Bypass AI Agent Security

What Is Prompt Injection?

Prompt injection happens when crafted input changes an AI model’s behaviour in an unintended way. OWASP lists Prompt Injection as LLM01:2025.

Direct prompt injection is sent straight to the AI interface.

Indirect prompt injection is hidden inside content that the agent later reads, such as an email, document, website, GitHub issue, API response, or RAG source.

How Prompt Injection Becomes an Attack Path

Prompt injection becomes more dangerous when an agent can access sensitive data, privileged tools, credentials, or external systems.

Attacker-Controlled Content

AI Agent Reads It

Agent Follows an Unintended Instruction

Tool or API Is Triggered

Action Runs With the Agent’s Permissions

The main mistake is treating model output as authorization.

An AI model can suggest an action, but it should not decide whether that action is allowed.

Authorization should be enforced by application logic, IAM controls, or human approval.

Why AI Agents Can Be Riskier Than Chatbots

A chatbot usually returns text. An AI agent can take action.

A manipulated agent may:

  • Call internal APIs
  • Read sensitive files
  • Modify code
  • Trigger workflows
  • Access cloud resources
  • Use service credentials

Helpful for you: Penetration Testing in the Age of Large Language Models

Real-World AI Agent Security Risk

Pillar Security research showed how prompt injection in AI-powered GitHub workflows could create software supply-chain risk.

Researchers found workflow patterns where untrusted repository content could influence Gemini-powered automation with access to tools and credentials. Google later updated the affected components and strengthened tool allowlisting.

This shows why AI workflows that process untrusted content need strict permission and tool controls.

Common AI Agent Security Risks

Excessive Agency

An agent may have more capabilities than its task requires.

Overprivileged Credentials

Long-lived API keys, tokens, and service accounts can increase attack impact.

Unsafe Tool Access

Agents that execute commands, modify files, or call sensitive APIs need strict controls.

Weak Trust Boundaries

Low-trust agents should not automatically trigger privileged workflows.

Sensitive Data Exposure

Agents that read confidential information and communicate externally may create a data-leak path.

How to Secure AI Agents

Use Least Privilege

Give each agent only the permissions required for its task.

Treat External Content as Untrusted

Assume emails, websites, documents, repositories, API responses, and RAG content may contain malicious instructions.

Enforce Authorization Outside the Model

Use application logic, IAM controls, approval workflows, or human verification for sensitive actions.

Restrict Tool Access

Allow only approved tools. High-risk actions should require stronger controls.

Sandbox Code Execution

Run code in isolated environments that cannot freely access production systems or secrets.

Use Short-Lived Credentials

Limit the scope and lifetime of tokens, API keys, and service accounts.

Monitor and Test

Log tool calls, API requests, file access, and workflow triggers. Test direct and indirect prompt injection before production.

OWASP also recommends regular penetration testing of trust boundaries and access controls around LLM applications.

What Should AI Agent Security Testing Cover?

A complete AI security assessment should test:

  • Direct and indirect prompt injection
  • Excessive agency and tool abuse
  • API security and authorization
  • Agent-to-agent trust
  • Sensitive data and credential exposure
  • RAG security
  • Unsafe output handling
  • Code execution
  • CI/CD and cloud integrations

How Orasec Can Help

Orasec’s AI and LLM security testing covers prompt injection, tool abuse, RAG security, API authorization, sensitive data exposure, unsafe output handling, and AI infrastructure risks.

Our testers verify whether attacker-controlled input can reach sensitive systems or trigger unauthorized actions.

Conclusion

AI agent security is not only about blocking malicious prompts. The bigger goal is controlling what happens if a model is manipulated.

Least privilege, strong authorization, restricted tools, isolated execution, limited credentials, monitoring, and regular testing reduce the blast radius.

The key principle is simple:

The security boundary should exist around the AI agent, not inside its prompt.

FAQs

What is AI agent security?

It protects AI systems that access data, use tools, call APIs, or perform actions from manipulation.

What is prompt injection?

It uses crafted input to change an AI model’s intended behaviour.

What is indirect prompt injection?

It happens when malicious instructions are hidden inside content an AI system later processes.

Why are AI agents riskier than chatbots?

They can perform real actions, including calling APIs, accessing files, using credentials, and triggering workflows.

How can organizations secure AI agents?

Use least privilege, strong authorization, restricted tools, sandboxing, monitoring, short-lived credentials, and regular security testing.

Explore related services

Need hands-on help? Our security testing services put this research into practice.

bgp-hijack-virtualizor-update

BGP Hijack Delivered a Backdoored Virtualizor Update

The update came from the right domain over valid TLS. The route to the vendor had been stolen, so the traffic reached an attacker-controlled server instead. What Happened? Between 28 and 30 August 2026, attackers announced a BGP route they had no authority over, pulling Softaculous update traffic to a server they controlled. Any Virtualizor installation that checked for updates during one of the diverted routing intervals could have received the backdoored package. AlbaHost, a hosting provid

·4 min read
jfrog-artifactory-vulnerability

JFrog Artifactory Vulnerability: Exploited in Three Days

JFrog released patches on 28 August 2026. By 1 September, watchTowr was publicly reporting active exploitation — roughly three and a half days after disclosure. What Is the Vulnerability? CVE-2026-82329 is an authentication bypass in JFrog Artifactory, rated CVSS 9.8. In default configurations, an unauthenticated attacker with network access can obtain administrative privileges, with no user interaction required. Self-hosted deployments require customer action. JFrog says affected cloud envi

·3 min read
dll-sideloading-signed-software

DLL Sideloading: How ValleyRAT Hides Behind Signed Software

The malicious code was not signed. The program that loaded it was. What Is DLL Sideloading? When an application loads a DLL by name rather than a fully qualified path, Windows searches a defined set of locations. If an attacker can place a malicious DLL in a directory searched before the legitimate copy, the application may load it. Microsoft documents this as DLL preloading/binary planting behavior. (Microsoft Learn) The signed executable runs. The signature checks out. The malicious DLL ex

·3 min read