XSS via JQLite DOM manipulation functions in AngularJS
Summary
XSS may be triggered in AngularJS applications that sanitize user-controlled HTML snippets before passing them to JQLite methods like JQLite.prepend, JQLite.after, JQLite.append, JQLite.replaceWith, JQLite.append, new JQLite and angular.element.
Description
JQLite (DOM manipulation library that's part of AngularJS) manipulates input HTML before inserting it to the DOM in jqLiteBuildFragment.
One of the modifications performed expands an XHTML self-closing tag.
If jqLiteBuildFragment is called (e.g. via new JQLite(aString)) with user-controlled HTML string that was sanitized (e.g. with DOMPurify), the transformation done by JQLite may modify some forms of an inert, sanitized payload into a payload containing JavaScript - and trigger an XSS when the payload is inserted into DOM.
This is similar to a bug in jQuery htmlPrefilter function that was fixed in 3.5.0.
Proof of concept
const inertPayload = `<div><style><style/><img src=x onerror="alert(1337)"/>`
Note that the style element is not closed and <img would be a text node inside the style if inserted into the DOM as-is.
As such, some HTML sanitizers would leave the <img as is without processing it and stripping the onerror attribute.
angular.element(document).append(inertPayload);
This will alert, as <style/> will be replaced with <style></style> before adding it to the DOM, closing the style element early and reactivating img.
Patches
The issue is patched in JQLite bundled with angular 1.8.0. AngularJS users using JQuery should upgrade JQuery to 3.5.0, as a similar vulnerability affects jQuery <3.5.0.
Workarounds
Changing sanitizer configuration not to allow certain tag grouping (e.g. <option><style></option>) or inline style elements may stop certain exploitation vectors, but it's uncertain if all possible exploitation vectors would be covered. Upgrade of AngularJS to 1.8.0 is recommended.
References
https://github.com/advisories/GHSA-mhp6-pxh8-r675 https://github.com/jquery/jquery/security/advisories/GHSA-gxr4-xjj5-5px2 https://github.com/jquery/jquery/security/advisories/GHSA-jpcq-cgw6-v4j6 https://blog.jquery.com/2020/04/10/jquery-3-5-0-released/ https://snyk.io/vuln/SNYK-JS-ANGULAR-570058
Affected software
Click a technology to see all vulnerabilities affecting it.
| Platform | Package | Vulnerable versions | Fixed in |
|---|---|---|---|
| npm package | angular | < 1.8.0 | 1.8.0 |
References
- https://github.com/google/security-research/security/advisories/GHSA-5cp4-xmrw-59wf
- https://github.com/jquery/jquery/security/advisories/GHSA-gxr4-xjj5-5px2
- https://github.com/jquery/jquery/security/advisories/GHSA-jpcq-cgw6-v4j6
- https://blog.jquery.com/2020/04/10/jquery-3-5-0-released
- https://github.com/advisories/GHSA-mhp6-pxh8-r675
- https://github.com/angular/angular.js
- https://snyk.io/vuln/SNYK-JS-ANGULAR-570058
- CVSS vector
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L- Weakness (CWE)
CWE-79- Platform
- npm
- Package
angular- Disclosed
- 05.08.2020
- Updated
- 11.10.2026 10:22
Sources and licenses
OSV / GitHub Advisory Database - GHSA-5cp4-xmrw-59wf - CC BY 4.0
Vulnerability history: angular
All published vulnerabilities of this package (npm package), newest first. Shows whether this is a one-off slip or a package that needs watching.
- Total entries
- 15
- First → latest
- 06.2019 06.2026
- Without a fix
- 10
- Exploited in attacks
- 0
Severity breakdown
- High 3
- Medium 9
- Low 3
Disclosures per year
- 2019: 2
- 2020: 3
- 2021: 0
- 2022: 2
- 2023: 3
- 2024: 3
- 2025: 1
- 2026: 1
-
XSS via JQLite DOM manipulation functions in AngularJS this entry
Know which vulnerabilities affect your application
With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.