SSRF(Server Side Request Forgery)

Kapil Verma
3 min readJun 11, 2019


Server Side Request Forgery (SSRF) is a type of attack that can be carried out to compromise a server. The exploitation of an SSRF vulnerability enables attackers to send requests made by the web application, often targeting internal systems behind a firewall.

In easier and layman terms, Attacker asks the server to fetch a URL for him.

Let’s take an example of this below request:

GET /?url= HTTP/1.1

In the above request, we can see the Host is “” and the GET request is taking “url” as user input.

Now, one might ask, How is this even a vulnerability?
→ Now this “url” parameter is based on user input and is controlled by anyone using it. If proper protection is not done, an attacker can use this little “url” parameter to make requests to internal service, for example, local IP-address, which are not publicly accessible from the internet.

Types of SSRF -
i. Basic SSRF: Here the response is displayed to the attacker.
ii. Blind SSRF: Here the response is not displayed to the attacker(Difficult to detect at first sight)

What can we do with SSRF?
1. SSRF to Reflected XSS
2. Try URL schemas to read internal and make server perform actions (file:///, dict://, ftp://, gopher://..)
3. We can scan for internal networks and ports.
Well, the list is endless and left for your creativity.

Now, I will explain these 3 attacks below:
1. SSRF to Reflected XSS:
Well, it’s not as difficult as it sounds, and many of my more brilliant readers would have already got the idea.
Anyway, for the ones who are still wondering, It’s way too simple, Just fetch a file from an external server which has malicious payload with content type served as HTML.
Example — http://localhost:9999/?url=
2. Testing URL schemas:
The first thing to do when we find an SSRF is to test all the wrapper which are working, if the server blocks one wrapper, go and try another. if it’s your lucky day you might find one wrapper not blacklisted.


i. file:// -
File is used to fetch a file from the file system.


ii. dict://-
DICT URL scheme is used to refer to definitions or word lists available using the DICT protocol:$ nc -lvp 1337
Connection from [] port 1337 [tcp/*] accepted (family 2, sport 31126)
CLIENT libcurl 7.40.0

iii. sftp:// -
Sftp stands for SSH File Transfer Protocol, or Secure File Transfer Protocol is a separate protocol packaged with SSH that works in a similar way over a secure connection.$ nc -lvp 1337
Connection from [] port 1337 [tcp/*] accepted (family 2, sport 37146)

iv. ldap:// or ldaps:// or ldapi:// -
LDAP stands for Lightweight Directory Access Protocol. It is an application protocol used over an IP network to manage and access the distributed directory information service. pi://localhost:1337/%0astats%0aquit

v. tftp:// -
Trivial File Transfer Protocol is a simple lockstep File Transfer Protocol which allows a client to get a file from or put a file onto a remote host nc -lvup 1337
Listening on [] (family 0, port 1337)

vi. gopher:// -
Gopher is a distributed document delivery service. It allows users to explore, search and retrieve information residing on different locations in a seamless fashion. (host it on

header(‘Location: gopher://’);
?> nc -lvp 1337
Listening on [] (family 0, port 1337)
Connection from [] port 1337 [tcp/*] accepted (family 2, sport 49398)

3. Testing internal ports:
We can manually check for internal ports/servers if they are running in their LAN, which are not directly accessible from the internet.
Sometimes if an internal host is running any outdated service/software which has RCE vulnerability, we can use SSRF to perform RCE and the same thing applies for other vulnerabilities as well.



Kapil Verma

Security researcher, Blogger, Bug Bounty hunter