Reading internal files using SSRF vulnerability
A request parameter named 'filehookURL' accepted arbitrary URLs and fetched them server-side, allowing the hunter to make the server read local files. Using a file:/// scheme, the attacker could read the contents of /etc/passwd.
Published on medium.com
I am hunting on one private program since last 8 months, since it doesn’t allow disclosure i will keep organization REDACT, in requests i will use ‘example.com’ as its name.
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
Likely the server fetched user-supplied URLs without validating the scheme or destination, so file:/// and internal addresses were accepted.
Impact
An attacker could read internal files on the server, which may expose sensitive system data.
What the attacker needed
Access to the site's JavaScript files; a request parameter accepting a URL
The fix
The issue was fixed by the organisation within two hours of their first response.
How it was found
- Unminify a JavaScript file found on the site and look for new endpoints and functions.
- Find a function that builds a request with a 'filehookURL' parameter.
- Send a request with that parameter pointing at an external site and confirm the server fetches it.
- Try dangerous URL schemes such as file:/// and read /etc/passwd.
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.
Server-side request forgery (SSRF) happens when a website takes a URL from the user and fetches it on the server's behalf. If the server does not restrict which addresses or schemes are allowed, an attacker can point it at internal systems or local files instead of public websites. Here the server even accepted a file:/// address, which reads files on the server's own disk.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.