OXYNE PLATFORMAgentic Security
Back to Blog
Blog

AI Agent Penetration Testing: A Complete Methodology

A practical AI agent penetration-testing methodology covering scope, threat modeling, prompt injection, RAG, memory, tools, identity, evidence and retesting.

AI agent penetration testing evaluates whether an adversary can make a deployed agent cross a meaningful boundary. It goes beyond asking a model unsafe questions. The target includes the application, API, prompts, retrieval, memory, tools, MCP servers, identities, approvals and downstream systems that create real impact.

A useful assessment is authorized, safe, evidence-driven and reproducible. It separates model statements from executed effects and turns confirmed failures into regression tests.

Define scope and authorization

List exact URLs, APIs, voice or messaging interfaces, users, tenants, models, tools, servers and environments. Define test windows, rate limits, prohibited actions, data handling and escalation contacts.

Specify whether source review, cloud configuration, training security or social engineering are included. Behavioral black-box testing does not automatically cover them.

Use written authorization and safe accounts. Establish stop conditions for data exposure, unexpected production effect or system instability.

Classify consequences

Inventory what the agent can read and cause. Classify public information, private data, external communication, record updates, financial actions, permission changes and code execution.

Testing depth should follow consequence. A public FAQ needs different controls from an operations agent with production credentials.

Define unacceptable outcomes before testing. This gives judges and analysts objective success criteria.

Build the threat model

Map entry points, trust boundaries, data flows, identities, tools, memory and downstream services. Include indirect input from documents, email, websites, code and tool results.

Identify high-value assets and plausible attackers. Consider authenticated users, malicious tenants, compromised content sources and third-party servers.

The AI agent threat-modeling guide provides a structured workshop method.

Establish safe evidence

Create synthetic tenants, users, documents and canaries. Use mock tools for payments, deletion, messaging and infrastructure actions. Ensure markers cannot be mistaken for real data.

Enable transcript, tool, policy and downstream logging. Synchronize time and correlate events with a run ID. Redact real secrets.

Decide what proves success: canary returned, forbidden tool attempted, mock transaction accepted or data received at a controlled destination.

Test application and API boundaries

Assess authentication, session handling, object authorization, injection, output handling, rate limits and business logic. Agentic interfaces do not replace ordinary web and API testing.

Try alternate users, tenants, object IDs and roles. Test direct backend calls when authorized. Confirm whether the application trusts model-generated identity or target parameters.

Look for discrepancies between chat refusal and backend behavior.

Test prompt and model behavior

Use direct jailbreaks, instruction hierarchy conflicts, encoding, multilingual variants, context flooding and multi-turn escalation. Measure policy consistency and recovery.

Avoid treating every unsafe phrase as a vulnerability. Tie findings to defined policy and system impact. Preserve exact conversation and configuration.

Test variations after success to determine whether the failure is robust or incidental.

Test indirect prompt injection

Place controlled instructions in RAG documents, webpages, emails, tickets, code and tool responses. Ask the agent to process them through ordinary workflows.

Observe whether untrusted content changes tool selection, arguments, disclosure or memory. Trace provenance through the complete path.

Use the indirect prompt-injection guide for detailed payload design.

Test RAG and data boundaries

Attempt cross-tenant retrieval, source disclosure, unauthorized metadata, aggregation and poisoned-document influence. Use distinct canaries.

Verify authorization before retrieval, not merely output filtering. Test caches and provider context for leakage.

Assess whether retrieved content can direct tools or persistent memory.

Test memory and session isolation

Attempt cross-user, cross-session and cross-tenant recall. Plant synthetic persistent instructions and observe later runs. Test role change, logout and deletion.

Inspect summaries and embeddings, not only visible chat history. Determine whether the user can review and delete memory.

Record whether contamination persists after remediation.

Test tools and MCP

Enumerate visible and hidden tools. Manipulate arguments, destinations, paths, amounts and object IDs. Test direct calls, schema edge cases and composed sequences.

Assess tool descriptions and results for poisoning. Validate MCP identity, token audience, server policy and downstream authorization.

The MCP security testing guide provides protocol-specific objectives.

Test identity and privilege

