CVE-2015-9251
Description
jQuery before 3.0.0 is vulnerable to Cross-site Scripting (XSS) attacks when a cross-domain Ajax request is performed without the dataType option, causing text/javascript responses to be executed.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
jQuery before 3.0.0 executes script responses from cross-domain Ajax requests, enabling XSS attacks.
Vulnerability
jQuery versions prior to 3.0.0 are vulnerable to Cross-site Scripting (XSS) due to automatic execution of JavaScript responses when performing a cross-domain Ajax request without explicitly specifying the dataType option. In such cases, jQuery incorrectly treats text/javascript responses as executable code rather than raw text, leading to script injection [1] [2]. This affects all jQuery releases before 3.0.0.
Exploitation
An attacker must serve a malicious cross-domain endpoint that returns a text/javascript response. When a victim's browser makes a cross-origin Ajax request to that endpoint (typically via $.ajax() or shorthand methods like $.get() without dataType set), jQuery automatically evaluates the returned JavaScript in the context of the calling page [1]. No authentication or special privileges are required beyond the ability to induce the victim to visit a page making such a request.
Impact
Successful exploitation allows the attacker to execute arbitrary JavaScript in the context of the victim's browser session, potentially leading to session hijacking, data theft, defacement, or further cross-origin attacks. The attack achieves cross-domain script injection without explicit user interaction beyond visiting the attacker-controlled or attacker-influenced page [1].
Mitigation
Upgrade to jQuery 3.0.0 or later, where the browser's native XMLHttpRequest response handling is used and automatic script evaluation for cross-domain requests is removed [1] [2]. Users on unsupported branches (1.x and 2.x) should migrate to the latest 4.x release as these branches no longer receive security patches [2]. If upgrading is not immediately possible, ensure all cross-domain Ajax calls explicitly set dataType: 'text' or another non-executable type to prevent script evaluation.
AI Insight generated on May 22, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
jquerynpm | < 1.12.2 | 1.12.2 |
jQueryNuGet | < 1.12.2 | 1.12.2 |
jQueryNuGet | >= 1.12.3, < 3.0.0 | 3.0.0 |
jquerynpm | >= 1.12.3, < 3.0.0 | 3.0.0 |
jquery-railsRubyGems | < 4.2.0 | 4.2.0 |
org.webjars.npm:jqueryMaven | < 1.12.2 | 1.12.2 |
org.webjars.npm:jqueryMaven | >= 1.12.3, < 3.0.0 | 3.0.0 |
Affected products
17- ghsa-coords17 versionspkg:gem/jquery-railspkg:maven/org.webjars.npm/jquerypkg:npm/jquerypkg:nuget/jquerypkg:rpm/almalinux/custodiapkg:rpm/almalinux/python3-custodiapkg:rpm/almalinux/python3-jwcryptopkg:rpm/almalinux/python3-kdcproxypkg:rpm/almalinux/python3-pyusbpkg:rpm/almalinux/python3-qrcodepkg:rpm/almalinux/python3-qrcode-corepkg:rpm/almalinux/python3-yubicopkg:rpm/suse/ruby2.5&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015-ESPOSpkg:rpm/suse/ruby2.5&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015-LTSSpkg:rpm/suse/ruby2.5&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Basesystem%2015%20SP1pkg:rpm/suse/ruby2.5&distro=SUSE%20Linux%20Enterprise%20Server%2015-LTSSpkg:rpm/suse/ruby2.5&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2015
< 4.2.0+ 16 more
- (no CPE)range: < 4.2.0
- (no CPE)range: < 1.12.2
- (no CPE)range: < 1.12.2
- (no CPE)range: < 1.12.2
- (no CPE)range: < 0.6.0-3.module_el8.6.0+2881+2f24dc92
- (no CPE)range: < 0.6.0-3.module_el8.6.0+2881+2f24dc92
- (no CPE)range: < 0.5.0-1.module_el8.5.0+2641+983b221b
- (no CPE)range: < 0.4-5.module_el8.6.0+2881+2f24dc92
- (no CPE)range: < 1.0.0-9.module_el8.5.0+2641+983b221b
- (no CPE)range: < 5.1-12.module_el8.6.0+2881+2f24dc92
- (no CPE)range: < 5.1-12.module_el8.6.0+2737+7e73ea90
- (no CPE)range: < 1.3.2-9.module_el8.5.0+2641+983b221b
- (no CPE)range: < 2.5.7-4.8.1
- (no CPE)range: < 2.5.7-4.8.1
- (no CPE)range: < 2.5.7-4.8.1
- (no CPE)range: < 2.5.7-4.8.1
- (no CPE)range: < 2.5.7-4.8.1
Patches
2b078a6201378Ajax: Mitigate possible XSS vulnerability
3 files changed · +56 −1
src/ajax.js+1 −1 modified@@ -221,7 +221,7 @@ function ajaxConvert( s, response, jqXHR, isSuccess ) { if ( current ) { - // There's only work to do if current dataType is non-auto + // There's only work to do if current dataType is non-auto if ( current === "*" ) { current = prev;
src/ajax/script.js+7 −0 modified@@ -4,6 +4,13 @@ define( [ "../ajax" ], function( jQuery, document ) { +// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) +jQuery.ajaxPrefilter( function( s ) { + if ( s.crossDomain ) { + s.contents.script = false; + } +} ); + // Install script dataType jQuery.ajaxSetup( { accepts: {
test/unit/ajax.js+48 −0 modified@@ -71,6 +71,54 @@ QUnit.module( "ajax", { }; } ); + ajaxTest( "jQuery.ajax() - do not execute js (crossOrigin)", 2, function( assert ) { + return { + create: function( options ) { + options.crossDomain = true; + return jQuery.ajax( url( "data/script.php?header=ecma" ), options ); + }, + success: function() { + assert.ok( true, "success" ); + }, + complete: function() { + assert.ok( true, "complete" ); + } + }; + } ); + + ajaxTest( "jQuery.ajax() - execute js for crossOrigin when dataType option is provided", 3, + function( assert ) { + return { + create: function( options ) { + options.crossDomain = true; + options.dataType = "script"; + return jQuery.ajax( url( "data/script.php?header=ecma" ), options ); + }, + success: function() { + assert.ok( true, "success" ); + }, + complete: function() { + assert.ok( true, "complete" ); + } + }; + } + ); + + ajaxTest( "jQuery.ajax() - do not execute js (crossOrigin)", 2, function( assert ) { + return { + create: function( options ) { + options.crossDomain = true; + return jQuery.ajax( url( "data/script.php" ), options ); + }, + success: function() { + assert.ok( true, "success" ); + }, + complete: function() { + assert.ok( true, "complete" ); + } + }; + } ); + ajaxTest( "jQuery.ajax() - success callbacks (late binding)", 8, function( assert ) { return { setup: addGlobalEvents( "ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess", assert ),
f60729f3903dAjax: Mitigate possible XSS vulnerability
2 files changed · +55 −0
src/ajax/script.js+7 −0 modified@@ -4,6 +4,13 @@ define( [ "../ajax" ], function( jQuery, document ) { +// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) +jQuery.ajaxPrefilter( function( s ) { + if ( s.crossDomain ) { + s.contents.script = false; + } +} ); + // Install script dataType jQuery.ajaxSetup( { accepts: {
test/unit/ajax.js+48 −0 modified@@ -85,6 +85,54 @@ QUnit.module( "ajax", { }; } ); + ajaxTest( "jQuery.ajax() - do not execute js (crossOrigin)", 2, function( assert ) { + return { + create: function( options ) { + options.crossDomain = true; + return jQuery.ajax( url( "data/script.php?header=ecma" ), options ); + }, + success: function() { + assert.ok( true, "success" ); + }, + complete: function() { + assert.ok( true, "complete" ); + } + }; + } ); + + ajaxTest( "jQuery.ajax() - execute js for crossOrigin when dataType option is provided", 3, + function( assert ) { + return { + create: function( options ) { + options.crossDomain = true; + options.dataType = "script"; + return jQuery.ajax( url( "data/script.php?header=ecma" ), options ); + }, + success: function() { + assert.ok( true, "success" ); + }, + complete: function() { + assert.ok( true, "complete" ); + } + }; + } + ); + + ajaxTest( "jQuery.ajax() - do not execute js (crossOrigin)", 2, function( assert ) { + return { + create: function( options ) { + options.crossDomain = true; + return jQuery.ajax( url( "data/script.php" ), options ); + }, + success: function() { + assert.ok( true, "success" ); + }, + complete: function() { + assert.ok( true, "complete" ); + } + }; + } ); + ajaxTest( "jQuery.ajax() - success callbacks (late binding)", 8, function( assert ) { return { setup: addGlobalEvents( "ajaxStart ajaxStop ajaxSend ajaxComplete ajaxSuccess", assert ),
Vulnerability mechanics
Generated on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
57- lists.opensuse.org/opensuse-security-announce/2020-03/msg00041.htmlghsavendor-advisoryx_refsource_SUSEWEB
- access.redhat.com/errata/RHSA-2020:0481ghsavendor-advisoryx_refsource_REDHATWEB
- access.redhat.com/errata/RHSA-2020:0729ghsavendor-advisoryx_refsource_REDHATWEB
- github.com/advisories/GHSA-rmxg-73gg-4p98ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2015-9251ghsaADVISORY
- packetstormsecurity.com/files/152787/dotCMS-5.1.1-Vulnerable-Dependencies.htmlghsax_refsource_MISCWEB
- packetstormsecurity.com/files/153237/RetireJS-CORS-Issue-Script-Execution.htmlghsax_refsource_MISCWEB
- packetstormsecurity.com/files/156743/OctoberCMS-Insecure-Dependencies.htmlghsax_refsource_MISCWEB
- seclists.org/fulldisclosure/2019/May/10ghsamailing-listx_refsource_FULLDISCWEB
- seclists.org/fulldisclosure/2019/May/11ghsamailing-listx_refsource_FULLDISCWEB
- seclists.org/fulldisclosure/2019/May/13ghsamailing-listx_refsource_FULLDISCWEB
- www.oracle.com/technetwork/security-advisory/cpuoct2018-4428296.htmlghsax_refsource_CONFIRMWEB
- www.securityfocus.com/bid/105658mitrevdb-entryx_refsource_BID
- github.com/jquery/jquery/commit/b078a62013782c7424a4a61a240c23c4c0b42614ghsaWEB
- github.com/jquery/jquery/commit/f60729f3903d17917dc351f3ac87794de379b0ccghsax_refsource_MISCWEB
- github.com/jquery/jquery/issues/2432ghsax_refsource_MISCWEB
- github.com/jquery/jquery/issues/2432ghsaWEB
- github.com/jquery/jquery/pull/2588ghsax_refsource_MISCWEB
- github.com/jquery/jquery/pull/2588/commits/c254d308a7d3f1eac4d0b42837804cfffcba4bb2ghsax_refsource_MISCWEB
- github.com/rails/jquery-rails/blob/master/CHANGELOG.mdghsaWEB
- github.com/rails/jquery-rails/blob/v4.2.0/vendor/assets/javascripts/jquery3.jsghsaWEB
- github.com/rails/jquery-rails/releases/tag/v4.2.0ghsaWEB
- github.com/rubysec/ruby-advisory-db/blob/master/gems/jquery-rails/CVE-2015-9251.ymlghsaWEB
- ics-cert.us-cert.gov/advisories/ICSA-18-212-04ghsax_refsource_MISCWEB
- kb.pulsesecure.net/articles/Pulse_Security_Advisories/SA44601ghsax_refsource_CONFIRMWEB
- lists.apache.org/thread.html/10f0f3aefd51444d1198c65f44ffdf2d78ca3359423dbc1c168c9731%40%3Cdev.flink.apache.org%3Emitremailing-listx_refsource_MLIST
- lists.apache.org/thread.html/10f0f3aefd51444d1198c65f44ffdf2d78ca3359423dbc1c168c9731@%3Cdev.flink.apache.org%3EghsaWEB
- lists.apache.org/thread.html/17ff53f7999e74fbe3cc0ceb4e1c3b00b180b7c5afec8e978837bc49%40%3Cuser.flink.apache.org%3Emitremailing-listx_refsource_MLIST
- lists.apache.org/thread.html/17ff53f7999e74fbe3cc0ceb4e1c3b00b180b7c5afec8e978837bc49@%3Cuser.flink.apache.org%3EghsaWEB
- lists.apache.org/thread.html/519eb0fd45642dcecd9ff74cb3e71c20a4753f7d82e2f07864b5108f%40%3Cdev.drill.apache.org%3Emitremailing-listx_refsource_MLIST
- lists.apache.org/thread.html/519eb0fd45642dcecd9ff74cb3e71c20a4753f7d82e2f07864b5108f@%3Cdev.drill.apache.org%3EghsaWEB
- lists.apache.org/thread.html/52bafac05ad174000ea465fe275fd3cc7bd5c25535a7631c0bc9bfb2%40%3Cuser.flink.apache.org%3Emitremailing-listx_refsource_MLIST
- lists.apache.org/thread.html/52bafac05ad174000ea465fe275fd3cc7bd5c25535a7631c0bc9bfb2@%3Cuser.flink.apache.org%3EghsaWEB
- lists.apache.org/thread.html/54df3aeb4239b64b50b356f0ca6f986e3c4ca5b84c515dce077c7854%40%3Cuser.flink.apache.org%3Emitremailing-listx_refsource_MLIST
- lists.apache.org/thread.html/54df3aeb4239b64b50b356f0ca6f986e3c4ca5b84c515dce077c7854@%3Cuser.flink.apache.org%3EghsaWEB
- lists.apache.org/thread.html/b0656d359c7d40ec9f39c8cc61bca66802ef9a2a12ee199f5b0c1442%40%3Cdev.drill.apache.org%3Emitremailing-listx_refsource_MLIST
- lists.apache.org/thread.html/b0656d359c7d40ec9f39c8cc61bca66802ef9a2a12ee199f5b0c1442@%3Cdev.drill.apache.org%3EghsaWEB
- lists.apache.org/thread.html/ba79cf1658741e9f146e4c59b50aee56656ea95d841d358d006c18b6%40%3Ccommits.roller.apache.org%3Emitremailing-listx_refsource_MLIST
- lists.apache.org/thread.html/ba79cf1658741e9f146e4c59b50aee56656ea95d841d358d006c18b6@%3Ccommits.roller.apache.org%3EghsaWEB
- lists.apache.org/thread.html/f9bc3e55f4e28d1dcd1a69aae6d53e609a758e34d2869b4d798e13cc%40%3Cissues.drill.apache.org%3Emitremailing-listx_refsource_MLIST
- lists.apache.org/thread.html/f9bc3e55f4e28d1dcd1a69aae6d53e609a758e34d2869b4d798e13cc@%3Cissues.drill.apache.org%3EghsaWEB
- seclists.org/bugtraq/2019/May/18ghsamailing-listx_refsource_BUGTRAQWEB
- security.netapp.com/advisory/ntap-20210108-0004ghsaWEB
- security.netapp.com/advisory/ntap-20210108-0004/mitrex_refsource_CONFIRM
- security.snyk.io/vuln/SNYK-DOTNET-JQUERY-450227ghsaWEB
- snyk.io/vuln/npm:jquery:20150627ghsax_refsource_MISCWEB
- sw.aveva.com/hubfs/assets-2018/pdf/security-bulletin/SecurityBulletin_LFSec126.pdfghsax_refsource_MISCWEB
- web.archive.org/web/20200227030101/http://www.securityfocus.com/bid/105658ghsaWEB
- www.oracle.com/security-alerts/cpuapr2020.htmlghsax_refsource_MISCWEB
- www.oracle.com/security-alerts/cpujan2020.htmlghsax_refsource_MISCWEB
- www.oracle.com/security-alerts/cpujul2020.htmlghsax_refsource_MISCWEB
- www.oracle.com/security-alerts/cpuoct2020.htmlghsax_refsource_MISCWEB
- www.oracle.com/technetwork/security-advisory/cpuapr2019-5072813.htmlghsax_refsource_MISCWEB
- www.oracle.com/technetwork/security-advisory/cpujan2019-5072801.htmlghsax_refsource_CONFIRMWEB
- www.oracle.com/technetwork/security-advisory/cpujul2019-5072835.htmlghsax_refsource_MISCWEB
- www.oracle.com/technetwork/security-advisory/cpuoct2019-5072832.htmlghsax_refsource_MISCWEB
- www.tenable.com/security/tns-2019-08ghsax_refsource_CONFIRMWEB
News mentions
0No linked articles in our index yet.