Improper Input Validation Affecting parse-url package, versions <8.1.0


0.0
medium

Snyk CVSS

    Exploit Maturity Proof of concept
    Attack Complexity High
    User Interaction Required
Expand this section
NVD
6.1 medium

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-PARSEURL-3024398
  • published 15 Sep 2022
  • disclosed 15 Sep 2022
  • credit Automne

How to fix?

Upgrade parse-url to version 8.1.0 or higher.

Overview

parse-url is an An advanced url parser supporting git urls too.

Affected versions of this package are vulnerable to Improper Input Validation due to incorrect parsing of URLs. This allows the attacker to craft a malformed URL which can lead to a phishing attack.


const parseUrl = require("parse-url");
const Url = require("url");

const express = require('express'); const app = express();

var url = "https://www.google.com:x@fakesite.com:x"; parsed = parseUrl(url); console.log("[*]parse-url output: ") console.log(parsed);

parsed2 = Url.parse(url); console.log("[*]url output: ") console.log(parsed2)

app.get('/', (req, res) => { if (parsed.host == "www.google.com") { res.send("<a href=&#39;" + parsed2.href + "&#39;>CLICK ME!</a>") } })

app.listen(8888,"0.0.0.0");