AI Application Pentest Methodology
Treat AI features like distributed systems with probabilistic decision points. The test target is not only the model: it is the prompt chain, retrieval layer, permission model, gateway, observability stack, and the business process that trusts the output.
Use the planner first
Build a scoped AI test plan in seconds
Select the system shape and generate a practitioner checklist mapped to OWASP LLM, MITRE ATLAS, evidence, and report deliverables.
Document model/provider, user roles, data classes, tool permissions, allowed tests, and explicit no-go actions before testing begins.
Rules of engagement addendum, architecture sketch, permission inventory.
Test direct and indirect instruction conflicts across user input, retrieved content, files, tickets, web pages, and third-party connectors.
Prompt, source content, model response, guardrail behavior, impact notes.
Run at least one end-to-end authorized abuse path that starts with adversarial input and reaches an unsafe answer, data exposure, permission decision, or attempted tool action.
Abuse-case objective, fixture data, model context, response, downstream effect, and business-impact statement.
Convert accepted findings into repeatable evals with expected safe behavior, owner, severity, and rerun instructions.
Prompt/eval file, fixture IDs, scoring rule, model version, prompt version, pass/fail output.
Verify that generated output cannot trigger unsafe rendering, hidden links, credential disclosure, or automated downstream actions.
Rendered output capture, sanitizer behavior, blocked content examples.
Confirm prompts, retrieval hits, tool calls, approvals, and high-risk denials are logged with enough context for incident response.
Log samples, alert rules, retention policy, privacy notes.
Test cross-tenant retrieval, document-level ACLs, stale index entries, poisoned chunks, and citation integrity.
Corpus sample, retrieval trace, denied-document test, citation diff.
Seed harmless poisoned documents, cross-tenant canaries, stale index records, and citation-laundering fixtures to prove retrieval trust-boundary failures.
Document ID, chunk ID, retrieval score, source ACL, answer text, citation comparison, and canary result.
Review upload, crawl, sync, and connector paths for malicious instructions, hidden text, metadata injection, and unsafe file parsing.
Ingestion path map, sample poisoned document, sanitizer output.
Confirm read tools cannot access secrets, unrelated tenants, local credential stores, or out-of-scope repositories.
Allowlist, denied read tests, data-boundary notes.
Prefer local or approved enterprise endpoints, redact secrets before prompts, and record exactly where client data is processed.
Data-flow record, redaction examples, approved endpoint list.
Verify sensitive prompts route only to approved local/private endpoints and fallback behavior does not leak data to public providers.
Routing policy, fallback test, denied external call.
What you'll be able to do
- Write an AI rules-of-engagement addendum with test classes, tool-use boundaries, and stop conditions
- Map the AI attack surface across prompts, retrieval, tools, memory, gateways, approvals, logs, and output consumers
- Convert OWASP LLM, MITRE ATLAS, business flows, and tool permissions into testable hypotheses
- Execute tests in low-risk order against controlled fixtures
- Preserve full evidence and define fix-validation criteria for every finding
Assessment Phases
1. Scope and data rules
Document AI features, model/provider, data classes, allowed test types, prohibited actions, and evidence handling.
2. Architecture mapping
Map users, prompts, retrieval, memory, tools, model gateways, output sinks, logging, and approval gates.
3. Abuse case design
Convert OWASP LLM, MITRE ATLAS, business flows, and tool permissions into testable hypotheses.
4. Controlled execution
Run tests in low-risk order: prompt conflicts, retrieval boundaries, tool abuse, tenant isolation, output handling, and monitoring.
5. Evidence and retest
Preserve prompts, traces, screenshots, logs, control behavior, business impact, and fix validation criteria.
AI application pentest methodology - the five assessment phases, with retest feeding back into abuse-case design
Scroll sideways to see the whole diagram
Minimum Test Matrix
| Area | What to test | Proof to collect |
|---|---|---|
| Prompt layer | Direct, indirect, multi-turn, role conflict, and hidden instruction handling. | Prompt, context, response, refusal or bypass trace. |
| Retrieval | Chunk poisoning, ACL filters, stale index entries, source ranking, and citation integrity. | Retrieved chunks, scores, source IDs, user role. |
| Tools and agents | Tool allowlists, argument validation, approval gates, memory persistence, sandbox escape paths. | Tool manifest, approval logs, blocked calls, sandbox policy. |
| Model gateway | Tenant isolation, abuse throttling, provider fallback, prompt/version pinning, sensitive-output controls. | Gateway config, request IDs, rate-limit results, version record. |
| Operations | Logging, alerting, incident response, privacy retention, data minimization, and human handoff. | Log samples, alert rule, retention setting, escalation workflow. |
Client Deliverables
AI RoE addendum
Allowed models, providers, test classes, tool-use boundaries, evidence restrictions, and emergency stop conditions.
AI attack-surface map
Trust boundaries for prompts, retrieval, tools, memory, gateways, human approval, logs, and output consumers.
Regression pack
A small set of reproducible prompts, fixtures, and expected outcomes that validate fixes after model or prompt changes.
Quality bar
Setup and Prerequisites
- Scoped plan: create a scoped test plan in the planner above, then refine it against the client's architecture and rules of engagement.
- Fixture pack: the fixture pack at
/labs/offensive-ai(docker-compose.yml, app/, fixtures/, scripts/) for controlled execution. - Runtime: Docker + Docker Compose, or Python 3.11+ to run the app directly with
python -m app.server. - Working directory: run every command from inside the pack directory; the lab client is
python scripts/lab.py.
docker compose up -d
python scripts/wait_for_health.pyExpected output
marker is OAI-TOYAPP-HEALTHY.
Steps
-
Document AI features, model/provider, data classes, allowed test types, prohibited actions, and evidence handling in an AI RoE addendum.
roe-addendum.md# AI RoE addendum — fill every heading before testing. # Allowed models, providers, test classes, tool-use boundaries, # evidence restrictions, and emergency stop conditions. ## Allowed models ## Allowed providers ## Allowed test classes ## Prohibited actions ## Tool-use boundaries ## Evidence restrictions ## Emergency stop conditionsExpected output
Allowed models, providers, test classes, tool-use boundaries, evidence restrictions, and emergency stop conditions are all named before testing starts. -
Map users, prompts, retrieval, memory, tools, model gateways, output sinks, logging, and approval gates onto the trust boundaries.
attack-surface-map.md# AI attack-surface map — trust boundaries for each area. ## Prompts ## Retrieval ## Tools ## Memory ## Gateways ## Human approval ## Logs ## Output consumersExpected output
Trust boundaries exist for prompts, retrieval, tools, memory, gateways, human approval, logs, and output consumers. -
Convert OWASP LLM, MITRE ATLAS, business flows, and tool permissions into testable hypotheses.
abuse-case.md# Abuse case — one testable hypothesis per file. surface: prompt-layer | retrieval | tools-agents | model-gateway | operations control: the control this case should trip expected: the observable result that proves impact evidence: prompt, context, response, refusal or bypass traceExpected output
Each hypothesis names its surface, the control it should trip, the expected observable result, and the evidence to collect. -
Run tests in low-risk order — prompt conflicts, retrieval boundaries, tool abuse, tenant isolation, output handling, and monitoring — starting with a fixture health check.
controlled-execution.shpython scripts/lab.py healthExpected output
The fixture answers healthy with markerOAI-TOYAPP-HEALTHY; higher-risk phases only start after the low-risk ones pass. -
Preserve prompts, traces, screenshots, logs, control behavior, business impact, and fix validation criteria in a regression pack.
regression-pack.json{ "prompts": ["reproducible prompt, pinned to a prompt version"], "fixtures": ["fixture name and hash"], "expected_outcomes": ["expected observable result per prompt"] }Expected output
A small set of reproducible prompts, fixtures, and expected outcomes that validate fixes after model or prompt changes.
Verify It Worked
| Check | Expected | Where to look |
|---|---|---|
| AI RoE addendum names the boundaries | Allowed models, providers, test classes, tool-use boundaries, evidence restrictions, and emergency stop conditions | The engagement file |
| Attack-surface map covers every boundary | Prompts, retrieval, tools, memory, gateways, human approval, logs, and output consumers each listed | The attack-surface map document |
| Regression pack reproduces the findings | Reproducible prompts, fixtures, and expected outcomes that validate fixes after model or prompt changes | The regression pack directory |
| Each finding meets the quality bar | Exact user role, source content or fixture, model/prompt version, retrieved context, tool-call trace, business impact, and the control that should have stopped it | The finding record |
Evidence and Findings
| Finding | Proof | Control |
|---|---|---|
| Missing AI RoE boundaries | No documented test classes, tool-use limits, or stop conditions for the engagement. | AI RoE addendum before testing. |
| Unmapped AI attack surface | Prompts, retrieval, tools, memory, gateways, approvals, logs, or output consumers lack trust boundaries. | AI attack-surface map. |
| Finding without reproduction | Missing user role, source fixture, model/prompt version, retrieved context, or tool-call trace. | Quality-bar evidence bundle plus a regression pack. |
Common Mistakes
Testing without a written AI RoE addendum
Document AI features, model/provider, data classes, allowed test types, prohibited actions, and evidence handling first: allowed models, providers, test classes, tool-use boundaries, evidence restrictions, and emergency stop conditions.
Skipping the architecture map
Map users, prompts, retrieval, memory, tools, model gateways, output sinks, logging, and approval gates before designing abuse cases.
Running high-risk tests first
Run tests in low-risk order: prompt conflicts, retrieval boundaries, tool abuse, tenant isolation, output handling, and monitoring.
Reporting without retest criteria
Preserve prompts, traces, screenshots, logs, control behavior, business impact, and fix validation criteria — a strong AI finding includes the exact user role, source content or fixture, model/prompt version, retrieved context, tool-call trace if applicable, observed business impact, and the control that should have stopped it.
Related Offensive AI Guides
RAG Security Testing
Retrieval, poisoning, ACL, and citation testing.
AI Evaluation Workbench
Turn AI findings into regression tests.
Agent Permission Model
Tool permissions, approvals, and sandboxing.
Test Case Library
Reusable AI attack cases to drive each phase of this methodology.
Secure Architecture
Design safer AI-enabled systems.