PART I: HOW WEB API SECURITY WORKS
Chapter 0: Preparing for Your Security Tests
Chapter 1: How Web Applications Work
Chapter 2: The Anatomy of Web APIs
Chapter 3: Common API Vulnerabilities
PART II: BUILDING AN API TESTING LAB
Chapter 4: Your API Hacking System
Chapter 5: Setting Up Vulnerable API Targets
PART III: ATTACKING APIs
Chapter 6: Discovery
Chapter 7: Endpoint Analysis
Chapter 8: Attacking Authentication
Chapter 9: Fuzzing
Chapter 10: Exploiting Authorization
Chapter 11: Mass Assignment
Chapter 12: Injection
PART IV: REAL-WORLD API HACKING
Chapter 13: Applying Evasive Techniques and Rate Limit Testing
Chapter 14: Attacking GraphQL
Chapter 15: Data Breaches and Bug Bounties
Appendix A: API Hacking Checklist
Appendix B: Additional Resources
An Application Programming Interface (API) is a software connection that allows applications to communicate and share services. Hacking APIs will teach you how to test web APIs for security vulnerabilities. You’ll learn how the common API types, REST, SOAP, and GraphQL, work in the wild. Then you’ll set up a streamlined API testing lab and perform common attacks, like those targeting an API’s authentication mechanisms, and the injection vulnerabilities commonly found in web applications. In the book’s guided labs, which target intentionally vulnerable APIs, you’ll practice:
- Enumerating API users and endpoints using fuzzing techniques
- Using Postman to discover an excessive data exposure vulnerability
- Performing a JSON Web Token attack against an API authentication process
- Combining multiple API attack techniques to perform a NoSQL injection
- Attacking a GraphQL API to uncover a broken object level authorization vulnerability
By the end of the book, you’ll be prepared to uncover those high-payout API bugs that other hackers aren’t finding, and improve the security of applications on the web.
"We all know that moment, it’s the one when we’ve been breaking into the target site and hit the motherload… the crown jewels, the beating heart that you now have mastery over… It’s a giddy feeling, one of relief, and of anticipation. THOSE same feelings course through the veins as you dig deeper and deeper into this book. From the outset it’s written in a manner that’s conversational, informative, engaging, and educational to a point where I’m sitting with the highlighter and page mark (something I’ve NOT done in a long time).
Corey Ball takes you on a journey through the lifecycle of APIs in such a manner that you’re wanting to not only know more, but also anticipating trying out your newfound knowledge on the next legitimate target. From concepts to examples, through to identifying tools and demonstrating them in fine detail, this book has it all. It IS the motherload for API hacking, and should be found next to the desk, well-read by ANYONE wanting to take this level of adversarial research, assessment, or DevSecOps seriously."
—Chris Roberts, @Sidragon1, vCISO/Researcher/Hacker
"This book opens the doors to the field of API Hacking, a subject not very well understood. Using real-world examples that emphasize Access Control issues, this book will help you understand the ins and outs of securing APIs, hunt great bounties, and help organizations improve their API Security!"
—Inon Shkedy, @InonShkedy, Security Researcher
"Even though the internet is filled with information on any topic possible in cybersecurity, it is still hard to find solid insight on performing penetration tests on APIs. Corey's book satisfies this demand—not only for the beginner cybersecurity practitioner, but also for the seasoned expert."
—Cristi Vlad, @CristiVlad25, Cybersecurity Researcher
"Hacking APIs is extremely helpful for anyone who wants to get into penetration testing. In particular, this book gives you the tools to start testing the security of APIs, which are becoming a weak point for many modern web applications. Experienced security folks can get something out of the book too, as it features automation tips and protection bypass techniques that will up any pentesters' game."
—Vickie Li, @vickieli7, Developer Evangelist, Author of Bug Bounty Bootcamp
"[Hacking APIs is] the best source of API info I've seen. If you're curious about what APIs are and how they work, read it once. If you work with or create APIs, read it twice. If you break APIs, read it three times."
—Graham Helton, @GrahamHelton3
"One of the few books that is actually dedicated to API hacking. . . . a great resource for anyone who wants to learn more about API security and how to hack into web applications. It provides in-depth information on how to break through various types of APIs, as well as tips on how to stay ahead of the curve in this rapidly changing field."
—Dana Epp, Security Boulevard
"This book has more to offer than hacking APIs but sets down a solid foundation of tools and techniques that would benefit any developer or QA Engineer that has to develop, test, or otherwise work with APIs."
—John Wenning, Cybersecurity Researcher, Fortra
"Well-written and expertly laid out. . . . I didn’t feel the need to reference other books while reading this one, and I don’t think anyone would, regardless of their experience in cybersecurity – the book is very self-contained. My favourite part of the book was Appendix A, the API Hacking Checklist. Not only did you get a laid out, step-by-step list of actions to take, the section headers referenced specific chapters and the individual items referenced specific pages. This is a handy tool for anyone starting out in this area. . . . 5/5."
—Tyler Reguly, Manager of Software Development, Tripwire
"A thorough guide to what APIs are, how they work, what technologies they use, the various common insecurities that APIs have, and, most importantly, how to exploit them. . . . I would recommend Hacking APIs as a great read for anyone interested in learning more about the vulnerable side of APIs. It would also be a fantastic reference to use when actively pentesting APIs."
—Darlene Hibbs, Senior Cybersecurity Researcher, Fortra
Winner of the SANS Difference Makers Award for Cybersecurity Book of the Year, 2022
Read an interview with Corey about web APIs on The Daily Swig.
View the latest errata.