SSRF Vulnerability in SourceCodester Website Link Extractor v1.0
The Website Link Extractor passes a user-supplied URL straight to PHP's file_get_contents() with no validation or network restrictions. An attacker can make the server fetch internal resources such as localhost services and potentially cloud metadata endpoints.
medium.com
Published on medium.com
A Server-Side Request Forgery (SSRF) vulnerability was discovered in Website Link Extractor v1.0 developed by SourceCodester. The application accepts a user-supplied URL and retrieves its content on the server side without proper validation or network restrictions.
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
User input is passed directly to file_get_contents() without URL validation, internal IP blocking, protocol restrictions or network access control.
Impact
An attacker could access internal network services, interact with localhost applications, perform internal port scanning, enumerate internal infrastructure and potentially access cloud metadata endpoints, though severity depends on the server environment.
What the attacker needed
Access to the web application
The fix
The application should validate and sanitise user-supplied URLs, block internal IP ranges and localhost, use allowlist-based URL validation and restrict outgoing requests from the server.
How it was found
- Open the Website Link Extractor application.
- Enter a URL pointing at localhost port 80.
- Click Extract Links.
- The server fetches the internal localhost content and extracts internal links.
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) is when a website fetches a web address on your behalf, but you give it an address it should not reach, such as an internal machine. Here the link extractor fetches whatever URL you type, so you can point it at the server's own localhost or private network and read what comes back.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.