Cross-site scripting in jquery jQuery can execute untrusted code

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

What is CVE-2020-11022?

CVE-2020-11022 is a vulnerability classified as Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), affecting jQuery (affected versions: >= 1.12.0, < 3.5.0). This vulnerability is rated Medium, with a CVSS score of 6.9. Public exploit code or evidence is available for this vulnerability, but that does not confirm exploitation in the wild.

Overview

Original source data

In jQuery starting with 1.12.0 and before 3.5.0, passing HTML from untrusted sources - even after sanitizing it - to one of jQuery's DOM manipulation methods (i.e..html(),.append(), and others) may execute untrusted code. This problem is patched in jQuery 3.5.0.

Affected products and scope

The CNA product facts identify jQuery as affected in >= 1.12.0, < 3.5.0. jQuery 3.5.0 is the confirmed patched release for the library. The GitHub advisory also maps downstream packages to separate boundaries: jquery-rails < 4.4.0, patched in 4.4.0; maximebf/debugbar < 1.19.0, patched in 1.19.0; and org.webjars.npm:jquery >= 1.12.0, < 3.5.0, patched in 3.5.0. The supplied evidence also contains NVD CPE enrichment beginning at 1.2, which is broader than and not fully consistent with the CNA range, so the status of jQuery 1.2.x through 1.11.x is not confirmed by the CNA product facts.

Technical details

Legacy jQuery htmlPrefilter used a regular expression to rewrite XHTML-like self-closing tags before the string was processed by DOM manipulation methods. The jQuery team documented that edge cases in this rewrite could mutate HTML that had already been sanitized, allowing untrusted code to execute when the resulting string reached methods such as .html() and .append(). The patch changes htmlPrefilter to return its input unchanged, removing the risky rewrite step. Exploitability therefore depends on an application passing user-controlled or otherwise untrusted HTML through the affected processing path; the exact application route and payload are not established by the available evidence. The supplied record supports network reachability, no required privileges, and required user interaction.

Exploitability

  • The issue is reachable over the network when a web application passes untrusted HTML into affected DOM manipulation methods.
  • The attacker does not need authenticated privileges, but a user must interact with or load the affected page through a suitable application flow.
  • The CNA characterizes attack complexity as high, while another assessment in the supplied record characterizes it as low. Practical exploitability depends on how the application receives and passes HTML.
  • The normalized record marks public exploit material as available, but it does not name a specific exploit, campaign, victim, or confirmed in-the-wild incident.

Technical impact

When the required processing conditions are present, attacker-controlled HTML can result in script execution in the web page's context. Consequences may include reading data accessible to the page, changing page content or state, and performing actions within the permissions of the interacting user. The supplied record indicates that scope can extend from the library into the consuming application and does not indicate an availability impact; the issue does not by itself establish server-side code execution. Exposure is limited to applications that actually pass untrusted HTML through the relevant processing paths.

Business impact

  • Malicious script may run in the browser context of an affected page and may be able to read data accessible to that page or modify its visible state.
  • Depending on the page's permissions and the user's session, the executed code may perform actions on behalf of the user within the application's scope.
  • Organizations may need to investigate vendored or bundled jQuery copies across multiple applications and test compatibility changes introduced by the upgrade.
  • The available evidence does not establish a specific breach, data loss event, or service outage. Actual consequences depend on the data and permissions available to the page using jQuery.

Remediation

  1. Upgrade jQuery to 3.5.0, the confirmed patched release, after testing changes related to self-closing tags and invalid HTML handling.
  2. Check vendored, bundled, CDN-delivered, and downstream copies. Updating a dependency manifest alone is not sufficient if deployed assets still contain an older jQuery copy.
  3. If an upgrade is not yet possible, the advisory provides a workaround by setting jQuery.htmlPrefilter = function( html ) { return html; };. The advisory describes this as applicable to versions that support the override, at least jQuery 1.12 or 2.2 and newer, and it must be tested in the application.
  4. Do not restore the legacy htmlPrefilter as a substitute security fix. The jQuery upgrade guide warns that restoring the old behavior loses the security fix and that regular HTML sanitizing may not be sufficient.
  5. After the change, review sanitizers and every flow that passes HTML to DOM manipulation methods, then run regression tests for components that depend on self-closing tags.

