Server-side request forgery (SSRF)
PortSwigger Web Security Academy · Apprentice
- #SSRF

Basic SSRF Against the Local Server
The vulnerability
The stock check loads a URL that comes from your browser. You replace it with http://localhost/admin, and the server opens the admin page for you.
Fix: Don’t take the URL from the request. If you have to, only allow known addresses.
The lab
This lab has a stock check feature which fetches data from an internal system.
To solve the lab, change the stock check URL to access the admin interface at
http://localhost/adminand delete the user carlos.
Solution
1. View a Product and Check Stock: On the website, browse to a product detail page and click “Check stock.”
2. Intercept the Stock Check Request: In Burp Suite’s Proxy → HTTP history, find the POST /product/stock request. The request body contains an encoded URL in the stockApi parameter. Right-click and Send to Repeater.
3. Access the Local Host: In Repeater, change the stockApi URL to http://localhost. Send the request. The HTTP/2 200 OK response confirms you have accessed the local server's root directory, which will contain a link to the admin panel.
4. Access the Admin Panel: Change the stockApi URL to http://localhost/admin and send the request. The HTTP/2 200 OK response confirms you have accessed the admin panel.
5. Delete the Target User: Change the stockApi URL to http://localhost/admin/delete?username=carlos. Send the request. An HTTP/2 302 Found response indicates that the user carlos has been deleted, and the lab is solved.
Basic SSRF Against Another Back-End System
The vulnerability
The same bug, but the admin page is on another machine in the internal network. Burp Intruder tries all the addresses until one answers.
Fix: Only allow known addresses, and block requests to the internal network.
The lab
This lab has a stock check feature which fetches data from an internal system.
To solve the lab, use the stock check functionality to scan the internal
192.168.0.Xrange for an admin interface on port8080, then use it to delete the user carlos.
Solution
1. View a Product and Check Stock: On the website, browse to a product detail page and click “Check stock.”
2. Intercept the Stock Check Request: In Burp Suite’s Proxy → HTTP history, find the POST /product/stock request. The request body contains an encoded URL in the stockApi parameter. Right-click and Send to Repeater.
3. Test for SSRF: In Repeater, change the stockApi URL to http://localhost. An HTTP/2 500 Internal Server Error response confirms the application attempts to connect to a different internal service.
4. Brute-Force the Internal IP Range: Right-click the request and Send to Intruder.
- In the
Positionstab, set thestockApiURL tohttp://192.168.0.§0§:8080/admin. Mark only the0in the IP address as a payload position. - In the
Payloadstab, selectNumbersas the payload type. Configure the range from1to255with a step of1.

- Start the attack.
5. Identify the Admin Panel: After the attack is complete, sort the results by Status code. Look for a HTTP 200 OK response. The payload for this request will reveal the correct internal IP address (e.g., 245), confirming that an admin panel exists at http://192.168.0.245:8080/admin.

6. Delete the Target User: Go back to Repeater and set the stockApi URL to http://192.168.0.245:8080/admin/delete?username=carlos. Send the request. An HTTP/2 302 Found response indicates that the user carlos has been deleted, and the lab is solved.