portswigger-all-labs

Complete PortSwigger Web Security Academy Lab Writeups Detailed, categorized solutions for every lab — from APPRENTICE to EXPERT — covering all 30 vulnerability types.

View on GitHub

API Testing

Lab Levels

Jump directly to the lab writeups:

Introduction

APIs (Application Programming Interfaces) enable systems and applications to communicate and share data. Due to their central role in dynamic websites, vulnerabilities in APIs can affect the confidentiality, integrity, and availability of core services.

This section focuses on identifying and exploiting vulnerabilities in RESTful and JSON-based APIs, including classic bugs like SQL injection and server-side parameter pollution (SSPP) in internal APIs.


Why API Testing Matters

Modern web applications heavily rely on APIs. Even if an API isn’t directly exposed on the frontend, it may still process sensitive operations. Learning to test these hidden endpoints can help uncover deep flaws in application logic or access control.


Key Concepts

API Reconnaissance

Example endpoint:


/api/books/mystery

This might return a filtered list of mystery books from a library.


API Documentation

API Documentation Paths Example
Figure: Example of fuzzing common API documentation paths

If you identify an endpoint for a resource, make sure to investigate the base path.
For example, if the resource endpoint /api/swagger/v1/users/123 exists, investigate related paths.

API Base Path Investigation
Figure: Investigating the base path to discover additional API endpoints


Preventing Vulnerabilities in APIs

To avoid vulnerabilities, developers should:


Reference

Original source: PortSwigger – API Testing