API Testing
API testing is a type of software testing that focuses on testing the application programming interfaces (APIs) that are used within software applications. APIs define how different software components should interact with each other, and they are commonly used for communication between different software systems, services, or modules.
API security involves putting policies in place to protect the availability, confidentiality, and integrity of data. In order to protect data both in transit and at rest, these precautions include putting in place encryption and other security protocols as well as authentication and authorization mechanisms that limit access to the API to authorized users and applications.
API Recon
We first need to gather information about the API to discover the attack surface and find out the endpoints. API endpoints are locations where an API receives requests from specific resources on its server like GET requests.
GET /api/v1/products HTTP/1.1
Host: myproduct.com
After finding one possible API endpoint, we can look for another possible endpoint also for example if the API endpoint for this request is api/v1/products. We can find another endpoint using different fuzzing techniques, softwares and can find the api/v1/products/iphones which would list the products of iphones.
API testing & fuzzing tools;-
- Postman
- SoapUI
- Burp Scanner
- ffuf
ffuf -u https://FUZZ.api.example.com -w wordlist.txt
ffuf -u https://api/FUZZ.example.com -w wordlist.txt
5. Google Dorks
Get ranar0san’s stories in your inbox
Join Medium for free to get updates from this writer.
site:*.api.example.com
site:api.*.example.com
site:*.api.*.*
site:api.*.*.*
site:*.api.*.com
site:api.*.*.com
site:*.api.*.org
site:api.*.*.com
API Documentation
APIs are documented in both human-readable format and machine-readable format. Human-readable formats of APIs are documented so that developers can use and interact with them. It includes the example on how to use it and an explanation of how the api is interacting with the application.
Machine-readable formats of APIs documentation are written structured in JSON or XML formats which are designed to be processed by the application for automating tasks like API validation and integration.
API documentation is publicly available, so that the external developers can interact with the application API but using that attacker can gain advantage and can perform malicious activities using API endpoints in application.
Interacting with API endpoints
Once we identified the api endpoint we should interact with the api how it behaves and show the response in the application side changing different parameters checking the response of every endpoint. Also check all the possible HTTP requests like;
GET, POST, PUT, DELETE, OPTIONS, HEAD, PATCH
Identify all supported content-type
The Content-Type header indicates the media type of the resource being sent or requested via the HTTP request or response. It specifies the format of the data in the request body or the response payload. The most commonly supported Content-Type values in API testing include:
Content-Type: application/json
Content-Type: application/xml
Content-Type: application/x-www-form-urlencoded
Content-Type: text/html
Content-Type: text/plain
Content-Type: text/xml
Finding hidden parameters
Hidden parameters are those parameters that may not be explicitly documented or easily visible in the API documentation but are still essential for the proper functioning of the API. Finding hidden parameters involves exploring the API endpoints thoroughly to identify all the parameters that can affect the behaviour of the API.
/api/v1/user?id=test
/api/v1/user?name=test
/api/v1/user?uuid=test
/api/v1/status?live=test
/api/v1/status?verbose=test
We can fuzz the api endpoints to find more hidden parameters using tools like ffuf.
ffuf -X POST -u https://target.com/api/items?test=FUZZ -w wordlist.txt -fs 120
API testing is a crucial aspect of software testing, focusing on the interfaces that enable communication between different software components. Security measures such as encryption, authentication, and authorization are essential for safeguarding API data. API Recon involves identifying API endpoints using various techniques and tools like fuzzing. Tools like Postman, SoapUI, and Burp Scanner aid in API testing and fuzzing.
APIs are documented for developers in both human-readable and machine-readable formats. Interacting with API endpoints involves testing various HTTP request methods and identifying supported content types. Finding hidden parameters requires thorough exploration of API endpoints and can be facilitated by fuzzing tools like ffuf. Understanding and effectively testing APIs is critical for ensuring the reliability and security of software applications.







