SSRF via Host Header Injection — A Prank Gone Vulnerable
The server trusted the X-Forwarded-Host header and made outbound requests to the supplied hostname. An attacker could make the server contact arbitrary internal or external systems, enabling SSRF.
Published on medium.com
While poking around the application at https://example.com, I noticed something a little too friendly about how the server handled headers.
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 application trusted the user-controlled X-Forwarded-Host header without validation and used it to build outbound requests.
Impact
An attacker could make the server access internal systems, cloud metadata, or scan internal services, potentially leading to data leakage or further compromise.
What the attacker needed
Ability to send custom headers
The fix
The application should not trust user-controlled headers such as Host or X-Forwarded-Host, and should use a strict allowlist for valid hostnames.
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.
A server-side request forgery (SSRF) happens when a server is tricked into making a request to a destination chosen by the attacker. Here the server believed a header that said which host to use, so it contacted the attacker's domain. This could let an attacker reach internal services that are not meant to be exposed.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.