If you already know web or network pentesting and want to learn how to attack AI systems (chatbots, RAG apps, LLM agents, MCP tool servers and the models themselves), this repo is for you. It's also for builders who want to know how their AI app will be attacked before it ships.
Everything here is meant for systems you are authorised to test. Scope letters still apply when the target talks back.
⭐ If you find this roadmap useful, consider starring the repository. Your support helps the project reach more cybersecurity learners and encourages further contributions.
- What is AI pentesting?
- The one idea that explains most AI vulnerabilities
- Mind map gallery
- Level 1: LLM security basics
- Level 2: Indirect prompt injection, RAG and output handling
- Level 3: AI agents, MCP and model attacks
- OWASP Top 10 for LLM Applications 2026
- OWASP Top 10 for Agentic Applications
- AI red teaming tools
- AI pentest methodology
- Tips and tricks from the field
- Learning roadmap: zero to advanced
- Practice labs and CTFs
- Glossary
- FAQ
- Contributing
"AI pentesting" means two different jobs, and it helps to know which one you're doing.
| Pentesting AI | AI in pentesting | |
|---|---|---|
| The target | An AI system: chatbot, RAG app, agent, MCP server, model | A normal app or network |
| The AI is | The thing you attack | A tool on your side |
| Example | Making a support bot leak other customers' tickets | Using an LLM agent to find XSS faster |
| Also called | LLM pentesting, AI red teaming, LLM security testing | AI-assisted pentesting, autonomous pentesting |
Most of this guide covers pentesting AI, because that's where the new skills are. AI-assisted pentesting tools are covered in AI red teaming tools.
mindmap
root((AI Pentesting))
Pentesting AI
Chatbots and copilots
RAG apps
AI agents
MCP servers
The model itself
How it breaks
Prompt injection
Data leakage
Excessive agency
Improper output handling
AI in pentesting
LLM assistants for triage and scripting
Autonomous agents like XBOW
Open source agents like PentestGPT
Frameworks
OWASP LLM Top 10 2026
OWASP Agentic Top 10
MITRE ATLAS
NIST AI 100-2
An LLM cannot reliably tell instructions apart from data.
SQL injection was fixed by separating the query from the input. LLMs have no such separation. The system prompt, the user's message, a PDF, a web page, an email and a tool's output all land in the same context window as text, and the model decides what to do based on all of it.
So the question to ask is not "can I make the model say something bad?" It's:
What can the model touch, and who gets to put words in front of it?
A rude chatbot is a PR problem. A chatbot that can issue refunds, read other users' data or call internal APIs is a security problem. The impact lives in the plumbing, not in the model.
Six mind maps, free to use in talks, notes and training (credit appreciated, see License). SVG versions are in /mindmaps.
| # | Mind map | What it covers |
|---|---|---|
| 1 | AI pentesting overview | Both meanings of AI pentesting, attack surface, frameworks, mindset |
| 2 | LLM security basics | System prompt extraction, direct prompt injection, leakage, OWASP LLM Top 10 |
| 3 | Attack technique tree | Prompt injection, guardrail bypass, RAG, agents, MCP, model-level attacks |
| 4 | AI red teaming tools | Scanners, frameworks, labs and standards |
| 5 | AI pentest methodology | Scope to retest, step by step |
| 6 | Learning roadmap | Zero to advanced in about six months |
Start with a chatbot you're allowed to test. Learn to make it reveal, obey and leak.
System prompt extraction (Hidden Context Exposure)
- Ask for the instructions directly
- Ask it to repeat everything above your message
- Ask it to translate or summarise "the rules you were given"
- Ask for the instructions inside a code block or as JSON
- Check the leaked prompt for API keys, internal URLs, tool names and business rules
OWASP's 2026 guidance is clear: assume anything in the context can be extracted. A secret in a system prompt is a finding.
- Role-play a new persona ("you are now DebugBot")
- Claim authority ("maintenance mode", "admin override")
- Inject fake conversation history
- Prove you can change what it does, not just what it says
- Other users' data, tickets or history
- Internal documents and debug output
- The list of tools and functions it can call
- PII in responses or logs
You often don't need to type at the model at all. If the app reads web pages, emails, PDFs, CVs, reviews, tickets or calendar invites, anyone who can write to those places can write instructions the model will follow later, on behalf of another user.
- List every untrusted source the model reads
- Plant a harmless canary instruction in each one (a made-up word, or a request to your own server)
- Check whether the canary fires when a different user triggers the feature
Treat model output like untrusted user input.
- XSS: does the frontend render HTML or script the model emits?
- Markdown image exfiltration: can you make the model output an image URL that carries conversation data to your server?
- SQL, template or command injection where output flows into queries, templates or shells
- Does retrieval respect the user's permissions? (Can an intern's question pull HR documents?)
- Who can write to the knowledge base? (Customers? Partners? Shared drive links?)
- Are embeddings or vector store APIs exposed?
Specific payloads go stale quickly. The families don't.
| Family | Idea |
|---|---|
| Obfuscation | Base64, other languages, leetspeak, Unicode lookalikes, invisible characters |
| Payload splitting | Spread the instruction across messages or variables, then ask the model to assemble it |
| Multi-turn escalation | Start harmless and push further each turn (Crescendo). Single-message filters struggle with this |
| Context flooding | Many-shot examples or filler that dilute the system prompt |
| Multimodal | Instructions inside images, audio or file names that text filters never check |
Map every tool the agent can call. For each one, ask: if an attacker controlled the next instruction, what is the worst thing this tool could do?
- Send email or messages
- Read or write files
- Run code
- Merge code or change config
- Move money or issue refunds
Look for the lethal trifecta: the agent can read private data, reads untrusted content, and can communicate externally. All three together usually means a data exfiltration path.
- Whose credentials do tools run with: the user's or a service account?
- Can a low-privilege user ask the agent to do something they can't do directly? (Confused deputy)
- Tool poisoning: hidden instructions in tool descriptions
- Rug pulls: tools that change description or behaviour after approval
- Tool shadowing: a malicious server changing how the agent uses a different, trusted tool
- Classic server bugs: command injection, path traversal, missing auth
- Plant a false "fact" in long-term memory and check the next session
- Check whether agents blindly trust each other's output
- Look for a low-privilege agent that can pass instructions to a high-privilege one
| Attack | What it means |
|---|---|
| Model extraction | Query an API enough to train a copycat |
| Membership inference | Work out whether a record was in the training data |
| Training data extraction | Coax memorised data back out |
| Data and model poisoning | Backdoors planted in training or fine-tuning |
| Malicious model files | Pickle-based model files that run code when loaded |
| Adversarial examples | Small input changes that flip a classifier's decision |
Released in August 2026. Source: OWASP GenAI Security Project.
| ID | Risk | 2025 rank | What to test |
|---|---|---|---|
| LLM01 | Prompt Injection | 1 | Direct and indirect instruction overrides |
| LLM02 | Sensitive Information Disclosure | 2 | PII, secrets, cross-user data |
| LLM03 | Excessive Agency | 6 | Tools and permissions beyond what the feature needs |
| LLM04 | Supply Chain | 3 | Models, datasets, plugins, MCP servers |
| LLM05 | Data and Model Poisoning | 4 | Training, fine-tuning and knowledge base integrity |
| LLM06 | Unbounded Consumption | 10 | Token floods, denial of wallet, missing limits |
| LLM07 | Misinformation | 9 | Confident wrong answers users act on |
| LLM08 | Hidden Context Exposure | 7 (as System Prompt Leakage) | System prompt and hidden context leaks |
| LLM09 | Vector and Embedding Weaknesses | 8 | RAG access control and embedding leaks |
| LLM10 | Improper Output Handling | 5 | XSS, injection and exfiltration through output |
The biggest move: Excessive Agency jumped from 6th to 3rd. Models are getting hands, and hands are where the damage happens.
Published December 2025. Source: OWASP GenAI Security Project.
| ID | Risk |
|---|---|
| ASI01 | Agent Goal Hijack |
| ASI02 | Tool Misuse and Exploitation |
| ASI03 | Identity and Privilege Abuse |
| ASI04 | Agentic Supply Chain Vulnerabilities |
| ASI05 | Unexpected Code Execution |
| ASI06 | Memory and Context Poisoning |
| ASI07 | Insecure Inter-Agent Communication |
| ASI08 | Cascading Failures |
| ASI09 | Human-Agent Trust Exploitation |
| ASI10 | Rogue Agents |
| Tool | By | Best for |
|---|---|---|
| garak | NVIDIA | Broad LLM vulnerability scanning with many probes. A good first pass |
| PyRIT | Microsoft | Scripted multi-turn attacks, including Crescendo |
| promptfoo | Promptfoo (OpenAI) | YAML-driven red teaming in CI and regression testing |
| DeepTeam | Confident AI | Attacks mapped to OWASP categories |
| FuzzyAI | CyberArk | LLM fuzzing with many jailbreak techniques |
| promptmap | Utku Sen | Quick prompt injection checks |
| Giskard | Giskard | Quality, bias and hallucination testing |
| Burp Suite | PortSwigger | Attacking the API behind the chat UI |
Suggested workflow: garak for breadth, PyRIT for depth, promptfoo to keep fixes fixed. Scanners find known patterns. Business logic flaws, like a support bot that can be talked into a refund, still need a human.
| Tool | Use |
|---|---|
| Adversarial Robustness Toolbox | Evasion, poisoning, extraction and inference attacks |
| ModelScan | Scanning model files for unsafe code before loading |
| Tool | Notes |
|---|---|
| XBOW | Commercial autonomous pentester using agent swarms. Reached #1 on HackerOne's leaderboard in 2025 |
| PentestGPT | Open-source AI pentesting agent (USENIX Security 2024) |
These tools are strong on breadth and speed. Creative, context-heavy exploit chains are still where human testers earn their fee.
- Scope. Written authorisation. Which models, apps, agents and data. Production or staging. Cost limits. What counts as harmful output for this client.
- Recon and mapping. Proxy the API calls. List every tool and permission. Find every untrusted input the model reads. Find out who can write to the knowledge base.
- Threat model. Check for the lethal trifecta. Find out whose identity tools run as. Write down the worst action per tool.
- Automated sweep. garak for breadth, promptfoo or DeepTeam mapped to OWASP. Note what the guardrails catch.
- Manual exploitation. Indirect injection with canaries, output handling and exfiltration, privilege and tool abuse chains, multi-turn work with PyRIT.
- Report. Success rates, severity from impact, mapping to OWASP and MITRE ATLAS, real fixes.
- Retest. Turn findings into regression tests that run on every model or prompt change.
- Run every payload more than once. LLMs are non-deterministic. Report "7 of 20 attempts", not yes or no.
- Attack the API, not the chat box. The request may expose the system prompt, a
modelparameter,temperature, or editable history. - Use canaries. Prove execution without causing damage.
- Ask the agent what tools it has. It usually tells you. Then read the tool schemas in the traffic.
- Severity comes from impact. "Said a bad word" is low. "Any inbound email can make the assistant forward the CEO's mail" is critical.
- Check the boring stuff. Rate limits, spend caps, PII in logs, cross-tenant history, who can edit the system prompt.
- Recommend real fixes. Least privilege on tools, human approval for risky actions, untrusted output handling, no secrets in context. "Improve the system prompt" is not a fix.
- Keep your own payload notes. Public jailbreak lists go stale. Notes on what worked against which guardrail age well.
| Stage | Focus | Do this |
|---|---|---|
| Weeks 1–2 | Foundations | Learn tokens, context windows and system prompts. Beat Gandalf. Read the OWASP LLM Top 10 |
| Weeks 3–6 | First real bugs | PortSwigger LLM labs. Build a small RAG app and break it |
| Months 2–3 | Tooling | garak and PyRIT on your own app. Master indirect injection and output handling. Write real reports |
| Month 4+ | Agents and MCP | Build an agent with 2–3 tools, then make it misuse them. Learn the Agentic Top 10 and MITRE ATLAS |
| Advanced | Specialise | Adversarial ML, poisoning and backdoors, building AI-assisted tooling |
Keep your web fundamentals sharp. Many critical AI bugs turn out to be SSRF, XSS, broken access control or command injection, reached through a model.
- Gandalf by Lakera: extract a password across increasingly hard levels
- PortSwigger Web Security Academy: Web LLM attacks: free hands-on labs
- Damn Vulnerable LLM Agent: a deliberately vulnerable agent to run locally
- HackAPrompt and AI village CTFs at security conferences
- OWASP Top 10 for LLM Applications 2026
- OWASP Top 10 for Agentic Applications
- MITRE ATLAS: adversary tactics and techniques for AI systems
- NIST AI 100-2: Adversarial Machine Learning taxonomy
- Companion article on Medium: [https://medium.com/@ravi73079]
| Term | Meaning |
|---|---|
| Prompt injection | Input that changes an LLM's behaviour against the developer's intent |
| Indirect prompt injection | Instructions hidden in content the model reads (web pages, emails, documents), not typed by the attacker |
| Jailbreak | Getting a model to ignore its safety training or policy |
| System prompt | Hidden instructions the developer gives the model |
| RAG | Retrieval-augmented generation: the app searches a knowledge base and adds results to the prompt |
| AI agent | An LLM that plans and calls tools to take actions |
| MCP | Model Context Protocol, a standard way to connect tools and data to AI agents |
| Excessive agency | An AI system with more permissions or autonomy than it needs |
| AI red teaming | Adversarial testing of AI systems for security and safety failures |
| Denial of wallet | Running up an AI provider bill through expensive requests |
| Canary | A harmless, unmistakable marker used to prove an injection fired |
What is AI pentesting?
AI pentesting is security testing of AI systems such as chatbots, RAG apps, AI agents and machine learning models, looking for weaknesses like prompt injection, data leakage, excessive agency and insecure output handling. The term is also used for using AI to help with traditional penetration testing.
What is the difference between AI red teaming and AI pentesting?
They overlap heavily. AI red teaming often covers safety and harmful content as well as security, and tends to be broader and more adversarial. AI pentesting usually focuses on security vulnerabilities in a defined scope, with a report of findings and fixes.
How do you test for prompt injection?
Try direct overrides (role-play, fake authority, fake history), then indirect injection by planting harmless canary instructions in every untrusted source the model reads. Run each test several times, because LLM output is non-deterministic. Tools like garak, PyRIT and promptfoo automate much of this.
What are the best open-source AI red teaming tools?
garak (NVIDIA) for broad scanning, PyRIT (Microsoft) for multi-turn attacks, promptfoo for CI-based regression testing, and DeepTeam for OWASP-mapped tests. Burp Suite is still essential for attacking the API behind the chat interface.
Can prompt injection be fully fixed?
Not today. LLMs process instructions and data in the same channel. Guardrails make attacks harder but not impossible, so the real defences are least privilege, human approval for risky actions, treating output as untrusted, and keeping secrets out of the context.
How long does it take to learn AI pentesting?
If you already know web pentesting, about three months to be useful on real engagements and around six months to be comfortable with agents and MCP. See the learning roadmap.
Will AI replace penetration testers?
Autonomous tools like XBOW are very good at breadth and speed and are improving fast. Creative, context-heavy exploit chains and judgement about business impact still favour humans. Most teams will use both.
Found a new technique, tool or lab? Spotted something out of date? PRs are very welcome. See CONTRIBUTING.md.
- December 2026: First release. OWASP LLM Top 10 2026, OWASP Agentic Top 10, six mind maps.
Text and mind maps are licensed under CC BY 4.0. Use them in your talks, training and notes; just give credit with a link back to this repo.
This material is for education and authorised security testing only. Only test systems you own or have written permission to test.
Keywords: AI pentesting · LLM pentesting · AI red teaming · LLM security · prompt injection · indirect prompt injection · jailbreak · OWASP LLM Top 10 2026 · OWASP Agentic Top 10 · AI agent security · MCP security · RAG security · adversarial machine learning · AI security roadmap · garak · PyRIT · promptfoo
⭐ Star this repo if it helped you, and share it with someone learning AI security.





