CVE-2021-23648: Cross-site Scripting in sanitize-url

@braintree/sanitize-url Updated 02 Oct 2025

Summary

17/03/2022
Yes i
Moderate
5.4

CVE-2021-23648: Cross-site Scripting in sanitize-url. Affects @braintree/sanitize-url versions < 6.0.0. Fixed in 6.0.0. How to fix ↓

Also tracked for

The same CVE-2021-23648 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

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

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

The package @braintree/sanitize-url is an npm package that provides a function called sanitizeUrl. This function is used for sanitizing URLs by removing any potentially malicious content. The package is commonly used in web applications to ensure that user-provided URLs are safe to use. However, versions of the package before 6.0.0 are vulnerable to a Cross-site Scripting (XSS) attack due to improper sanitization in the sanitizeUrl function.

Vulnerability Detail

The vulnerability in @braintree/sanitize-url allows an attacker to inject malicious scripts into a sanitized URL, which can then be executed by unsuspecting users. This can lead to various security risks, such as stealing sensitive information, performing actions on behalf of the user, or redirecting the user to malicious websites. The vulnerability is rated as MODERATE severity with a CVSS score of 5.4.

How To Fix

Minimum fixed version

6.0.0

This is the first release that contains the fix.

npm install @braintree/sanitize-url@6.0.0

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 essential to update the package to the fixed version to mitigate the risk of XSS attacks.

Conclusion

The @braintree/sanitize-url package before version 6.0.0 is vulnerable to Cross-site Scripting (XSS) attacks. It is crucial for developers to update their dependencies and use the fixed version to mitigate the risk. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for @braintree/sanitize-url →

Share this vulnerability

FAQ

@braintree/sanitize-url is an npm package used for sanitizing URLs in web applications.

Cross-site Scripting (XSS) is a type of security vulnerability that allows attackers to inject malicious scripts into web pages viewed by other users.

This vulnerability allows an attacker to execute arbitrary scripts in the context of a user's browser, potentially leading to unauthorized actions or data theft.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability. Simply upload your package-lock.json file and Vulert will analyze it for vulnerabilities.

Yes, updating the @braintree/sanitize-url package to version 6.0.0 or later will fix this vulnerability.

Related vulnerabilities

Recent vulnerabilities recorded for @braintree/sanitize-url.

How To Fix

Minimum fixed version

6.0.0

This is the first release that contains the fix.

npm install @braintree/sanitize-url@6.0.0

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