Skip to content
SSRF Write-up Intermediate

Server-Side Request Forgery (SSRF) to Local File Read: A Deep Div

The application's fetch.php endpoint accepted user-controlled URLs and passed them to PHP cURL without restricting URL schemes, allowing the use of file:// to read local files. An attacker could read arbitrary files from the server's filesystem, including the challenge flag.

Gyaneshchand Follow

Published on medium.com

After deep reconnaissance, testing, and analysis, I finally captured the flag in an interesting web-based CTF hosted on Com Olho.

Gyaneshchand, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The application passed user-supplied URLs directly to PHP cURL without validating or restricting the URL scheme, allowing file:// to be used for local file read.

Impact

An attacker could read local files, enumerate the filesystem, discover source code, access internal APIs, and leak credentials or configuration files.

What the attacker needed

Valid credentials (found in placeholders); access to the fetch.php endpoint

The fix

The application should validate and restrict user-supplied URLs to an allowlist of trusted hosts and protocols, and disable dangerous cURL schemes like file://.

How it was found

  1. Log in using the credentials shown in the input placeholders.
  2. Intercept the login request and notice the url parameter in fetch.php.
  3. Replace the URL with an external endpoint to confirm SSRF.
  4. Test the file:// scheme and correct the syntax to file:/// to read the root directory.
  5. Enumerate directories to find the flag file and request it via file://.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

The website had a feature that fetched a web address you gave it and showed you the result. The programmer forgot to check that the address was a normal web link, so you could give it a special address that points to a file on the server itself. That let the attacker read files stored on the server, like a password file or the hidden flag.

What is SSRF?

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.

Similar reports

View all

Same bug class and techniques, clearest first.

Server-side request forgery (SSRF)

The lesson behind this report.

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.