CVE-2021-27516: Hostname spoofing via backslashes in URL in urijs
Summary
CVE-2021-27516: URIjs Hostname spoofing via backslashes in URL. Affects urijs versions < 1.19.6. Fixed in 1.19.6. How to fix ↓
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.
No signup required · Results in about 60 seconds
Background
urijs is an npm package that provides a JavaScript library for working with URLs. It allows developers to parse, manipulate, and generate URLs in a convenient and reliable manner. The package is widely used in web development projects to handle URL-related operations. However, versions of urijs prior to 1.19.6 are vulnerable to a hostname spoofing issue when processing URLs containing backslashes in the scheme delimiter. This vulnerability can lead to incorrect hostname determination, potentially resulting in security bypasses, SSRF attacks, open redirects, or other undesired behavior.
Vulnerability Detail
The vulnerability arises from the incorrect handling of backslashes in the scheme delimiter of URLs. By using a backslash character as part of the scheme delimiter, an attacker can spoof the hostname in the URL. This can have various impacts depending on how the hostname is used in security decisions. For example, it can bypass allow/block lists, enable SSRF attacks, or facilitate open redirects. The affected versions of urijs incorrectly return no hostname when processing such URLs, while the patched version (1.19.6) correctly returns the expected hostname. It is important to note that the patched version aligns with the behavior of other parsers implementing the WHATWG URL specification, including web browsers and Node's built-in URL class.
How To Fix
Latest published version: 1.19.11 as of 23 Oct 2026
npm install urijs@1.19.11
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
1.19.6
This is the first release that contains the fix.
npm install urijs@1.19.6
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
There is no known workaround for this vulnerability. It is recommended to upgrade to the patched version as soon as possible.
Conclusion
The hostname spoofing vulnerability in urijs can have significant security implications, including allow/block list bypasses, SSRF attacks, and open redirects. It is crucial for developers to upgrade to the patched version (1.19.6) to ensure correct hostname determination in URLs. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for urijs →
FAQ
urijs is an npm package that provides a JavaScript library for working with URLs. It allows developers to parse, manipulate, and generate URLs in a convenient and reliable manner.
The impact of this vulnerability can vary depending on how the hostname is used in security decisions. Possible impacts include allow/block list bypasses, SSRF attacks, open redirects, or other undesired behavior.
To fix this vulnerability, you should upgrade the urijs package to version 1.19.6 or later. This patched version correctly handles URLs with backslashes in the scheme delimiter.
There is no known workaround for this vulnerability. It is recommended to upgrade to the patched version (1.19.6) as soon as possible.
For more information, you can refer to the advisory on the GitHub repository of urijs: https://github.com/medialize/URI.js
References
Related vulnerabilities
Recent vulnerabilities recorded for urijs.