Hacking AI Systems: Prompt Injection, LLM Security, and AI Red Teaming in Practice
£ 24.99
A hands on guide to prompt injection, LLM security, and AI red teaming. Build one running lab, attack it, defend it, and assess real AI systems.
Paying with an express button gives you instant access to your download, and you agree that all sales are final and you lose your 14-day right to cancel (see the refund policy).
Preview This Book
Explore a sample of this book before purchasing the complete edition.
Preparing your preview…
Description
Every AI system that talks back to a user can be talked into something it was never supposed to do. Hacking AI Systems is a hands on guide to finding exactly where that happens, why it happens, and what a defender who takes the problem seriously actually builds instead.
This is not a survey of AI risk written for executives, and it is not an academic paper about theoretical adversarial machine learning. It is a practitioner’s field manual for security engineers, penetration testers, red teamers, and AI engineers who need to test, break, and secure large language models, retrieval augmented generation pipelines, autonomous agents, and the infrastructure underneath all of it.
You will build one lab environment in the first two chapters and never abandon it. Chapter by chapter, that lab grows a new capability: a chat interface, a document retrieval pipeline, a vector database, an autonomous agent with real tools, a fine tuned model, a detection and monitoring layer. By the final chapter you are handed a deliberately vulnerable version of that same platform and asked to assess it the way you would assess a paying client’s system, because by then it essentially is one.
Inside, you will learn to identify and exploit prompt injection, both direct and indirect, and understand exactly why it works at a structural level rather than as a list of clever phrases. You will run categorized jailbreak evaluations against real models and measure compliance rates instead of collecting one off bypass strings. You will find and fix broken authorization in AI tool calls, cross tenant data leakage in retrieval pipelines, and exposed vector databases that bypass every access control your application ever implemented. You will build an autonomous agent with excessive permissions, watch a single prompt injection turn into a real security incident, and then progressively lock that agent down using the same least privilege principles that already govern every other system you secure.
The book goes further than the browser facing attacks most AI security content stops at. You will work through model supply chain security, including the risk of pickle based model files that execute code on load, and the safer alternatives. You will study model backdoors and data poisoning through controlled demonstrations you run yourself. You will measure memorization and privacy risk in fine tuned models using canary based auditing, and understand what model extraction actually costs an attacker to pull off.
The final third of the book turns everything you have learned into process. You will build a complete AI red team methodology mapped to MITRE ATLAS, turn your attack techniques into a continuous, automated security evaluation pipeline gated into CI/CD, design a fully hardened production AI architecture with every control traced back to the chapter that justifies it, and write an incident response playbook specifically for AI security failures. The book closes with a full capstone assessment against a realistic, multi vulnerability AI platform, using the exact methodology you would bring to a real, authorized engagement.
What you will be able to do by the end
Identify and safely reproduce direct and indirect prompt injection, jailbreak techniques, and business logic flaws unique to LLM applications
Secure retrieval augmented generation pipelines, vector databases, and multi tenant AI systems against data leakage and cross tenant exposure
Design least privilege tool permissions for autonomous AI agents and prevent a contained prompt injection from becoming a full incident
Evaluate model provenance, detect potential backdoors, and assess fine tuning pipelines for memorization and privacy risk
Build detection rules, a continuous security evaluation pipeline, and a complete AI red team methodology you can run on real, authorized engagements
Every technique in this book is demonstrated against a lab you build yourself, with real code, real Docker Compose configurations, real Python, and real attack payloads you run against infrastructure you control. Nothing here requires you to test a system you do not own or lack explicit authorization to assess.
Whether you are a security professional extending your AppSec background into AI, or an ML or AI engineer who has never run a red team engagement, this book gives you the working methodology the field currently lacks: something you can open on a Monday morning, build alongside, and use to find something real by Friday.
Book Details
Two hundred fifteen pages, twenty four chapters in five parts: Foundations, Offensive Security, Supply Chain and Model Security, Defensive Engineering and Operations, and Assessment and Production, plus end matter with checklists, a glossary, and further reading. Delivered as a PDF formatted for screen and print, with full syntax highlighted code and rendered architecture diagrams throughout.
Keywords
AI security, LLM security, prompt injection, AI red teaming, jailbreak testing, RAG security, vector database security, AI agent security, model supply chain security, AI penetration testing, MITRE ATLAS, OWASP LLM Top 10, AI incident response, machine learning security, adversarial machine learning, AI red team methodology, data poisoning, model extraction, AI governance, secure AI architecture
Frequently Asked Questions
Who is this book for?
This book is written for security engineers, penetration testers, red teamers, blue teamers, SOC analysts, application security engineers, cloud security engineers, and AI or ML engineers who need to test, secure, or assess large language model applications. It assumes you already understand basic networking, Linux, HTTP, APIs, and common web security concepts, and builds the AI specific layer on top of that foundation.
Do I need to know machine learning to understand this book?
No. You do not need to know how to train a model to secure one. The book explains exactly what you need to know about how large language models, retrieval pipelines, and agents work at the level required to attack and defend them, without requiring a machine learning background.
Do I need programming experience?
Yes, basic Python is expected. Every lab in the book uses Python, Bash, Docker, and standard web request tooling such as curl. If you can read and modify a Python script, you can follow every exercise.
What will I actually be able to do after finishing this book?
You will be able to identify and reproduce prompt injection and jailbreak attacks, secure retrieval augmented generation pipelines and vector databases, design least privilege permissions for autonomous AI agents, evaluate model supply chain and fine tuning risk, build detection rules for AI specific attacks, and run a complete AI red team engagement using a repeatable methodology, from scoping through reporting.
Is this book only about prompt injection?
No. Prompt injection and jailbreaking are covered in depth early on, but the book goes much further, including RAG and vector database security, agent and tool permission design, model supply chain and backdoor risk, data poisoning, fine tuning security, privacy and membership inference, model extraction, infrastructure security, detection engineering, red teaming, continuous security testing, and incident response.
Is there a hands on lab, or is this just theory?
Every chapter includes a hands on lab. You build one AI application environment starting in chapter two and extend it through the rest of the book, adding a chat interface, a RAG pipeline, a vector database, an autonomous agent, and a detection pipeline as you go. By the final chapter you assess a deliberately vulnerable version of that same platform as a full capstone engagement.
What tools and software do I need?
Docker and Docker Compose, Python 3.11 or later, and a text editor or IDE. The book runs models locally through Ollama so you do not need to pay for API access to complete the labs, though it also shows how to test against hosted model APIs where relevant.
Is it legal and safe to follow the attacks in this book?
Yes, when used as intended. Every attack technique in this book is demonstrated against a lab environment you build and control yourself. The book is explicit throughout that nothing should be tested against any system you do not own or have written authorization to assess.
How is this different from reading OWASP or MITRE ATLAS documentation for free?
Frameworks like the OWASP Top 10 for LLM Applications and MITRE ATLAS are checklists and taxonomies, and this book uses both, but a checklist does not teach you how to reproduce an attack, build the lab to test for it, or write the code for the defense. This book is a working methodology with real code, real Docker configurations, and a continuous lab, not a list of vulnerability categories.
Does this cover AI agents and autonomous systems?
Yes, extensively. Two full chapters cover how agents change the threat model, how a small prompt injection can escalate into a full incident through excessive tool permissions, and how to design and progressively harden agent tool access using least privilege principles.
Will this book stay relevant as AI models and tools change?
The underlying vulnerability classes, architectural mistakes, and defense principles in this book are stable and do not depend on any single model or vendor. Specific tool commands and framework documentation are noted as subject to change, with guidance to verify current versions before relying on exact syntax.
What format does the book come in?
The book is delivered as a PDF, formatted for both screen reading and printing, with full syntax highlighted code, rendered architecture diagrams throughout, and a complete table of contents and index for reference use.
How long is the book and how is it organized?
Two hundred fifteen pages across twenty four chapters in five parts: foundations, offensive security, supply chain and model security, defensive engineering and operations, and assessment and production, plus end matter with checklists, a glossary, and further reading.
Is there a money back guarantee?
No. Because the PDF is delivered instantly, all sales are final (see our refund policy). If the file won’t download or open, email support@codelivly.com and we’ll fix it.
Do I get updates if new chapters or corrections are released?
Update policy is set by Codelivly. Check the product page for current terms on future revisions.
Related products
-

