VYPR
Moderate severityNVD Advisory· Published Mar 8, 2013· Updated Apr 29, 2026

CVE-2011-4969

CVE-2011-4969

Description

Cross-site scripting (XSS) vulnerability in jQuery before 1.6.3, when using location.hash to select elements, allows remote attackers to inject arbitrary web script or HTML via a crafted tag.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
jquerynpm
< 1.6.31.6.3
jQueryNuGet
< 1.6.31.6.3
jquery-railsRubyGems
< 1.0.161.0.16
org.webjars.npm:jqueryMaven
< 1.6.31.6.3

Affected products

3
  • jQuery/jQuery3 versions
    cpe:2.3:a:jquery:jquery:*:*:*:*:*:*:*:*+ 2 more
    • cpe:2.3:a:jquery:jquery:*:*:*:*:*:*:*:*range: <=1.6.2
    • cpe:2.3:a:jquery:jquery:1.6:*:*:*:*:*:*:*
    • cpe:2.3:a:jquery:jquery:1.6.1:*:*:*:*:*:*:*

Patches

1
db9e023e62c1

Merge pull request #474 from dmethvin/fix-9521-xss-hash

https://github.com/jquery/jqueryDave MethvinAug 25, 2011via ghsa
2 files changed · +20 2
  • src/core.js+2 2 modified
    @@ -16,8 +16,8 @@ var jQuery = function( selector, context ) {
     	rootjQuery,
     
     	// A simple way to check for HTML strings or ID strings
    -	// (both of which we optimize for)
    -	quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
    +	// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
    +	quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
     
     	// Check if a string has a non-whitespace character in it
     	rnotwhite = /\S/,
    
  • test/unit/core.js+18 0 modified
    @@ -467,6 +467,24 @@ test("isXMLDoc - HTML", function() {
     	document.body.removeChild( iframe );
     });
     
    +test("XSS via location.hash", function() {
    +	expect(1);
    +	
    +	stop();
    +	jQuery._check9521 = function(x){
    +		ok( x, "script called from #id-like selector with inline handler" );
    +		jQuery("#check9521").remove();
    +		delete jQuery._check9521;
    +		start();
    +	};
    +	try {
    +		// This throws an error because it's processed like an id
    +		jQuery( '#<img id="check9521" src="no-such-.gif" onerror="jQuery._check9521(false)">' ).appendTo("#qunit-fixture");
    +	} catch (err) {
    +		jQuery._check9521(true);
    +	};
    +});
    +
     if ( !isLocal ) {
     test("isXMLDoc - XML", function() {
     	expect(3);
    

Vulnerability mechanics

Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

21

News mentions

0

No linked articles in our index yet.