Junglewise Threat Intelligence

CVE-2021-4231: Angular XSS via HTML comment handling

CVE-2021-4231 · Severity: low · CVSS 3.1 · Published 2022-05-27

Vendors: Google.

Executive brief

Angular, a popular web framework used to build dynamic web applications, is vulnerable to Cross-Site Scripting (XSS) attacks through improper handling of HTML comments. An attacker with application access can inject malicious scripts into comments, potentially allowing them to execute code in other users' browsers and steal sensitive data or perform unauthorized actions.

Technical details

The vulnerability is a Cross-Site Scripting (CWE-79) flaw in Angular's comment handling logic. The root cause is improper escaping of content inserted into HTML comment nodes; attackers can craft specially-formed strings that break out of comment delimiters ("-->") despite the lack of standard HTML escaping mechanisms. The attack requires authentication and user interaction to exploit. An attacker can inject malicious JavaScript that executes in the context of other users' browsers, potentially leading to session hijacking, credential theft, or data exfiltration. Patches are available in Angular versions 10.2.5, 11.0.5, and 11.1.0-next.3.

Affected products

  • Google Angular up to 11.0.4, 11.1.0-next.2, and prior versions

Timeline

  • 2022-05-26: disclosed: NVD published date
  • 2022-05-27: patched: Advisory released; patches available in v10.2.5, v11.0.5, v11.1.0-next.3

References