CVE-2012-6708: XSS
Affected versions of jquery are vulnerable to cross-site scripting. This occurs because the main jquery function uses a regular expression to differentiate between HTML and selectors, but does not properly anchor the regular expression. The result is that jquery may interpret HTML as selectors when given certain inputs, allowing for client side code execution.
Proof of Concept $("#log").html( $("element[attribute='<img src=\"x\" onerror=\"alert(1)\" />']").html() );
Recommendation
Update to version 1.9.0 or later.
Other sources
jQuery before 1.9.0 is vulnerable to Cross-site Scripting (XSS) attacks. The jQuery(strInput) function does not differentiate selectors from HTML in a reliable fashion. In vulnerable versions jQuery determined whether the input was HTML by looking for the '<' character anywhere in the string giving attackers more flexibility when attempting to construct a malicious payload. In fixed versions jQuery only deems the input to be HTML if it explicitly starts with the '<' character limiting exploitability only to attackers who can control the beginning of a string which is far less common.
— Microsoft
jQuery before 1.9.0 is vulnerable to Cross-site Scripting (XSS) attacks. The jQuery(strInput) function does not differentiate selectors from HTML in a reliable fashion. In vulnerable versions, jQuery determined whether the input was HTML by looking for the '<' character anywhere in the string, giving attackers more flexibility when attempting to construct a malicious payload. In fixed versions, jQuery only deems the input to be HTML if it explicitly starts with the '<' character, limiting exploitability only to attackers who can control the beginning of a string, which is far less common.
— MITRE
Affected Software
Remediation
Patch Available
Event History
Frequently Asked Questions
What is CVE-2012-6708?
CVE-2012-6708 is a vulnerability in jQuery before version 1.9.0 that allows for Cross-site Scripting (XSS) attacks.
How does CVE-2012-6708 work?
In vulnerable versions of jQuery, the jQuery(strInput) function does not differentiate selectors from HTML reliably, allowing for XSS attacks.
What is the severity of CVE-2012-6708?
CVE-2012-6708 has a severity rating of 6.1 (Medium).
Which versions of jQuery are affected by CVE-2012-6708?
Versions of jQuery from 1.7.1 to 1.8.3 are affected by CVE-2012-6708.
How can I fix CVE-2012-6708?
To fix CVE-2012-6708, update jQuery to version 1.9.0 or later.