Importing API Steps
- Find an API: Use the browser's Inspector Mode to locate JSON data.
- Copy the request: Extract the request using the cURL command.
- Create a new collection: Open Postman and create a new collection to organize your requests.
- Import the request in Postman: Use the Import button in Postman to add the copied request.
Capturing Requests
Steps:
- Select Website: Identify the target website you want to analyze.
- Select Port: Determine the appropriate port for the website (usually port 80 for HTTP and port 443 for HTTPS).
- Visit the Targeted Website: Open the port in your browser and navigate to the website.
- Make Various Requests: Interact with different parts of the website (e.g., visit various pages, manage your account, change your email and password).
- Collect Data: After gathering the necessary data, identify all the URLs that contain API calls and add them to your collection.
- Organize Requests: Group related requests into folders for better organization within Postman.
SWAGGER FILE Generation with MITMproxy (MITMweb)
Pre-steps:
- Launch mitmweb: Start the MITMproxy tool and intercept traffic.
Steps:
- Visit the Targeted Website: Use the designated port in your browser to access the site.
- Make Various Requests: Interact extensively with the site to collect traffic data.
- Save Collected Data: Return to mitmweb and save the intercepted traffic data.
Converting the File to Swagger:
sudo mitmproxy2swagger -i ~/Download/FILE-SAVED -o output-file.yml -p WEBSITE -f flow --examples
- Edit the Output File: Open the output file using a text editor (e.g.,
nano
) and customize it. Remove theignore:
lines for any elements related to the API. - Change the Title: Modify the title if necessary and save the file.
- Run the Command Again: Convert the file again to ensure your changes are applied.
sudo mitmproxy2swagger -i ~/Download/FILE-SAVED -o output-file.yml -p WEBSITE -f flow --examples
- Load the Swagger File: Go to Swagger Editor (opens in a new tab) to check if you have access to more information than the API intended to expose. You can also create cURL links to test the API.
- Import the .YML into Postman: Once you’ve finalized your Swagger file, import it into Postman.
Authentication (To Review)
- Bearer Token: Ensure you understand how to use Bearer tokens for authentication purposes.
Collections / Environments / Categories and Variables (To Review)
- Find and Replace: Learn how to manage variables within Postman.
- Variables: Understand how to create and use variables for dynamic requests.
- Collections: Organize your API requests into collections for easy access.
- Environments: Set up environments to manage different sets of variables.
- Categories: Use categories to further organize your requests.
Exploitation
- API Authentication Attacks: Understand common attack vectors for API authentication.
- Exploiting API Authorization: Learn about potential weaknesses in API authorization mechanisms.
- Improper Asset Management: Identify and exploit vulnerabilities due to poor asset management.
Proxy to Burp Suite
- Utilize Burp Suite to analyze and manipulate API requests for testing purposes.