CVE-2022-25839: Improper Input Validation in url-js
Summary
CVE-2022-2583: Race condition in github.com/ntbosscher/gobase. Affects github.com/ntbosscher/gobase versions < 0.7.2. Fixed in 0.7.2. 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
The package url-js is an npm package that provides URL parsing and manipulation functionality. It is commonly used in JavaScript applications to handle URLs. However, versions before 2.1.0 are vulnerable to an Improper Input Validation issue. This vulnerability arises from improper parsing of URLs, allowing for hostname spoofing. For example, the URLs http://localhostocalhost and http://localhost are treated as the same URL, even though the hostname is not correctly parsed as 'localhost' and the backslash is reflected as it is.
Vulnerability Detail
The Improper Input Validation vulnerability in url-js can have various ramifications. By spoofing the hostname, an attacker can deceive users into believing they are interacting with a trusted website or service. This can lead to phishing attacks, credential theft, or other malicious activities. The vulnerability is rated as MODERATE severity with a CVSS score of 5.3. The Common Weakness Enumeration (CWE) ID associated with this vulnerability is CWE-20.
How To Fix
Latest published version: v0.12.2 as of 23 Oct 2026
go get github.com/ntbosscher/gobase@v0.12.2
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
0.7.2
This is the first release that contains the fix.
go get github.com/ntbosscher/gobase@v0.7.2
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
There is no specific workaround mentioned for this vulnerability. The best course of action is to update the url-js package to the fixed version.
Conclusion
The url-js package before version 2.1.0 is vulnerable to an Improper Input Validation issue that allows for hostname spoofing. This can have serious security implications, including phishing attacks and credential theft. It is crucial to update the package to version 2.1.0 or later to mitigate this vulnerability. For further assistance or support in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for github.com/ntbosscher/gobase →
FAQ
url-js is an npm package that provides URL parsing and manipulation functionality for JavaScript applications.
The vulnerability allows for hostname spoofing, which can lead to phishing attacks, credential theft, or other malicious activities.
The vulnerability is rated as MODERATE severity with a CVSS score of 5.3.
To fix this vulnerability, update the url-js package to version 2.1.0 or later.
There is no specific workaround mentioned for this vulnerability. Updating the package to the fixed version is the recommended solution.