jquery-validation Cross-Site Scripting Vulnerability in showLabel Function

Vulnerability

A cross-site scripting (XSS) vulnerability has been identified in the jquery-validation package, affecting versions prior to 1.20.0. The issue arises in the showLabel() function, which can be manipulated by user-controlled placeholder values. These values are inserted into messages via $.validator.messages, which can be localized by the user.

Impact

Exploitation of this vulnerability allows for cross-site scripting attacks, where an attacker can inject malicious scripts that are executed in the context of the user's browser.

Reproduction

To reproduce this vulnerability, use a version of jquery-validation prior to 1.20.0. Create a form with a required input field and a placeholder that includes a script tag. When the form is validated, the showLabel() function will use .html() to set the label content, which can lead to script execution if the message includes unescaped HTML.

Remediation

Upgrade jquery-validation to version 1.20.0 or higher. After updating, ensure to set the escapeHtml option to true in the validation configuration to mitigate the XSS risk.

Added: Jun 9, 2025, 7:46 PM
Updated: Jun 9, 2025, 7:46 PM

Vulnerability Rating

Custom Algorithm
spread
6.6
impact
1.7
exploitability
5.8
remediation
8.3
relevance
0.0
threat
6.4
urgency
2.9
incentive
1.7

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.