Skip to content

XSS Filter Bypass via Encoded URL in validator

Moderate severity GitHub Reviewed Published Nov 6, 2018 to the GitHub Advisory Database • Updated Jan 9, 2023

Package

npm validator (npm)

Affected versions

< 2.0.0

Patched versions

2.0.0

Description

Versions of validator prior to 2.0.0 contained an xss filter method that is affected by several filter bypasses. This may result in a cross-site scripting vulnerability.

Proof of Concept

The xss() function removes the word "javascript" when contained inside an attribute.

However, it does not properly handle cases where characters have been hex-encoded.

As a result, it is possible to build an input that bypasses the filter but which the browser will accept as valid JavaScript.

For example:
<a href="jav&#x61;script:...">abc</a>
will render as:
<a href="javascript:...">abc</a>

Recommendation

The package author has decided to remove the xss filter functionality in the latest version of this module. If this feature is not currently being used, you are not affected by the vulnerability. If it is being used, updating to the latest version of the module will break your application.

In order for affected users to mitigate this vulnerability, it is necessary to use an alternative package that provides similar functionality.

References

Published to the GitHub Advisory Database Nov 6, 2018
Reviewed Jun 16, 2020
Last updated Jan 9, 2023

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
Required
Scope
Changed
Confidentiality
Low
Integrity
Low
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

EPSS score

0.209%
(59th percentile)

Weaknesses

CVE ID

CVE-2014-9772

GHSA ID

GHSA-79mx-88w7-8f7q

Source code

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.