Skip to content
SSRF Disclosed report Intermediate CVE-2022-0639

url-parse Incorrectly parses URLs that include an '@'

The url-parse library misparses a URL containing an '@' with empty user info and no hostname, returning an empty hostname and origin but a different href. If an application uses the hostname or origin for security checks and then requests the href, the check may be bypassed.

unshiftio/url-parse

Originally disclosed on huntr

A specially crafted URL with an '@' sign but empty user info and no hostname, when parsed with url-parse, url-parse will return the incorrect href. In particular,

JavaScript
parse(\"http://@/127.0.0.1\")

Will return:

YAML
{
 slashes: true,
 protocol: 'http:',
 hash: '',
 query: '',
 pathname: '/127.0.0.1',
 auth: '',
 host: '',
 port: '',
 hostname: '',
 password: '',
 username: '',
 origin: 'null',
 href: 'http:///127.0.0.1'
 }

If the 'hostname' or 'origin' attributes of the output from url-parse are used in security decisions and the final 'href' attribute of the output is then used to make a request, the decision may be incorrect.

From the GitHub Advisory Database (GHSA-8v38-pw62-9cw2, CC BY 4.0).

The original report as published on the GitHub Advisory Database. Images and videos are our own copies; raw HTML is shown as text. View it on GitHub Advisory Database.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Impact

An attacker could bypass security checks that rely on the parsed hostname or origin, potentially causing the application to make requests to unintended hosts.

What the attacker needed

Application uses url-parse output for security checks

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 report has not been written yet. The Original tab links to the source.

A URL parser is supposed to break a web address into parts like the host (the server name) and the path. Here, a strange address with an '@' sign confuses the parser: it says there is no host, but the full address it gives back still points somewhere. If a program trusts the 'no host' answer to allow something, but then uses the full address to fetch data, it could be tricked into contacting a server it should not.

What is SSRF?

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.

More from unshiftio/url-parse

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Server-side request forgery (SSRF)

The lesson behind this report.

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.