Overview
AngularJS is a JavaScript framework for developing dynamic web applications. It lets you use HTML as your template language and lets you extend HTML's syntax to express your application's components clearly and succinctly.
A Regular expression Denial of Service (ReDoS) vulnerability (CVE-2022-25844) has been identified in AngularJS, which could allow attackers to provide a large, carefully-crafted input that causes a Denial of Service of the application.
Per OWASP: The Regular expression Denial of Service (ReDoS) is a Denial of Service attack that exploits the fact that most Regular Expression implementations may reach extreme situations that cause them to work very slowly (exponentially related to input size). An attacker can then cause a program using a Regular Expression (Regex) to enter these extreme situations and then hang for a very long time.
This issue affects AngularJS versions 1.7.0 and greater.
Details
Module Info
- Product: AngularJS
- Affected packages: angular
- Affected versions: >=1.7.0
- GitHub repository: https://github.com/angular/angular.js
- Published packages: https://www.npmjs.com/package/angular
- Package manager: npm
- Fixed in: AngularJS NES v1.8.8
Vulnerability Info
This Medium-severity vulnerability is found in the main angular package in AngularJS versions 1.7.0 and greater.
AngularJS' localization utilities allow formatting numbers as currency values. If an application sets the current locale's NUMBER_FORMATS.PATTERNS[1].posPre value to a user-defined string, it can be abused to cause a Denial of Service of the appication.
Steps to Reproduce
- Create an AngularJS application and set the $locale's prePos value to a string consisting of many spaces:
- Run the currency filter on a value with the empty string as the currency symbol. This can be done either in a template (with {{ 100 | currency : '' }}) or by calling the filter directly:
Proof of Concept
A full reproduction with code similar to the above can be found here:
currency filter ReDoS POC
Mitigation
The AngularJS project is End-of-Life and will not receive any updates to address this issue. For more information see here.
Users of the affected components should apply one of the following mitigations:
- Migrate affected applications away from AngularJS.
- Leverage a commercial support partner like HeroDevs for post-EOL security support.