Python Hacking Recipes: The Pocket Edition (25 Tools You Can Run Today)
You’ll build tools for recon, OSINT, scanning, web exploitation, payload testing, analysis, automations, OPSEC, post-exploitation simulations,…
£ 19.99 Grab Yours -

Red Team Operator L1: Offensive Security for Beginners
Break into the world of offensive cybersecurity with practical, real-world Red Team skills. Whether you're an…
£ 29.99 Grab Yours -

Hack the Mind: The Psychology of Hacking
I wrote this book for everyone — not just tech experts. Whether you’re protecting a company…
£ 3.00 Grab Yours
Frequently asked questions
What does Hacking AI Systems cover?
Direct and indirect prompt injection, measured jailbreak evaluations, broken authorisation in AI tool calls, cross-tenant leakage in retrieval pipelines, exposed vector databases, over-privileged agents, model supply chain risk, backdoors and data poisoning, and memorisation and privacy risk in fine-tuned models.
Is it hands-on?
Yes. You build one lab in the first two chapters and extend it chapter by chapter with a chat interface, retrieval pipeline, vector database, agent with tools, fine-tuned model and monitoring layer. The book ends with a capstone assessment of a deliberately vulnerable version of that platform.
Who is it for?
Security engineers, penetration testers, red teamers and AI engineers who need to test and secure LLM applications, RAG pipelines and autonomous agents. The final part turns the techniques into a red team methodology mapped to MITRE ATLAS, a CI/CD evaluation pipeline and an AI incident response playbook.


Reviews
There are no reviews yet.