Cross-site scripting in jQuery via cross-domain Ajax without dataType

Note: This data is for reference and cybersecurity research purposes only.CyStack advises users not to use this information for unlawful purposes.

Overview

Original source data

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.

Affected products and scope

All versions of jQuery prior to the fix are affected. Any application that bundles an affected jQuery build and makes cross-domain Ajax requests without an explicit dataType is vulnerable. The record lists numerous Oracle products as downstream affected, spanning banking, insurance, healthcare, hospitality, and communications verticals.

Technical details

The weakness is in jQuery's handling of Ajax responses. When jQuery performs a cross-domain Ajax request and the dataType option is not set, it relies on the response Content-Type header to decide how to process the body. If the server responds with text/javascript, jQuery evaluates the response body as a script. This turns any third-party endpoint that an application calls via cross-domain Ajax into a potential code injection point if that endpoint is compromised or if the response is intercepted in transit.

Exploitability

The attack vector is network-based with low complexity. No authentication is required, but user interaction is needed: the victim must visit a page that triggers the vulnerable cross-domain Ajax call. The scope is changed, meaning the attacker's script executes in a different origin than the application itself. No public exploitation has been reported.

Technical impact

An attacker who can control or intercept the response from a cross-origin endpoint gains the ability to execute arbitrary JavaScript in the victim's browser within the application's security context. From there they can read DOM content, access non-HttpOnly cookies, make further authenticated requests on behalf of the user, and potentially escalate to more serious compromise depending on what the application exposes to its own client-side code.

Business impact

An attacker who can position themselves between a user and a third-party API, or who controls that API, can execute arbitrary JavaScript in the context of an application that bundles an affected jQuery build. This can lead to session theft, data exfiltration from the application, or page defacement. Because the injected script runs in the application's own security context, it inherits the application's access to cookies, local storage, and authenticated requests. Organisations running web applications that bundle an affected jQuery version and make cross-domain Ajax calls without an explicit dataType are in scope. This includes a large number of Oracle products that embed jQuery in their web interfaces.

Remediation

Upgrade jQuery to the fixed version. If an immediate upgrade is not possible, audit all cross-domain Ajax calls in the application and add an explicit dataType option (such as json or text) so that responses are never interpreted as executable script. For Oracle products, apply the vendor patch released in their regular Critical Patch Update cycle.

Detection

Review JavaScript source for $.ajax, $.get, $.post, or similar jQuery Ajax calls that target a different origin and lack a dataType parameter. Check the version of jQuery loaded by the application against the fixed version. Inspect cross-origin endpoints to identify any that return a text/javascript Content-Type, which would indicate the condition for exploitation is met.

Sources (45)
Learn more

Run an in-depth assessment with complete web risk management

CyStack VulnScan continuously discovers assets, validates vulnerabilities, and helps security teams prioritize remediation across the organization.