SSRF (Server-Side Request Forgery) is a web security vulnerability where an attacker tricks a vulnerable server into making HTTP(S) requests on the attacker’s behalf. Instead of the attacker directly contacting a target, they supply a malicious URL or resource identifier to the application; the server then fetches that resource, potentially exposing internal services, metadata endpoints, or other sensitive systems.
In the above fig, you can observe that attacker sends Crafted Packet A to the publicly available server, and to fulfill the users query public server sends the request to the back end server with Packet B, as this request comes from the public server back end server would trust that Packet B coming from the internal network and accept the packet and send a response. This is possible because the attacker makes the request on behalf of other servers.
How SSRF Works
Server-Side Request Forgery (SSRF) is a web vulnerability that occurs when an application accepts a user-supplied URL or request parameter and makes a server-side request on the user’s behalf — without proper validation or restrictions
1. User Input Accepted
- The application exposes a feature that accepts a URL, IP, or domain (e.g., fetch an image, import data, configure a webhook).
http://vulnerable.com/fetch?url=http://example.com/image.png2. Server Makes the Request
- Instead of validating or restricting the input, the server directly fetches the provided URL.
- The attacker modifies the input to point to an unexpected target.
3. Accessing Internal/Restricted Resources
- Because the request originates from the server, it can reach internal addresses (e.g.,
127.0.0.1,localhost, private IP ranges).
http://vulnerable.com/fetch?url=http://127.0.0.1/admin4. Unauthorized Data Access
The server’s response may leak sensitive information:
- Internal admin panels
- Database endpoints
- Cloud metadata services (AWS:
http://169.254.169.254/latest/meta-data/)
5. Attack Escalation
With the information gathered, attackers may be able to:
- Steal sensitive credentials or tokens: for example, cloud access keys, API tokens, or session cookies that the server has access to.
- Perform internal port scanning: using the vulnerable server to map hidden services and identify open ports within the internal network.
- Pivot to Remote Code Execution (RCE): if one of the discovered internal services is vulnerable, attackers can move from SSRF to full system compromise.
Types Of SSRF
Here are the different types of SSRF:
1. Blind SSRF:
In a Blind SSRF attack:
- The attacker cannot see the actual response (data) from the internal network.
- They can only control the IP address and port that the vulnerable server connects to.
- The attack is carried out by feeding a crafted URL in the format:
- The attacker supplies different target addresses/ports and infers results from response codes, timeouts, or callbacks (DNS/HTTP).
Example :
http://example.com:1337
http://example.com:9923
http://example.com:43
http://example.com:22
2. Limited Response / Partial SSRF :
In this type of SSRF:
The attacker receives a limited response from the server, such as:
- Only the page title
- Response codes (200, 403, 500, etc.)
- Partial access to internal resources (but not the full content)
The attacker can control only certain parts of the request packet that the server sends to an internal application.
This can still be exploited to:
- Read local system files using the
file://protocol (e.g.,/etc/config,/etc/hosts,/etc/passwd). - Access restricted resources without directly seeing their data.
In some scenarios, Partial SSRF can be chained with other attacks, such as:
- XXE (XML External Entity injection): to disclose more sensitive data
- DoS (Denial of Service): to overload the server
Other misconfigurations that expand the attack surface
Example :
file:///etc/hosts
file:///etc/config
file:///etc/passwd
3. Full Response SSRF :
In a Full SSRF attack:
- The attacker has complete control over Packet B (the request that the vulnerable server sends).
- This means they can directly interact with services running on the internal network.
- Unlike Blind or Partial SSRF, here the attacker sees full responses from the server.
Capabilities of Full SSRF
Access internal services and APIs not exposed to the internet. Use multiple protocols for exploitation, such as:
http://:Access web servicesfile://:Read local files (e.g.,/etc/passwd)dict://:Interact with dictionary servicesgopher://:Send raw payloads to internal services
Example :
http://192.168.1.8/BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
Hands-On SSRF
here is a polished, ready-to-paste version of your step-by-step process for solving the PortSwigger SSRF lab (deleting user carlos):
Step 1: Open the Lab
- Launch the PortSwigger SSRF Lab 1 from the Web Security Academy.
Use the following link to launch the PortSwigger lab: Basic SSRF against the local server
- The lab provides a shopping website with a stock checker function.

Step 2: Identify the Vulnerable Parameter
- Click on a product and check stock availability.

- Intercept the request in Burp Suite Proxy.

- You will see a request like this:
POST /product/stock HTTP/2
Host: 0a5a004103dd133d83e16f40008900da.web-security-academy.net
Cookie: session=wAPnzoCooHawImB5YNX63ywiT2YVWaol
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0
Referer: https://0a5a004103dd133d83e16f40008900da.web-security-academy.net/product?productId=1
Content-Type: application/x-www-form-urlencoded
Content-Length: 107
Origin: https://0a5a004103dd133d83e16f40008900da.web-security-academy.net
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
stockApi=http%3A%2F%2Fstock.weliketoshop.net%3A8080%2Fproduct%2Fstock%2Fcheck%3FproductId%3D1%26storeId%3D1
- Notice the parameter
stockApi:this is where the SSRF vulnerability exists.
stockApi=http%3A%2F%2Fstock.weliketoshop.net%3A8080%2Fproduct%2Fstock%2Fcheck%3FproductId%3D1%26storeId%3D1Step 3: Exploit Internal Services
- Now replace the
stockApiwith an internal service URL, such as:
stockApi=http://localhost/admin- The server fetches the
/adminpage from its internal host.

- If successful, you gain access to restricted internal resources.
Step 4: Delete the user carlos
- When attempting to delete the user
carlos, you will see an endpoint like:
/admin/delete?username=carlos- However, if you simply forward this request, nothing will happen. The reason is that the request is being sent from your browser, where you are not authenticated as an administrator.
- To exploit this, you must instead send the request through the SSRF vulnerability (using the
stockApiparameter). This way, the request originates from the vulnerable server itself, which has access to the internal admin interface.

- Replace the
stockApivalue with the delete endpoint on localhost:
https://localhost/admin/delete?username=carlos
- Send the modified request via Burp Repeater (or forward it).
- The server (which has access to
127.0.0.1/admin) will process the request as if it came from the internal network.
Step 5: Confirm Lab Completion
- If successful, the server responds that the user
carloshas been deleted. - The PortSwigger lab banner will display: “Congratulations, you solved the lab!”

Key Points To Test SSRF Vulnerability
Here are some keypoints to test SSRF Vulnerability:
- Always make sure that you are making requests to back end server on the behalf of public server, not from the browser.
- To fetch the data from the server also try http://localhost/xyz/ with http://127.0.0.1/xyz.
- The server may have firewall protection always try to bypass the firewall if possible.
- Make sure that the request is coming from the server, not from your local host.
Potential Blocks During Testing SSRF Vulnerability
Given below the potential block during testing SSRF Vulnerabilty:
- Whitelisting: Server only allows a few domain names to be used in the request, the server has a white list of the domain if the domain name from that list matches with a domain name from the request then only accept the request otherwise server decline the request.
- Blacklisting: Server discard all the request containing IP addresses, domain names, and keywords from the blacklist of the server.
- Restricted content: Server allows to access the only a particular amount of files to the user, it allows only a few file extension types for public access.

