Angular Cross-Site Scripting (XSS) Vulnerability
A cross-site scripting (XSS) vulnerability exists in Angular versions prior to 22.0.0-next.3, 21.2.4, 20.3.18, and 19.2.20, allowing attackers to execute arbitrary code within the context of the vulnerable application, potentially leading to session hijacking, data exfiltration, and unauthorized actions.
A cross-site scripting (XSS) vulnerability has been identified in the Angular framework, specifically affecting versions prior to 22.0.0-next.3, 21.2.4, 20.3.18, and 19.2.20. The vulnerability stems from the interaction between security-sensitive attributes (e.g., href) and Angular’s internationalization features. When internationalization is enabled for such attributes using i18n-name, the built-in sanitization mechanisms can be bypassed. This can be exploited by injecting malicious scripts through data bindings that handle untrusted, user-generated data. Successful exploitation allows an attacker to execute arbitrary code within the context of the affected application’s domain. Immediate patching is strongly advised.
Attack Chain
- The attacker identifies an Angular application using a vulnerable version (prior to 22.0.0-next.3, 21.2.4, 20.3.18, or 19.2.20).
- The attacker locates an input field or URL parameter that allows the injection of user-controlled data into an
hrefattribute (or another security-sensitive attribute). - The attacker crafts a malicious payload containing JavaScript code. The payload leverages the
i18n-nameattribute in conjunction with data binding to bypass sanitization. - The attacker injects the malicious payload into the targeted input field or URL parameter.
- The victim user interacts with the application, triggering the rendering of the malicious payload within the vulnerable attribute.
- The injected JavaScript code executes within the victim’s browser, operating under the security context of the Angular application’s domain.
- The attacker gains the ability to perform actions such as stealing session cookies or authentication tokens (session hijacking).
- The attacker can then exfiltrate sensitive data or perform unauthorized actions on behalf of the user.
Impact
Successful exploitation of this XSS vulnerability allows attackers to execute arbitrary code within the context of the vulnerable Angular application. This can lead to session hijacking, enabling attackers to impersonate users and access their data. Data exfiltration is also possible, allowing attackers to steal sensitive information such as personal data or financial details. Furthermore, attackers can perform unauthorized actions on behalf of the user, potentially leading to financial loss, reputational damage, or other adverse consequences. The CCB strongly recommends immediate patching.
Recommendation
- Upgrade Angular installations to versions 22.0.0-next.3, 21.2.4, 20.3.18, or 19.2.20 to remediate the vulnerability as per the vendor advisory (https://github.com/angular/angular/security/advisories/GHSA-g93w-mfhg-p222).
- Implement a Web Application Firewall (WAF) with rules to detect and block common XSS payloads. This can provide an additional layer of defense against exploitation attempts.
- Enable and review web server access logs for suspicious activity and potential XSS attempts. Analyze logs for unusual URL parameters or POST data containing script-like syntax.
Detection coverage 2
Detect Suspicious URI with common XSS patterns
highDetects potential XSS attempts in URI parameters using common XSS patterns
Detect Suspicious POST Request with common XSS patterns
highDetects potential XSS attempts in POST data using common XSS patterns
Detection queries are kept inside the platform. Get full rules →