Preserve workload and initiating user identity. Substitute roles, tenants, resources and token audiences. Continue after revocation. Attempt delegation to more privileged agents.

Test approval replay, parameter changes and direct bypass. Verify denial at the system of record.

Follow the privilege-escalation guide for authority transitions.

Run adaptive multi-turn attacks

Use observed responses to select the next step rather than sending only independent payloads. Bound maximum turns, tools and time. Stop before destructive effects.

Attackers may build trust, establish false authority, perform a harmless lookup and then redirect the result. Evaluate the sequence as a whole.

Preserve every branch and analyst decision for reproducibility.

Validate findings

Separate attempted, likely and confirmed outcomes. Confirm high-impact issues with tool and downstream evidence. Have a reviewer inspect ambiguous runs.

Do not infer that because the model said “transfer complete,” a transaction occurred. Conversely, a refusal after a tool returned sensitive data may still be a confirmed issue.

State root-cause hypotheses carefully and distinguish replayed chains from inferred relationships.

Report for remediation

Include scope, expected boundary, attack narrative, transcript, tool evidence, validation status, impact, remediation and retest. Map to relevant risk frameworks without calling the mapping an audit.

Prioritize by consequence and exploitability, not dramatic language. Identify the layer that must change: retrieval authorization, tool schema, identity, approval or prompt.

Provide a safe regression case for engineering.

Retest and continuous validation

Replay the original finding after remediation and test nearby variants. Confirm the fix at the enforcement layer. Track changes to models, prompts, data, memory, tools and identities.

Run compact baseline tests during releases and deeper campaigns before high-impact launches or authority expansion.

Do not let a report become stale while the system evolves.

Methodology checklist

  1. Obtain written authorization and exact scope.
  2. Classify assets, authority and consequence.
  3. Threat model the complete implementation.
  4. Create synthetic data, users and mock effects.
  5. Enable transcript, tool, policy and downstream evidence.
  6. Test application, API, prompt, RAG and memory.
  7. Test tools, MCP, identity, approval and egress.
  8. Run bounded adaptive multi-turn attacks.
  9. Validate effects independently of model claims.
  10. Report root cause, limitation and remediation.
  11. Retest fixes and adjacent variants.
  12. Convert confirmed failures into regression cases.

Frequently asked questions

Is AI agent penetration testing the same as LLM red teaming?

It includes model behavior but also tests the deployed application's data, tools, identity and downstream effects. Scope should be stated precisely.

Can production agents be tested safely?

Yes, with authorization, bounded scenarios, synthetic data, mock or reversible tools, rate limits, stop conditions and monitoring. Begin in staging where possible.

What evidence should a finding include?

The relevant transcript, identity, tool arguments, policy decision, downstream result and retest—clearly separating observed fact from inference.

How often should testing occur?

Baseline tests should follow meaningful changes. Deeper campaigns should precede high-impact launches and recur according to authority and risk.

The strongest AI agent pentest shows a reproducible boundary failure and gives engineering a reliable way to prove the fix. Explore Oxyne AI Red Teaming or book a demonstration.

Phase 1: establish rules of engagement

Record systems, tenants, identities, tools, environments, hours, contacts and prohibited effects. Define whether testing may touch production and which mock destinations replace real email, payment, infrastructure or deletion actions.

Agree on evidence handling, data retention and emergency stop procedures. List third parties whose services could receive traffic. A signed scope does not justify testing assets outside the customer's authority.

Define severity around business consequence. A system-prompt excerpt, another tenant's record and a completed privileged action need different treatment. Decide when testers must stop and notify the owner immediately.

Phase 2: map the complete implementation

Inventory application endpoints, APIs, models, prompts, RAG sources, memory, tools, MCP servers, identities, approvals and downstream systems. Capture version and owner for each component.

Trace normal workflows before attacking them. Identify where user intent becomes structured arguments, where authorization occurs and how the system confirms effect. Document fallback and retry paths.

Build an attack-surface graph rather than testing the chat box alone. The most important path may begin in a document or email and end in an administrative API several steps later.

Phase 3: create threat-led hypotheses

