Advisory

GHSA-8v38-pw62-9cw2

Also known as: CVE-2022-0639

Summary

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

Details

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,

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

Will return:

{
 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.

Severity

Medium Basis: The source's own band: MODERATE

Dates

Published
2022-02-18 00:00 UTC
Modified
2026-02-22 22:58 UTC

Affected packages and fixes

url-parse

npm · All systems

Affected

  • introduced 1.0.0, fixed 1.5.7 (semver)

Fixed versions

1.5.7

Fix

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences