Authorization Bypass Affecting url-parse package, versions <1.5.8


0.0
medium

Snyk CVSS

    Attack Complexity Low
    Scope Changed

    Threat Intelligence

    Exploit Maturity Proof of concept
    EPSS 0.13% (47th percentile)
Expand this section
NVD
9.1 critical
Expand this section
Red Hat
9.1 critical

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk ID SNYK-JS-URLPARSE-2407759
  • published 21 Feb 2022
  • disclosed 21 Feb 2022
  • credit Rohan Sharma

How to fix?

Upgrade url-parse to version 1.5.8 or higher.

Overview

url-parse is a Small footprint URL parser that works seamlessly across Node.js and browser environments.

Affected versions of this package are vulnerable to Authorization Bypass via the hostname field of a parsed URL, because "url-parse" is unable to find the correct hostname when no port number is provided in the URL.

PoC:

var Url = require('url-parse');
var PAYLOAD = "http://example.com:";

console.log(Url(PAYLOAD));

// Expected hostname: example.com
// Actual hostname by url-parse: example.com:

Output:

{
  slashes: true,
  protocol: 'http:',
  hash: '',
  query: '',
  pathname: '/',
  auth: '',
  host: 'example.com:',
  port: '',
  hostname: 'example.com:',
  password: '',
  username: '',
  origin: 'http://example.com:',
  href: 'http://example.com:/'
}

References