CVE-2020–13956
Apache HttpClient's URI parser incorrectly extracted the host from a URI with multiple '@' characters, resolving to the first host rather than the last. An attacker could supply a crafted URI to redirect requests to an unintended host, potentially bypassing SSRF protections.
As a security researcher, adopting a holistic approach could lead to finding unexpected vulnerabilities. You start with something but end up with something more interesting.
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 URI parser in Apache HttpClient used the first '@' in the authority component to strip user credentials, instead of the last '@' as required by RFC3986, causing incorrect host extraction.
Impact
An attacker could cause Apache HttpClient to connect to a different host than intended, potentially bypassing SSRF protections or redirecting requests to malicious servers.
What the attacker needed
Application uses vulnerable Apache HttpClient; attacker can supply a URI to the application
The fix
The issue was fixed in Apache HttpClient versions 4.5.13 and 5.0.3 by correcting the host extraction logic.
How it was found
- Identify an SSRF endpoint that makes out-of-band requests.
- Send a request to a collaborator server and observe the User-Agent header.
- Note the Apache HttpClient version and JVM version from the User-Agent.
- Download that HttpClient version and set up a project to investigate URI parsing.
- Test a crafted URI with multiple '@' characters and observe the resolved host.
- Trace the code to find that URIUtils.extractHost() incorrectly parses the authority.
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.
When a program needs to fetch a web address, it splits the address into parts like the host (the server name). Different programs can disagree on how to split it, especially when the address contains special characters like '@'. Here, Apache HttpClient picked the wrong part as the host, so a request meant for one server could go to another.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.