root@thehacksparrow:~/writeups$ SYSTEM ONLINE
root@sparrow:~/writeups$ cat intro-to-ssrf.md
// Offensive

Intro to SSRF

28 Nov 2026 · 7 min read
Overview — An Easy offensive room that introduces Server-Side Request Forgery (SSRF): what it is, the difference between regular and blind SSRF, where to look for it, how deny lists and allow lists get bypassed, and a final hands-on scenario in which a customer avatar feature is abused to make the server fetch a restricted internal path. The practical combines a deny-list bypass with a simple path-traversal trick.
PlatformTryHackMe
CategoryOffensive
DifficultyEasy
RoomIntro to SSRF

Attack map

[Avatar form]  radio value = server-side path (assets/avatars/1.png)
   |  server fetches it and returns the bytes as a base64 data URI
   v
[Tamper]  value -> private
   |  blocked: deny list rejects paths that START with /private
   v
[Bypass]  value -> x/../private  (normalised to /private after the check)
   |  server fetches the restricted endpoint on our behalf
   v
[Loot]  base64 data URI in page source  ->  base64 -d  ->  FLAG

Task 1 — What is an SSRF?

In a normal request your browser talks to the web server. In Server-Side Request Forgery you persuade the server to send an extra (or modified) HTTP request to a destination you choose. That matters because the server usually sits in a very different network position from you: it can reach localhost, internal admin panels, databases, microservices and cloud metadata endpoints that are invisible or blocked from the internet. The request also carries the server's own identity, so IP-based access controls ("only the internal network may see this") are trusted blindly.

There are two flavours:

  • Regular (in-band) SSRF — the response from the forged request is returned to you, so you can read whatever the server fetched.
  • Blind SSRF — the server makes the request but nothing comes back. You only learn it worked through side channels, such as an out-of-band callback to a host you control, or a timing difference.

Typical impact: reaching unauthorised areas, reading organisational or customer data, pivoting into the internal network, and leaking tokens or credentials (especially from cloud metadata services).

Q: What does SSRF stand for?
A: Server-Side Request Forgery

Q: As opposed to a regular SSRF, what is the other type?
A: Blind

Task 2 — SSRF Examples

The room ships an interactive site that walks through classic SSRF patterns and ends with a small simulation. The recurring pattern is a request such as https://website.thm/item/2?server=api.website.thm, where a query parameter tells the front-end which back-end host to ask for the data. Whoever controls that parameter controls the destination of the server's request.

The challenge is to make the web server return data from server.website.thm/flag?id=9 instead of the item it normally fetches. Replacing the server value with that host and path does it. The simulation also accepts a trailing &, which suggests the application tacks extra text onto the back-end URL; ending your value with & (or a throw-away parameter) would turn that leftover text into a separate, harmless parameter:

