Backslash Handling Vulnerability in node-url-parse: Misinterpretation of URIs

node-url-parse Updated 02 Oct 2025

Summary

22/02/2021
N/A
Yes i
Medium
5.3

CVE-2021-27515: url-parse before 1.5.0 mishandles certain uses of backslash such as http:\/ and interprets the URI as a relative path. Affects node-url-parse across 2 version ranges.

< 1.5.1-1 < d1e7e8822f26e8a49794b757123b51386325b2b0

Fixed in 1.5.1-1. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

node-url-parse is a popular JavaScript library used for parsing URLs in Node.js applications. It provides a simple interface for extracting components from URLs, making it easier for developers to handle and manipulate web addresses. However, prior to version 1.5.1, the library mishandled certain uses of backslashes, leading to potential security risks.

Vulnerability Detail

The vulnerability, identified as CVE-2021-27515, arises from the improper handling of backslashes in URIs, such as 'http:/' which are interpreted as relative paths. This flaw can lead to unexpected behavior in applications that rely on accurate URL parsing, potentially exposing them to security risks like unauthorized access or data leakage. The issue was introduced in versions prior to 1.5.1 and affects multiple Debian ecosystems.

How To Fix

Minimum fixed version

1.5.1-1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade node-url-parse

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If an immediate update is not possible, consider sanitizing input URLs by replacing backslashes with forward slashes before parsing. This can be done with the following code snippet:

const sanitizedUrl = inputUrl.replace(/\\/g, '/');
const parsedUrl = urlParse(sanitizedUrl);

Conclusion

In summary, CVE-2021-27515 is a significant vulnerability in the node-url-parse library that can lead to serious security issues if not addressed. It is crucial for developers to update to version 1.5.1 or later to mitigate these risks. Additionally, utilizing tools like Vulert can help monitor and alert for such vulnerabilities in real-time.

See every vulnerability recorded for node-url-parse →

Share this vulnerability

FAQ

CVE-2021-27515 is a vulnerability in the node-url-parse library that mishandles backslashes in URIs, leading to potential security risks.

You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

The risks include unauthorized access, data leakage, and unexpected application behavior due to incorrect URL parsing.

The CVSS score for CVE-2021-27515 is 5.3, indicating a moderate level of severity.

You can update the package by running the command 'npm install node-url-parse@1.5.1' in your terminal.

Related vulnerabilities

Recent vulnerabilities recorded for node-url-parse.

How To Fix

Minimum fixed version

1.5.1-1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade node-url-parse

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback