XSS Vulnerability in AngularJS
Summary
GHSA-5cp4-xmrw-59wf: XSS via JQLite DOM manipulation functions in AngularJS. Affects angular versions < 1.8.0. Fixed in 1.8.0. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
AngularJS is an open-source JavaScript framework used for building dynamic web applications. It provides a set of tools and functionalities for creating single-page applications. The vulnerability in AngularJS allows for cross-site scripting (XSS) attacks when user-controlled HTML snippets are sanitized and passed to certain JQLite DOM manipulation functions.
Vulnerability Detail
The XSS vulnerability in AngularJS arises from the way JQLite, a DOM manipulation library within AngularJS, modifies input HTML before inserting it into the DOM. When JQLite's jqLiteBuildFragment function is called with a user-controlled HTML string that has been sanitized, the transformation performed by JQLite can inadvertently convert an inert, sanitized payload into a payload containing JavaScript. This can lead to the execution of arbitrary code and potential XSS attacks when the payload is inserted into the DOM. The vulnerability is similar to a bug in jQuery's htmlPrefilter function, which was fixed in jQuery 3.5.0.
How To Fix
Minimum fixed version
1.8.0
This is the first release that contains the fix.
npm install angular@1.8.0
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
A possible workaround for this vulnerability is to change the configuration of the HTML sanitizer to disallow certain tag groupings or inline style elements that may be exploited. However, it is uncertain if all possible exploitation vectors would be covered by this workaround. Therefore, upgrading to AngularJS 1.8.0 is the recommended solution.
Conclusion
The XSS vulnerability in AngularJS can have serious security implications for web applications. It is crucial to upgrade to the patched version of AngularJS (1.8.0) and, if applicable, upgrade jQuery to version 3.5.0 or higher. Regularly monitoring for vulnerabilities using tools like Vulert can help ensure the security of your applications.
See every vulnerability recorded for angular →
FAQ
AngularJS is an open-source JavaScript framework for building dynamic web applications. It provides a set of tools and functionalities for creating single-page applications.
JQLite is a DOM manipulation library that is part of AngularJS. It allows developers to interact with the DOM and perform various operations on HTML elements.
The XSS vulnerability in AngularJS can allow attackers to execute arbitrary code and perform cross-site scripting attacks. This can lead to unauthorized access, data theft, and other malicious activities.
To fix this vulnerability, you should upgrade to AngularJS 1.8.0 or higher. If you are using AngularJS with jQuery, it is also recommended to upgrade jQuery to version 3.5.0 or higher.
A possible workaround is to change the configuration of the HTML sanitizer to disallow certain tag groupings or inline style elements that may be exploited. However, this may not cover all possible exploitation vectors.
References
Related vulnerabilities
Recent vulnerabilities recorded for angular.