VDB
Sign up
MEDIUM6.1

GHSA-2pqj-h3vj-pqgw

Cross-Site Scripting in jquery

Quick fix

GHSA-2pqj-h3vj-pqgw — jquery: upgrade to the fixed version with the command below.

npm install jquery@1.9.0

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.

Are you affected?

Enter the version of the package you're using.

Affected packages

npm/jquery
Introduced in: 0Fixed in: 1.9.0
Fixnpm install jquery@1.9.0
Maven/org.webjars.npm:jquery
Introduced in: 0Fixed in: 1.9.0
Fix# pom.xml: bump <version>1.9.0</version> for org.webjars.npm:jquery
NuGet/jQuery
Introduced in: 0Fixed in: 1.9.0
Fixdotnet add package jQuery --version 1.9.0
RubyGems/jquery-rails
Introduced in: 0Fixed in: 2.2.0
Fixbundle update jquery-rails

References