https://website.thm/item/2?server=server.website.thm/flag?id=9&
The trick generalises: when user input is concatenated into a back-end URL, look at what the application adds after your input and neutralise it with a query delimiter (&, #) or a dummy parameter.

Q: What is the flag from the SSRF Examples site?
A: FLAG

Task 3 — Finding an SSRF

SSRF hides in any feature where the application fetches something on your behalf. Four places to check first:

  • A full URL in a parameter — e.g. ?url=http://..., ?image=..., ?webhook=....
  • A hidden form field carrying a URL or host, which you can edit in the browser's inspector.
  • A partial URL — just a hostname (?server=api.site.thm) or a path that the server completes. Harder to exploit because you control only part of the request.
  • A path appended to a fixed base URL by the server (the avatar example in Task 5).

Finding a candidate is mostly observation: which parameters look like they name a host, port, file location or URL? In the room's multiple-choice question the clear candidate is the one that passes a storage server name and port to a file-fetching script, because the server must connect to that name and port itself; a category ID or an item quantity is just data.

For blind SSRF you need to see inbound connections. Use an external request catcher, your own HTTP listener, or Burp Suite's Collaborator client, point the vulnerable parameter at it, and watch for the callback.

# minimal listener to catch blind callbacks (run on a host the target can reach)
python3 -m http.server 8000

Q: Based on simple observation, which of the following URLs is more likely to be vulnerable to SSRF? (index.php / list-products.php?categoryId=5325 / fetch-file.php?fname=242533.pdf&srv=filestorage.cloud.thm&port=8001 / buy-item.php?itemId=213&price=100&q=2)
A: 3

Task 4 — Defeating Common SSRF Defenses

Developers who know about SSRF usually validate the destination. Validation comes in two shapes, and each has a characteristic weakness.

Deny lists

A deny list accepts everything except known-bad values, such as localhost, 127.0.0.1 or the cloud metadata address. It is fragile because the same destination can be written in many ways:

TechniqueExamples
Alternative loopback notations0, 0.0.0.0, 127.1, 127.0.0.2 (the whole 127.0.0.0/8 block is loopback), decimal 2130706433, octal 017700000001
DNS that resolves to loopbackany name whose A record is 127.0.0.1, such as 127.0.0.1.nip.io, or a subdomain you register yourself
Cloud metadata addressblock 169.254.169.254? Point an attacker-owned DNS record at it instead

The metadata IP 169.254.169.254 deserves special mention: on cloud providers it serves instance data and often temporary credentials, which makes it a prime SSRF target. A filter that only checks the literal string is bypassed by a hostname that resolves to it.

Allow lists

An allow list rejects everything except approved values, for example "the URL must start with https://website.thm". It is stronger, but naive string checks fail. A hostname such as https://website.thm.attackers-domain.thm begins with the approved text yet belongs to the attacker, so the application happily lets the attacker steer the internal request. Robust validation parses the URL and compares the real hostname, not a prefix.

Open redirects

If both defences hold, an open redirect can still help. Suppose https://website.thm/link?url=https://tryhackme.com exists to count outbound clicks. If the SSRF filter only requires URLs to begin with https://website.thm/, you submit the redirect endpoint as the "allowed" URL; the server fetches it, receives a redirect, follows it to the destination you embedded, and the allow list never sees the final target. (This works only if the HTTP client follows redirects.)

Q: What method can be used to bypass strict rules?
A: Open Redirect

Q: What IP address may contain sensitive data in a cloud environment?
A: 169.254.169.254

Q: What type of list is used to permit only certain input?
A: Allow List

Q: What type of list is used to stop certain input?
A: Deny List

Task 5 — SSRF Practical

The scenario is a fictional "Acme IT Support" site. Content discovery turned up two interesting endpoints: /private, which refuses to be viewed from our IP address, and /customers/new-account-page, a new page that lets customers pick an avatar. Target: MACHINE_IP.

Step 1 — Understand how the avatar feature works

Register a customer account at /customers/signup, sign in, and open /customers/new-account-page. In the page source each avatar option is a radio button whose value is a server-side path:

<div class="avatar-image" style="background-image: url('/assets/avatars/1.png')"></div>
<input type="radio" name="avatar" value="assets/avatars/1.png">

Choose an avatar and press Update Avatar. Viewing the source again shows the current avatar embedded as a data:image/png;base64,... URI. That tells us what happens behind the scenes: the server takes our avatar value, reads that path itself, base64-encodes the response and inlines it into the page. We control a path that the server fetches and then shows us the result, which is a regular (non-blind) SSRF.

Step 2 — Point it at the restricted endpoint

Right-click a radio button, choose Inspect, and edit its value to private. Select that modified option and click Update Avatar. The application answers with an error: it has a deny list and the path may not start with /private.

Step 3 — Bypass the deny list with path traversal

The check is a string test on the beginning of the value, but the fetch happens after the path is normalised. Setting the value to a dummy directory followed by a parent-directory step defeats the check:

x/../private

The string starts with x, so the filter passes it. When the server resolves the path, x/.. cancels out and the request becomes just /private. This is the classic validate-then-normalise ordering bug, and it is the same root cause as ordinary path traversal. The update now succeeds.

Step 4 — Read the loot

The avatar area on the page now holds the contents of /private as base64. Copy the data after base64, from the page source and decode it:

echo 'BASE64_FROM_PAGE_SOURCE' | base64 -d
FLAG
Because the server fetched the resource from inside the trusted network, the "cannot be viewed from your IP address" control never applied. The data was returned through the avatar feature instead.

Q: What is the flag after exploiting the avatar SSRF?
A: FLAG

Key takeaways

  • SSRF abuses the server's network position and trust: anything the server can reach becomes reachable by the attacker, and IP-based restrictions are bypassed.
  • Look for parameters, hidden fields and path fragments that name a URL, host, port or file the server will fetch. Blind SSRF needs an out-of-band listener or Burp Collaborator.
  • Deny lists lose to alternative IP notations, DNS tricks and path normalisation; allow lists lose to prefix-only string checks and open redirects.
  • Defensive fixes: prefer strict allow lists on the parsed and resolved destination, normalise before validating, disable or tightly control redirects, block internal and link-local ranges at the network layer, and require tokens (such as IMDSv2 on AWS) for metadata services.
  • Always inspect what the app adds around your input; delimiters like & and # let you cut off unwanted suffixes.