Turn the architecture into testable statements: an external document may influence a payment tool; a support user may retrieve another tenant's tickets; a child agent may inherit production authority; a cancelled run may leave queued work active.

Prioritize hypotheses using reachability and consequence, not novelty. Cover prompt injection, data exposure, identity, authorization, excessive agency, memory, supply chain and control-plane abuse.

For each hypothesis, define expected secure behavior and required evidence. This prevents exploratory testing from becoming an unstructured collection of clever prompts.

Phase 4: execute progressively

Begin with passive observation and low-impact probes. Escalate from model influence to data access, tool attempt and simulated consequence only when scope allows. Reuse synthetic canaries so disclosure is unambiguous.

Combine single-turn payloads with adaptive conversations. Test indirect content in RAG, files, websites, email, tool results and memory. Vary identity, tenant, role and session state.

Exercise retries, concurrency, cancellation and partial failure. Agent vulnerabilities often appear in state transitions rather than the happy path.

Phase 5: validate findings independently

Reproduce the behavior with a clean session and controlled configuration. Separate model output from actual system effect. Inspect structured tool traces, authorization logs and downstream state.

Use judge models as assistants, not sole arbiters. Provide explicit criteria and send ambiguous or high-severity results to qualified human review. Record unsuccessful reproduction honestly.

Rule out test harness artifacts, stale state and expected access. A dramatic transcript is not a vulnerability when the initiating principal was authorized to perform the action.

Phase 6: report complete attack paths

Describe preconditions, initiating content, model-visible context, identity, tool calls, control decisions and verified outcome. Include timestamps and component versions. Redact sensitive data without removing the proof.

Explain the root boundary failure rather than prescribing only a keyword block. Recommend fixes at authorization, permission, provenance, validation or approval layers.

Provide an executive impact narrative and an engineering reproduction. Both should use calibrated language: attempted, accepted and completed are not interchangeable.

Phase 7: retest and preserve regressions

Replay the original exploit and meaningful variants after remediation. Confirm that legitimate workflows still work. Test adjacent endpoints and identities to detect a narrow patch.

Convert confirmed findings into automated or repeatable regression scenarios. Trigger them when prompts, models, connectors, tools, identities or policies change.

Close a finding only with evidence tied to the same success criteria used initially. A configuration screenshot or developer assertion is not a substitute for behavioral retesting.

Assess the assessment itself

Track coverage by layer, identity, tenant and consequential action. Record hypotheses not tested and why. Do not use payload count as a proxy for depth.

Review whether the harness preserved context, captured asynchronous effects and respected rate limits. Validate that mock tools accurately represented production authorization.

A mature program combines recurring baseline tests with deeper human-led campaigns. Neither one-time pentesting nor continuous scanning alone covers a changing agentic system.

Choose retest triggers

Retest when models, system prompts, retrieval sources, embedding logic, memory, tools, identities, approval workflows or provider versions change. Business-process changes can matter as much as code.

Maintain a lightweight baseline for every release and reserve deeper campaigns for high-risk launches and architectural changes. Use previous findings to guide coverage without limiting testing to known issues.

Report the exact tested configuration and unresolved limitations. A pentest is evidence about a defined system at a point in time, not a permanent certification of an evolving agent.

Final quality review

Before delivery, confirm that every finding maps to an in-scope asset, reproducible request and observable outcome. Remove duplicates and separate root causes from symptoms. Calibrate severity to realistic preconditions and business impact.

Have another reviewer challenge high-severity conclusions and evidence. Verify redaction, timestamps, model and component versions, and ensure reports do not contain reusable credentials or customer data.

Close with a coverage statement listing identities, tenants, tools, modalities and scenarios tested or excluded. That transparency makes the assessment useful for engineering and risk teams without implying unbounded assurance.

Keep reading

September 25, 2026

Vector Database Security for RAG: Isolation, Access and Poisoning

A practical guide to securing vector databases used by RAG systems, including tenant isolation, ingestion controls, authorization, poisoning tests and evidence.

Read article
September 25, 2026

RAG Poisoning Security: How Malicious Documents Manipulate AI Agents

Understand and test RAG poisoning across document ingestion, retrieval, prompt injection, metadata, agent tools, memory and source remediation.

Read article