ZAP Scanner & other scanning methods
Scan API


Import the right-click on the root and choose to do an active scan.
Authenticated scan
Use the Manual Explore option.

Set the URL to your target, make sure the HUD is enabled, and choose "Launch Browser"
Visit all pages and perform all action then launch active scan: "attack mode on"

Scan API using nuclei and Burp
Obtain the OpenAPI documentation of your target - either the API provides this on their documentation website, or you can search for it on SwaggerHub, or you can use a "API reverse engineering" tool like Burp2API or Postman Interceptor. I suggest using OpenAPI version 3 because Nuclei will look for the "servers" tag within the documentation, and version 2 don't have it
Set up Burp listening interfaces - if we want to proxy traffic from Nuclei Docker through the Burp instance that runs on our host OS we have to make sure that Burp listens to all interfaces as shown below

Pull Nuclei Docker image and run the container - for this I use DockerDesktop on Windows and run the command within its terminal. The
host.docker.internalin the-proxyis how we tell Docker to use the Host as a proxy. If you use Windows/Linux you won't have to change itUpdate the API Servers - open the OpenAPI Documentation and search for the
serverstag -> make sure to set the domain where the API is hosted:Update the volume path -
-v "C:\path\to\openapi.json:/openapi.json") to match the place where you saved the OpenAPI documentation on the host OSUpdate the variables values - add/remove the variables (
-V "Authorization=123") based on your OpenAPI requirements. Additionally you can add the-skip-format-validationflag. Nuclei will throw an error if it can't find a mandatory variableMatch & Replace in Burp - Add a
match & replacerule in Burp to inject yourAuthorizationtokens, CSRF tokens and any other HTTP header that may be required. For whatever reason the-V "Authorization=123"didn't do that, but we can use Burp -> Automodifying Requests on the FlyEnable Burp Extensions - before you proceed with the Nuclei scan, you can also enable Collaborator Everywhere and Autorize to increase chances of finding SSRF and Broken Authorization/Authentication vulnerabilities
Now you should have all the endpoints documented in the OpenAPI file automatically tested by Nuclei & Burp Extensions

Scan using Nuclei
Start to get all the API endpoints
API Discovery / RecoScan without authentication
Scan with token authentication
Nuclei API Custom Templates
Broken User Authentication
Excessive Data Exposure
Lack of Resources & Rate Limiting
Mass Assignment
Mass AssignmentInteresting Books
Interesting BooksHacking APIs: Breaking Web Application Programming Interfaces A crash course in web API security testing that will prepare you to penetration-test APIs, reap high rewards on bug bounty programs, and make your own APIs more secure.
Black Hat GraphQL: Attacking Next Generation APIs This hands-on book teaches penetration testers how to identify vulnerabilities in apps that use GraphQL, a data query and manipulation language for APIs adopted by major companies like Facebook and GitHub.
Support this Gitbook
I hope it helps you as much as it has helped me. If you can support me in any way, I would deeply appreciate it.
Last updated