Detection

  • Inventory deployed JavaScript assets, SBOMs, lockfiles, and dependency manifests to identify jQuery loaded directly or bundled into an application.
  • Check related package and deployment identifiers such as jquery, components/jquery, jquery-rails, maximebf/debugbar, and org.webjars.npm:jquery, then compare the deployed versions with the affected boundaries.
  • Review source for .html(), .append(), and other DOM manipulation methods receiving HTML from requests, user input, or external sources, including HTML that has passed through a sanitizer.
  • Check for assignments to jQuery.htmlPrefilter or code that restores the legacy prefilter, because these changes can affect whether the security fix is effective and how jQuery parses HTML.
  • CSP violation reports and browser telemetry can be reviewed for unexpected script execution as precautionary monitoring. No specific indicator of compromise is established in the available evidence, and absence of log evidence does not prove safety.
Sources (80)
GitHub_M (CNA)
lists.apache.org
r49ce4243b4738dd763caeb27fa8ad6afb426ae3e8c011ff00b8b1f48@<issues.flink.apache.org>r54565a8f025c7c4f305355fdfd75b68eca442eebdb5f31c2e7d977ae@<issues.flink.apache.org>r564585d97bc069137e64f521e68ba490c7c9c5b342df5d73c49a0760@<issues.flink.apache.org>r706cfbc098420f7113968cc377247ec3d1439bce42e679c11c609e2d@<issues.flink.apache.org>r8f70b0f65d6bedf316ecd899371fd89e65333bc988f6326d2956735c@<issues.flink.apache.org>rbb448222ba62c430e21e13f940be4cb5cfc373cd3bce56b48c0ffa67@<dev.flink.apache.org>rdf44341677cf7eec7e9aa96dcf3f37ed709544863d619cca8c36f133@<commits.airflow.apache.org>re4ae96fa5c1a2fe71ccbb7b7ac1538bd0cb677be270a2bf6e2f8d108@<issues.flink.apache.org>rede9cfaa756e050a3d83045008f84a62802fc68c17f2b4eabeaae5e4@<issues.flink.apache.org>ree3bd8ddb23df5fa4e372d11c226830ea3650056b1059f3965b3fce2@<issues.flink.apache.org>r0483ba0072783c2e1bfea613984bfb3c86e73ba8879d780dc1cc7d36@<issues.flink.apache.org>r49ce4243b4738dd763caeb27fa8ad6afb426ae3e8c011ff00b8b1f48@<issues.flink.apache.org>r54565a8f025c7c4f305355fdfd75b68eca442eebdb5f31c2e7d977ae@<issues.flink.apache.org>r564585d97bc069137e64f521e68ba490c7c9c5b342df5d73c49a0760@<issues.flink.apache.org>r706cfbc098420f7113968cc377247ec3d1439bce42e679c11c609e2d@<issues.flink.apache.org>r8f70b0f65d6bedf316ecd899371fd89e65333bc988f6326d2956735c@<issues.flink.apache.org>rbb448222ba62c430e21e13f940be4cb5cfc373cd3bce56b48c0ffa67@<dev.flink.apache.org>rdf44341677cf7eec7e9aa96dcf3f37ed709544863d619cca8c36f133@<commits.airflow.apache.org>re4ae96fa5c1a2fe71ccbb7b7ac1538bd0cb677be270a2bf6e2f8d108@<issues.flink.apache.org>rede9cfaa756e050a3d83045008f84a62802fc68c17f2b4eabeaae5e4@<issues.flink.apache.org>ree3bd8ddb23df5fa4e372d11c226830ea3650056b1059f3965b3fce2@<issues.flink.apache.org>
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.