AI Agent Security Lab: Testing Prompt Injection Through Tool Abuse

A controlled lab methodology for testing indirect prompt injection, tool authorisation, excessive agency and identity boundaries in AI agents.

AI application security is increasingly about the system around the model. OWASP’s current GenAI guidance includes prompt injection and excessive agency among the risks teams should consider when designing and testing AI applications. OWASP GenAI Security Project.

Diagram of AI agent lab architecture from untrusted input through agent and tool gateway to side effects with a control plane
Lab layout: keep untrusted content separate from privileged tools via a policy-bound gateway.
Diagram of four prompt-injection paths converging on a sensitive tool call
Direct, indirect, web and tool-result paths can all converge on a sensitive action.
Lab objectiveDemonstrate whether untrusted content can influence an agent into taking an action that exceeds the authority of the requesting user. Keep the lab isolated and use synthetic data and harmless tools.

1. Build the lab architecture

Use a deliberately constrained agent with a small tool set: for example, a read-only search tool, a synthetic ticket lookup tool and a mock notification tool. Give each tool a distinct permission boundary so the impact of an authorisation failure is measurable.

User → Agent → Policy → Tool → Synthetic data
             ↘ Identity / scope

2. Test direct and indirect prompt injection

Direct injection comes from the user message. Indirect injection comes from content the agent retrieves: a web page, document, email, ticket or database record. The key test is whether the agent treats retrieved content as data or as trusted instructions.

Agent lab stagesPOCFORGE / INTERACTIVE

Keyboard: ← → · Respects reduced-motion (no autoplay).

Injection lab

A secure agent should keep untrusted content separate from control instructions and enforce policy before every sensitive tool call.

3. Treat tools as security-sensitive APIs

For every tool, document inputs, outputs, required identity, allowed actions and downstream effects. A tool that only retrieves a public article has a very different risk profile from one that changes a customer record, sends an email or accesses a cloud resource.

Tool Risk Control
Search Indirect instruction influence Content isolation
CRM lookup Data exposure User-scoped authorisation
Ticket update Integrity impact Explicit policy + approval
Notification External side effect Allowlist + confirmation

4. Test identity confusion

One of the most important questions is whose authority the agent is using. Test whether a user with limited access can cause an agent operating under a broader service identity to retrieve or modify data outside that user’s scope.

5. Measure blast radius

For each successful path, record the minimum privileges required, accessible data classes, available tools and external side effects. Do not optimise the demonstration for maximum damage; optimise it for clear proof of the violated boundary.

6. Design safer agents

  1. Apply least privilege to tools and identities.
  2. Keep untrusted retrieved content separate from control instructions.
  3. Enforce authorisation outside the model.
  4. Require confirmation for high-impact actions.
  5. Log tool calls, identity and policy decisions.
  6. Constrain output before passing it into downstream systems.
  7. Continuously test indirect injection paths.

Reference framework

OWASP’s GenAI Security Project provides a current risk taxonomy for LLM and generative-AI applications, while application-specific testing should extend that model into the agent’s tools, identities, data and business workflows.

Related research: When AI agents become the attack surface · Agentic cloud destruction via service principals.

Frequently asked questions

What is an AI agent security lab?

A controlled environment where you test prompt injection, tool authorisation and identity boundaries without exposing production systems. The goal is evidence of how an agent can be steered into unintended actions.

How does tool abuse differ from classic prompt injection?

Prompt injection steers model text. Tool abuse is when that steered behaviour reaches an API, browser, shell or other privileged capability the agent is allowed to call.

Do you need production data to test agents?

Usually no. Use staged tools, synthetic documents and least-privilege credentials that mirror production authority without real customer data.

What should a report emphasise?

The failed trust boundary (who can invoke which tool on whose data), reproduction steps and a remediation path that constrains agency—not only a blocked prompt string.