A practical, no-fluff guide to hacking AI systems (legally) and understanding how real attackers are using AI right now.
Written and maintained by Hassan Ansari (@trickyhash), founder of HackproofHacks
I'm Hassan Ansari, an ethical hacker from India. I've spent over ten years breaking into web apps, APIs and infrastructure (with permission, always), and I run every penetration test at HackproofHacks myself.
These days almost every client app I test has an LLM bolted onto it somewhere. A support chatbot. A "summarize this document" button. An agent that can read emails and call APIs. And most of them break in ways their developers never imagined.
So I wrote down everything I wish someone had handed me when I started testing AI systems: how they break, which tools actually help, where to practice for free, and what attackers are doing with AI in the wild right now.
| Experience | 10+ years in offensive security |
| Learners trained | 10,000+ |
| Community | 212K+ followers across Instagram, YouTube and X |
| Recognition | #3 in Feedspot's Top 35 Ethical Hacking Influencers 2026, CyberFrat Top 100 Cybersecurity Influencers in India |
| Public work | Cyber awareness partner, CyberDost · I4C |
| Credentials | Certified Network Security Specialist (ICSI UK), LPI Linux Essentials |
If this guide helps you, drop a ⭐ on the repo and follow me on Instagram. I post AI hacking breakdowns there before they land anywhere else.
Everything here is for learning and for authorized security testing. Only test AI systems you own, systems inside a lab built for practice, or systems where you have written permission (a signed scope, or a bug bounty program that explicitly covers AI features).
Prompt injecting a company's chatbot "just to see" can still be unauthorized access. Jailbreaking a model to produce harmful content breaks the provider's terms and, depending on what you produce, the law. Don't do it. The labs below give you plenty of legal targets.
- What "AI hacking" actually means
- How LLM apps break: OWASP Top 10 for LLMs
- How AI agents break: OWASP Agentic Top 10
- The core attack techniques, explained simply
- How I pentest an LLM application
- AI red teaming tools (open source)
- AI-powered pentesting agents
- Free AI hacking labs and CTFs
- How real attackers are using AI in 2026
- Learning roadmap: zero to AI red teamer
- Defender checklist
- Frameworks and reading list
- More free stuff from me
- Learn this with me
- FAQ
🧰 Looking for tools? The full catalog of 100+ AI hacking tools (scanners, fuzzers, MCP scanners, model scanners, pentest agents, guardrails, benchmarks) lives in TOOLS.md.
People use the phrase for two very different things, and mixing them up causes a lot of confusion.
Hacking AI systems. The target is the AI itself or the app built around it. You try to make a chatbot leak its system prompt, trick an agent into calling a tool it shouldn't, poison the documents a RAG app retrieves, or steal the API keys that power it. This is AI red teaming and LLM penetration testing.
Hacking with AI. The AI is your sidekick. You use models and agents to speed up recon, read code, write exploits for known bugs, triage scan output or draft reports. Attackers do the same thing, which is why section 9 matters.
A good AI security person understands both. This guide covers both.
ELI5: An LLM (large language model) is the brain behind ChatGPT style tools. It predicts the next word based on everything in its "context", meaning the instructions, your message and any documents it was given. Most AI attacks are about sneaking your own instructions into that context.
OWASP (the folks behind the famous web Top 10) maintain a list of the most critical risks in apps built on LLMs. The 2025 edition is the one most testers and vendors map to today. OWASP's GenAI Security Project has also published a 2026 edition with updated mappings to NIST, MITRE ATLAS and the Agentic Top 10, so check genai.owasp.org for the latest version.
| ID | Risk | What it looks like in a real test |
|---|---|---|
| LLM01 | Prompt Injection | Your input (or a hidden instruction in a document) overrides what the developer told the model to do |
| LLM02 | Sensitive Information Disclosure | The bot leaks customer data, internal docs, API keys or other users' chat history |
| LLM03 | Supply Chain | A poisoned model file, a malicious plugin or a compromised dependency in the AI stack |
| LLM04 | Data and Model Poisoning | Someone tampers with training or fine-tuning data to plant bias or a backdoor |
| LLM05 | Improper Output Handling | The app trusts model output blindly, so the model "writes" XSS, SQL or shell commands that get executed |
| LLM06 | Excessive Agency | The model has tools and permissions far beyond what the feature needs (a FAQ bot that can issue refunds) |
| LLM07 | System Prompt Leakage | You extract the hidden instructions, and sometimes the secrets developers stuffed into them |
| LLM08 | Vector and Embedding Weaknesses | Attacks on the vector database behind RAG: cross-tenant leaks, poisoned embeddings |
| LLM09 | Misinformation | The model confidently invents facts, packages or legal advice that people act on |
| LLM10 | Unbounded Consumption | Token floods, runaway agent loops and huge API bills (denial of wallet) |
Notice how many of these are plain old web security wearing a new hat. LLM05 is basically injection. LLM06 is broken access control. That's good news if you already know web pentesting. Your skills carry over.
Agents are LLMs that can act: browse, call APIs, run code, read your inbox, talk to other agents. OWASP released a dedicated Top 10 for them, built with input from over 100 researchers, and it introduces a principle I love: least agency. Give an agent only the autonomy it needs for a small, bounded job.
| ID | Risk | In plain words |
|---|---|---|
| ASI01 | Agent Goal Hijack | Hidden instructions in a web page, email or file change what the agent is trying to do |
| ASI02 | Tool Misuse and Exploitation | The agent uses a legit tool in a harmful way, like deleting records it was only meant to read |
| ASI03 | Identity and Privilege Abuse | The agent leaks or reuses credentials it inherited from a user or system |
| ASI04 | Agentic Supply Chain | Compromised tools, prompts, plugins, MCP servers or skill packages |
| ASI05 | Unexpected Code Execution | The agent writes and runs unsafe code without isolation or review |
| ASI06 | Memory and Context Poisoning | Poisoned memory, RAG data or embeddings steer the agent's future behaviour |
| ASI07 | Insecure Inter-Agent Communication | Agents trust each other's messages with no authentication, so one can be spoofed |
| ASI08 | Cascading Failures | One agent's mistake spreads through an entire multi-agent workflow |
| ASI09 | Human-Agent Trust Exploitation | People trust the agent too much, and an attacker uses that trust to manipulate them |
| ASI10 | Rogue Agents | A compromised or misaligned agent acts maliciously while looking normal |
In practice these chain together. A typical path I look for: goal hijack (ASI01) leads to tool misuse (ASI02), which spreads (ASI08), and finally a human approves something because "the agent said it was fine" (ASI09).
I'm keeping this conceptual on purpose. The labs in section 8 let you try every one of these safely.
You type instructions that compete with the developer's system prompt. Classic example: asking a "math tutor only" bot to ignore its rules. Modern apps filter the obvious stuff, so testers use role play, encoding tricks, other languages and multi-step conversations.
This is the one that keeps me busy on real engagements. The malicious instruction lives in content the AI reads later: a web page, a PDF, an email, a calendar invite, a code comment, a support ticket. The user never sees it. The agent does, and obeys. Any app that lets an LLM read untrusted content and also take actions is a candidate.
Getting the model to reveal its hidden instructions. On its own that's often low severity. It becomes critical when developers put API keys, internal URLs or business logic in there (they do, a lot).
Instead of one big malicious request, the attacker escalates slowly across many turns until the model's guardrails give way. Microsoft's research calls one version of this "Crescendo". Tools like PyRIT automate multi-turn attacks for exactly this reason.
RAG (retrieval augmented generation) means the app searches a document store and feeds the results to the model. If you can get a document into that store, through an upload feature, a wiki, a shared drive or a public web page, you can influence answers for every user who triggers its retrieval.
The model's response gets rendered as HTML, inserted into SQL or passed to a shell. Now prompt injection becomes stored XSS, SQL injection or command execution. TryHackMe's 2026 "AI Odyssey" CTF even ended on stored XSS through LLM-rendered HTML, which tells you how common this pattern is.
The agent has a tool like send_email, refund_order or run_query. You don't need to break the model. You just need to convince it to call the tool with your parameters. Always map every tool an agent has, and what identity it runs as.
Malicious model files (Python pickle files can execute code when loaded), typosquatted packages that models "hallucinate" into existence, and compromised MCP servers or agent skill packages. In early 2026, VirusTotal researchers reported malicious and insecure skill packages in the OpenClaw agent ecosystem.
Attackers steal cloud and AI credentials, then burn through the victim's model and GPU quotas or resell the access. Leaked keys in GitHub repos, .env files and front-end JavaScript are still the easiest way in. (My JS-Enumeration script is handy for finding keys exposed in JS files on targets you're authorized to test.)
This is roughly the flow I follow on client work. It sits on top of a normal web/API test, not instead of it.
- Scope it properly. Which models, which features, which tools and integrations, which data sources. Get written permission that explicitly mentions AI features and any third-party model provider rules.
- Map the architecture. Where does user input enter? What content does the model read (RAG sources, uploads, URLs, emails)? What tools can it call, and with whose permissions? Where does its output go (browser, database, shell, another agent)?
- Fingerprint the model and guardrails. Figure out the model family, the filters in front of it and how errors are handled.
- Attack the inputs. Direct injection, system prompt extraction, jailbreak attempts, encoding and language tricks.
- Attack the context. Indirect injection through every content source the model reads. Plant test payloads in documents you're allowed to upload.
- Attack the actions. For every tool, ask "can I make the agent call this with my parameters, for another user, or more often than intended?"
- Attack the output. Can model output trigger XSS, SQLi, SSRF or command execution downstream?
- Check the data. Cross-user leakage, tenant isolation in the vector DB, logs and chat history exposure.
- Check cost and abuse. Rate limits, token limits, agent loop limits.
- Automate the regression. Run garak, Promptfoo or PyRIT so the client can retest after every model or prompt change.
- Report like an engineer. Severity, reproduction steps, real impact and a fix the developers can actually ship.
Burp Suite is still my main tool for the first eight steps. The AI is just another API endpoint.
These are the tools worth learning first. All free.
| Tool | Maintainer | Best for |
|---|---|---|
| Promptfoo | Promptfoo (acquired by OpenAI in March 2026, still open source) | Evals plus red teaming of LLM apps and agents, great in CI/CD pipelines |
| garak | NVIDIA | LLM vulnerability scanner with a huge library of probes. Think "Nmap for LLMs" |
| PyRIT | Microsoft | Scripted, multi-turn and multi-modal attacks, built for security teams |
| DeepTeam | Confident AI | 40+ vulnerability types mapped to the OWASP LLM Top 10 |
| A.I.G (AI-Infra-Guard) | Tencent Zhuque Lab | Agent red teaming plus scanning of MCP servers, skills and exposed AI infrastructure |
| Giskard | Giskard | Testing library for LLM agents with red teaming features |
| Inspect | UK AI Security Institute | LLM and agent evaluations, including offensive cyber evals |
| Spikee | WithSecure Labs | Prompt injection testing with Burp Suite integration |
| Burp Suite | PortSwigger | Still the core of every LLM app test, since the AI sits behind HTTP |
Defensive tools worth knowing (so you can test around them): Guardrails AI and LLM Guard for input/output filtering, and MCP gateways like Obot for controlling what agents can touch.
My honest take: start with garak to understand what a scan looks like, then Promptfoo for app-level testing, then PyRIT once you need multi-turn attacks.
Want the full arsenal? TOOLS.md covers 100+ tools in 16 categories: jailbreak fuzzers like FuzzyAI and promptmap2, MCP scanners from Cisco and Invariant Labs, model file scanners like ModelScan and Fickling, adversarial ML libraries, security-tuned models, guardrails you'll need to test around, benchmarks, and a "which tool should I start with" cheat sheet.
This is the "hacking with AI" side, and it moved fast in 2026.
Open source agents and frameworks you can study in a lab: PentestGPT (one of the first, from USENIX Security 2024), PentAGI and VulnBot (multi-agent planner and executor designs), Strix (graph-based agents for recon, exploitation and post-exploitation), and CAI (Cybersecurity AI from Alias Robotics). By mid 2026 researchers counted 39+ open source AI pentesting agents.
Commercial platforms: XBOW, Horizon3.ai NodeZero, Pentera, Aikido, Astra, Intruder, and the AWS Security Agent, which Amazon made commercially available in March 2026.
What this means for you: these tools are great at breadth and speed on known bug classes. They still struggle with business logic, weird auth flows and creative chaining, which is exactly where human testers earn their money. Learn to drive the agents, and keep sharpening the parts they can't do.
There are now dozens of these agents, including Shannon, HexStrike AI, Decepticon, RedAmon, NeuroSploit and hackingBuddyGPT. The full list with repo links and one-line descriptions is in TOOLS.md, section 5.
One warning from the defender side: Microsoft reported in November 2026 that ARTEX, a publicly available AI pentesting framework released in July 2026, has been abused by many threat actors for recon, credential attacks and web exploitation. The same tools you use legally are in attackers' hands too.
Practice here, not on random company chatbots.
Start here (browser based, beginner friendly)
- PortSwigger Web Security Academy: LLM attacks: prompt injection, excessive agency and insecure output handling labs. My favourite starting point if you already know Burp.
- Gandalf by Lakera: get the password out of the AI, level by level. Fun and addictive.
- Prompt Injection CTF: 16 missions covering the OWASP LLM Top 10 plus a 30-mission Agentic Security Lab, with a defender mode. No signup.
- PromptTrace: free hands-on labs with real LLMs plus a multi-level "Gauntlet" CTF covering RAG poisoning and tool exploitation.
- Immersive Labs AI challenges and SecDim AI games.
Intermediate
- Dreadnode Crucible: hosted AI hacking sandbox with prompt injection, evasion, fingerprinting and model inversion challenges.
- Microsoft AI Red Teaming Playground Labs: the lab set Microsoft uses in its own training (direct and indirect injection, metaprompt extraction, Crescendo).
- CrowdStrike AI Unlocked (released Feb 2026): prompt injection against increasingly capable agents.
- TryHackMe AI security rooms and events, like the 2026 "AI Odyssey" CTF.
Self-hosted (run on your own machine)
- Damn Vulnerable LLM Agent: a deliberately insecure ReAct agent for Thought/Action/Observation injection.
- Bishop Fox local-llm-ctf: Go + Ollama harness for practising guardrail bypass.
- ai-prompt-ctf: one of the few CTFs focused on indirect injection against tool-calling agents and RAG.
- LLMVault: self-hosted range with 25 labs for the OWASP LLM Top 10.
- Build your own target: clone my RAG-Chatbot or RAG-AI-Agent, run them locally, and point garak or Promptfoo at them. Attacking something you built yourself teaches you more than any walkthrough.
Events and resource hubs
- DEF CON AI Village CTF, every year.
- Arcanum's AI security resource hub and prompt injection taxonomy, which grew to 172 documented attack and bypass techniques.
- awesome-prompt-injection for a big curated list.
New to hacking in general? Do the basics in my h4cking-l4bs repo first, then come back here.
This section is based on public threat intelligence reports, not hype. Sources are linked so you can read them yourself.
AI-enabled attacks are surging. CrowdStrike's 2026 Global Threat Report found an 89% increase in attacks where adversaries used AI during 2025. Their summary: AI lifted up weaker attackers and made the strongest ones faster. (source)
Exploitation with no human in the loop. On 16 November 2026, Google Threat Intelligence Group and Mandiant reported catching attackers using LLM frameworks that compared patched code, wrote exploits and launched them on their own. That was the first time Google had seen it end to end. Attackers mostly aim this at "n-day" bugs, meaning flaws that already have a patch but haven't been applied everywhere yet. (source)
"Exploit foundries" and multi-agent operations. Anthropic's September 2026 threat report describes threat actors running multi-agent frameworks for recon, exploitation and data exfiltration, and building automated exploit pipelines. One hacktivist campaign ran for a month entirely on stolen API keys. (source)
Stolen AI accounts are a market. The GTIG report describes LLMjacking, with stolen AI accounts selling for as little as US$0.10 per million tokens. (source)
Phishing got a lot better. SOCRadar's AI Threat Landscape 2026 cites research showing AI-automated phishing reaching a 54% click-through rate versus 12% for traditional phishing. Voice cloning and deepfake identity fraud are covered in the same report. (source)
Criminals are building their own models. Flashpoint's 2026 midyear report describes threat actors building safeguard-free LLMs on private infrastructure and using them to turn disclosed vulnerabilities into working proof-of-concept code. (source)
Legit AI tools inside companies get abused too. CrowdStrike also found attackers abusing the legitimate AI tools of more than 90 organizations to generate malicious commands and steal data. And IBM's 2026 Cost of a Data Breach report found AI was used in about one in four malicious breaches.
The takeaway for defenders: the attack techniques themselves haven't changed much (stolen credentials, unpatched systems, phishing). The speed and scale have. Patch faster, protect your AI API keys like production secrets, and assume any agent that reads untrusted content can be hijacked.
WEEKS 1 to 2 Foundations
Python basics, HTTP and APIs, how LLMs and RAG work
Burp Suite fundamentals (PortSwigger Academy)
WEEKS 3 to 4 LLM attacks
Gandalf, PortSwigger LLM labs, Prompt Injection CTF
Read the OWASP LLM Top 10 end to end
WEEKS 5 to 6 Agents and tools
OWASP Agentic Top 10, Damn Vulnerable LLM Agent
Build a small RAG app (or clone mine) and attack it
WEEKS 7 to 8 Automation
garak scans, Promptfoo red team config, PyRIT multi-turn attacks
Map findings to MITRE ATLAS
WEEKS 9 to 12 Real world skills
Dreadnode Crucible, Microsoft AI Red Teaming Labs
Bug bounty programs that explicitly include AI features
Write up everything you learn (public writeups get you hired)
If you want someone to walk this path with you, that's literally what my mentorship does. See section 14.
- Treat all model output as untrusted user input. Encode it before rendering, never pass it raw to SQL or a shell.
- Never put secrets, keys or internal URLs in the system prompt.
- Give agents the smallest set of tools and permissions possible (least agency).
- Require human approval for destructive or financial actions.
- Separate trusted instructions from untrusted content (emails, web pages, uploads).
- Enforce tenant isolation in your vector database.
- Rate limit tokens, requests and agent loop depth.
- Store AI API keys in a secrets manager, rotate them and alert on unusual usage.
- Vet models, plugins, MCP servers and skill packages like any other dependency.
- Run garak or Promptfoo in CI so every prompt or model change gets retested.
- Get a manual pentest before launch. Scanners miss business logic.
Quick win: run your domain through my free Security Scan and HTTP Header Analyzer. Your AI feature is only as safe as the web app around it.
- OWASP GenAI Security Project: LLM Top 10, Agentic Top 10 and companion guides
- MITRE ATLAS: the ATT&CK style knowledge base for attacks on AI systems
- NIST AI Risk Management Framework
- Google Threat Intelligence Group: AI threat tracker
- Anthropic threat intelligence report, September 2026
- Microsoft on ARTEX and agentic frameworks abused by attackers
- AI/ML pentesting roadmap by anmolksachan
If you liked this, these will probably help too:
| Repo | What you get |
|---|---|
| h4cking-l4bs | Hands-on hacking labs, CTF writeups and platform guides for TryHackMe, HackTheBox, PortSwigger, PicoCTF and more |
| awesome-osint-tools | Curated OSINT tools for recon, social media intelligence, domains and networks |
| dvwa-docker-lab | Run DVWA with Docker the easy way, with fixes for the 11 most common setup mistakes |
| RAG-Chatbot | A RAG chatbot in Python. Run it locally and practise the attacks from this guide on it |
| RAG-AI-Agent | A RAG-powered AI agent in Python, another good local target |
| recon_script | Shell script for automating recon |
| JS-Enumeration | Grab all JS files from a target and look for sensitive data like leaked API keys |
| Sd-fuzz-automation | Grab subdomains and fuzz the results automatically |
| ghostip | Automatic Tor identity rotator |
Free tools on my site: Security Scan · SSL Certificate Checker · HTTP Header Analyzer · Subdomain Finder
Blog: hackproofhacks.com/blog, including How to Get Started in Cybersecurity: A Practical Roadmap for 2026.
📬 Free weekly newsletter. One practical security lesson every week. Real attacks, explained simply, plus what to do about them. 10,000+ readers already. Join free here
🎓 Mentorship. Live batch cohorts (max 20 students, 120+ hours, certificate) and private 1:1 mentorship with a custom roadmap, portfolio review and interview prep. AI hacking is part of the curriculum. Apply here
🛡️ AI and web app penetration testing. Shipping an LLM feature, an agent or an API? I test it by hand, the way an attacker would, and you get a report your engineers can actually fix from. Book an assessment
Follow along
| Where | Handle | What I post there |
|---|---|---|
| @trickyhash | Quick AI hacking and cybersecurity breakdowns, reels, behind the scenes | |
| YouTube | @trickyhash | Full tutorials and walkthroughs (Hinglish) |
| X | @trickyhash | Threads and quick takes |
| GitHub | @th3hash | Labs, tools and guides like this one |
| HackproofHacks | Company updates and case studies | |
| Website | hackproofhacks.com | Blog, free tools, services, training |
What is AI hacking? It covers two things: attacking AI systems (prompt injection, jailbreaks, data leakage, agent hijacking) and using AI to help with hacking (recon, exploit development, automation). Ethical AI hacking means doing either one only with permission.
What is prompt injection? An attack where someone sneaks their own instructions into what a language model reads, so it ignores the developer's instructions. Direct injection comes from the user's message. Indirect injection hides inside documents, emails or web pages the AI processes later.
What is AI red teaming? Simulating attacks on an AI system to find safety and security failures before real attackers do. It mixes manual testing with tools like garak, Promptfoo and PyRIT.
Is it legal to hack ChatGPT or other chatbots? Only within the provider's rules or an official bug bounty program, and only for security testing. Testing a company's AI feature without permission can be illegal. Use the free labs in section 8 to practise.
Do I need to know machine learning to start? No. If you know web basics, HTTP and a bit of Python, you can start with LLM application security today. ML depth helps later for model-level attacks like poisoning and extraction.
What's the best free tool to start AI red teaming? garak for scanning models and Promptfoo for testing full LLM apps. Both are free and open source.
Where can I practise AI hacking for free? PortSwigger's LLM attack labs, Gandalf, the Prompt Injection CTF, PromptTrace, Dreadnode Crucible and Microsoft's AI Red Teaming Playground Labs. Full list in section 8.
Found a great new lab, tool or report? Open a pull request or an issue. Keep it educational and legal: no live targets, no harmful payloads, no writeups for active challenges.
Content is shared for educational use. Feel free to share it with credit to Hassan Ansari (@trickyhash) and a link back to this repo.
If this guide taught you something, ⭐ star the repo and share it with one friend who's learning security.
Made by Hassan Ansari · @trickyhash on Instagram and YouTube · @th3hash on GitHub · hackproofhacks.com · Newsletter
Keywords: AI hacking, AI hacking guide, LLM pentesting, LLM penetration testing, prompt injection, indirect prompt injection, jailbreak, AI red teaming, AI security, agentic AI security, OWASP LLM Top 10, OWASP Agentic Top 10, MITRE ATLAS, garak, Promptfoo, PyRIT, AI pentesting tools, AI hacking labs, AI CTF, ethical hacking, cybersecurity India, Hassan Ansari, trickyhash, HackproofHacks