Skip to content

Improper Handling of Extra Parameters #1701

Open
@well-monkey

Description

@well-monkey

Package Manager: npm
Vulnerable module: follow-redirects
Introduced through: t, webpack-dev-server@5.2.0 and others
Detailed paths
Introduced through: › webpack-dev-server@5.2.0 › http-proxy-middleware@2.0.7 › http-proxy@1.18.1 › follow-redirects@1.15.2
Overview
Affected versions of this package are vulnerable to Improper Handling of Extra Parameters due to the improper handling of URLs by the url.parse() function. When new URL() throws an error, it can be manipulated to misinterpret the hostname. An attacker could exploit this weakness to redirect traffic to a malicious site, potentially leading to information disclosure, phishing attacks, or other security breaches.

PoC

Case 1 : Bypassing localhost restriction

    let url = 'http://[localhost]/admin';
    try{
        new URL(url); // ERROR : Invalid URL
    }catch{
        url.parse(url); // -> http://localhost/admin
    }
    
    # Case 2 : Bypassing domain restriction
    let url = 'http://attacker.domain*.allowed.domain:a';
    try{
        new URL(url); // ERROR : Invalid URL
    }catch{
        url.parse(url); // -> http://attacker.domain/*.allowed.domain:a
    }

Remediation
Upgrade follow-redirects to version 1.15.4 or higher.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions