ADVISORIES

GitHub Advisory Database

GHSA-2pqj-h3vj-pqgw

Cross-Site Scripting in jquery

Moderate CVE-2012-6708

Details

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.

Affected packages

EcosystemPackageAffected versions
npmjquery
All versions before 1.9.0 (fixed in 1.9.0)
Mavenorg.webjars.npm:jquery
All versions before 1.9.0 (fixed in 1.9.0)
NuGetjQuery
All versions before 1.9.0 (fixed in 1.9.0)
RubyGemsjquery-rails
All versions before 2.2.0 (fixed in 2.2.0)

References