The maintainers of Angular, the popular platform for building mobile and desktop web applications, have released an important security advisory regarding a high-severity vulnerability in the Angular Template Compiler. Tracked as CVE-2025-66412 with a CVSS score of 8.5, the flaw allows attackers to bypass the framework’s built-in security mechanisms and inject malicious scripts via Scalable Vector Graphics (SVG) and MathML elements.
The vulnerability stems from an oversight in how the Angular compiler categorizes specific HTML attributes. Typically, Angular sanitizes inputs to prevent Cross-Site Scripting (XSS). However, the advisory reveals that “the compiler’s internal security schema is incomplete, allowing attackers to bypass Angular’s built-in security sanitization.”
The core issue lies in the schema failing to flag certain URL-holding attributes as security-sensitive. Specifically, attributes within SVG (such as xlink:href) and MathML (such as math | href) were not strictly validated, creating a loophole for “enabling the injection of malicious scripts.”
Perhaps the most sophisticated aspect of this vulnerability involves SVG animation elements like <animate>, <set>, and <animateMotion>.
Attackers can exploit the attributeName attribute on these elements. The advisory notes that “the attributeName attribute on these elements was not properly validated, allowing attackers to dynamically target security-sensitive attributes like href or xlink:href on other elements.”
By manipulating this binding, an attacker can dynamically assign a malicious javascript: URL to a target attribute. “Upon user interaction (like a click) on the element, or automatically in the case of animations, the malicious JavaScript executes in the context of the application’s origin.”
Because this is a Stored XSS vulnerability, the malicious payload is saved on the server (e.g., in a database) and then served to victims. The potential damage is significant.
According to the report, “When exploited, this vulnerability allows an attacker to execute arbitrary code within the context of the vulnerable application’s domain.” This access enables attackers to perform:
- Session Hijacking: “Stealing session cookies and authentication tokens.”
- Data Exfiltration: “Capturing and transmitting sensitive user data.”
- Unauthorized Actions: Performing operations on the site as if they were the victim.
The Angular team has released patches across multiple major versions to address this flaw. Developers are strongly urged to update their dependencies to the following versions immediately:
- 19.2.17
- 20.3.15
- 21.0.2
For organizations unable to upgrade immediately, the advisory suggests strict input hygiene. Developers must ensure that data bound to vulnerable attributes is “never sourced from untrusted user input (e.g., database, API response, URL parameters).”
Additionally, configuring a robust Content Security Policy (CSP) that disallows javascript: URLs can provide a layer of defense against this exploit.