Description
API Reconnaissance
Directory and Subdomain Analysis
Look for API indicators in directory names like ```bash
/api, /api/v1, /v1, /v2, /v3, /rest, /swagger, /swagger.json, /doc, /docs, /graphql, /graphiql, /altair, /playground. ```
Subdomains like ```bash
api.target-name.com, uat.target-name.com, dev.target-name.com, developer.target-name.com, test.target-name.com can indicate web APIs. ``` Monitor HTTP Responses for statements like `{"message": "Missing Authorization token"}`.
Third-Party Sources
Leverage third-party sources like GitHub, Postman Explore, ProgrammableWeb API Directory, APIs Guru, Public APIs GitHub Project, and RapidAPI Hub for information on APIs.
Passive Reconnaissance
Google Dorking
Utilize Google Dorking with queries such as ```bash inurl:"/wp-json/wp/v2/users" and intitle:"index.of" intext:"api.txt" ``` to find publicly available API directories and key files.
GitDorking
Search for files like swagger.json using GitDorking, and employ tools like Trufflehog for additional security checks.
Shodan
Use Shodan queries like
hostname:"targetname.com" and "content-type: application/json"
to identify APIs based on domain and content type.
The Wayback Machine
Check for differences between the API documentation. Later, when you are actively testing the API, make sure to test using old endpoints
Active Reconnaissance: process of interacting directly with the target
Nmap
Use Nmap for active API reconnaissance with commands likenmap -sC -sV ip nmap -p- ip -> allportscanAmass
```bash
amass enum -active -d domain name
sudo nano ~/.config/amass/config.ini` to add keys or secret to amass
amass enum -active -d target-name.com |grep api
3. `Directory Brute-force with Gobuster`
```bash
`gobuster dir -u http://targetname -w wordlist`
`$ gobuster dir -u http://targetaddress/ -w /usr/share/wordlists/api_list/common_apis_160 -x 200,202,301 -b 302`
-
DevTool
navigate network and pressCtrl+rto refresh to get api end point orurl
tointeractwith url press right click on it and choosecopy as Curlthen openPostman
then click onimportchooseraw textthen import it -
Kiterunner (kr)
tool available for discovering API endpoints and resources
```bash
kr scan HTTP://127.0.0.1 -w ~/api/wordlists/data/kiterunner/routes-large.kite`
kr brute