SSRF
Source + configuration reviewA URL previewer becomes a bridge into a localhost-only admin panel. The important question is not “can my browser reach it?”—it is “who makes the second request?”
- 1. User chooses a URL
GET /fetch.php?url=…The destination is controlled through one query parameter. - 2. PHP fetches it
file_get_contents($url)The connection comes from the application's container. - 3. Apache trusts loopback
127.0.0.1 → /internal/The new request satisfies the source-IP restriction. - 4. The response returns
htmlspecialchars($content)Internal HTML is displayed as text, including the flag.
The scenario
WebFetch Pro lets employees enter a URL and preview its content. The public handler passes that value directly to PHP's stream reader. There is no destination allowlist, scheme restriction, port policy, or resolved-IP check.
The same Apache instance serves /internal/, a simulated diagnostics and credentials panel. Its directory is restricted to requests from IPv4 or IPv6 loopback. A browser arriving through Docker's published port is normally outside that trust boundary; PHP requesting http://127.0.0.1/internal/ is inside it.
This is a beginner, response-visible SSRF exercise. No filter bypass, brute force, command injection, or additional vulnerable service is required for the intended solve.
What was reviewed—and what was not run
The twelve files in SSRF/ were read, including all PHP source, Apache rules, Docker configuration, Markdown guides, and the supplied Python tester. Official documentation was consulted for technical corrections. No container was built or started, no PHP or Python was executed, no lab endpoint was contacted, and no HTML file was opened or run. Behavior below is source-defined or author-reported, not a fresh execution transcript.
What a complete solve means
- Identify the user-controlled
urlparameter and its server-side fetch sink. - Explain why host port
8080and container port80are different. - Compare direct denial with a server-originated loopback request.
- Recognize the internal response in the returned
<pre>, not just a200status. - Explain the missing destination authorization and propose defenses beyond string filtering.
The central idea
A server-side fetch borrows the server's reachability. An IP-only rule cannot tell whether a trusted process is acting for an untrusted user.
The central trap
Escaping the response prevents HTML interpretation. It does not stop the server from requesting or disclosing the wrong resource.
Reveal the intended payload and source-defined flag
The URL below is the value entered into the fetch form—not the browser's outer application URL.
http://127.0.0.1/internal/FLAG{ssrf_internal_service_access}The flag is present in the supplied source. Knowing this literal from a source review is not proof that a running deployment was exploited.