5.3medium
Angular: Template and Attribute Namespace Sanitization Bypass (XSS)
- Severity
- 5.3medium CVSS:4.0 by GitHub_M
- Exploit likelihood
- 0.24% (higher than 16% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-f3m7-gqxr-g87x
Description
Angular is a development platform for building mobile and desktop web applications using TypeScript/JavaScript and other languages. Prior to 22.0.0-rc.2, 21.2.15, 20.3.22 and 19.2.22, an issue in the @angular/compiler and @angular/core packages allows bypassing element and attribute sanitization/validation through specific namespace workarounds. Specifically, namespaced script elements (e.g., <svg:script> or <:svg:script>) were not properly identified as script elements by the Angular template preparser, allowing them to pass through template compilation without being stripped. Furthermore, security context schema mappings for element attributes did not consistently handle attributes within namespaced elements (like SVG and MathML), opening up gaps where malicious namespaced attributes could bypass runtime and compile-time sanitizers. Combined, these flaws enable an attacker who can inject or supply a template/tag structure with custom namespaces to bypass Angular's script-stripping logic and attribute sanitizers, leading to client-side Cross-Site Scripting (XSS). This vulnerability is fixed in 22.0.0-rc.2, 21.2.15, 20.3.22 and 19.2.22.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| angular angular | >= 21.0.0-next.0 < 21.2.15, >= 22.0.0-next.0 < 22.0.0-rc.2, >= 20.0.0-next.0 < 20.3.22, >= 19.0.0-next.0 < 19.2.22, <= 18.2.14, up to 18.2.14, from 19.0.0 before 19.2.22, from 20.0.0 before 20.3.22 and 2 more | CVE List, NVD |
| @angular/core (npm) | from 21.0.0-next.0 before 21.2.15, from 22.0.0-next.0 before 22.0.0-rc.2, from 20.0.0-next.0 before 20.3.22, from 19.0.0-next.0 before 19.2.22, up to 18.2.14 | GitHub Advisory Database |
| @angular/compiler (npm) | from 21.0.0-next.0 before 21.2.15, from 22.0.0-next.0 before 22.0.0-rc.2, from 20.0.0-next.0 before 20.3.22, from 19.0.0-next.0 before 19.2.22, up to 18.2.14 | GitHub Advisory Database |
All scores
| GitHub_M | 5.3medium CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N |
| GitHub | 6.1medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N |
| GitHub | medium CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N |
| NVD | 6.1medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N |
Classification
SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial.
What each source says
CVE List
Angular is a development platform for building mobile and desktop web applications using TypeScript/JavaScript and other languages. Prior to 22.0.0-rc.2, 21.2.15, 20.3.22 and 19.2.22, an issue in the @angular/compiler and @angular/core packages allows bypassing element and attribute sanitization/validation through specific namespace workarounds. Specifically, namespaced script elements (e.g., <svg:script> or <:svg:script>) were not properly identified as script elements by the Angular template preparser, allowing them to pass through template compilation without being stripped. Furthermore, security context schema mappings for element attributes did not consistently handle attributes within namespaced elements (like SVG and MathML), opening up gaps where malicious namespaced attributes could bypass runtime and compile-time sanitizers. Combined, these flaws enable an attacker who can inject or supply a template/tag structure with custom namespaces to bypass Angular's script-stripping logic and attribute sanitizers, leading to client-side Cross-Site Scripting (XSS). This vulnerability is fixed in 22.0.0-rc.2, 21.2.15, 20.3.22 and 19.2.22.
GitHub Advisory Database
An issue in the @angular/compiler and @angular/core packages allows bypassing element and attribute sanitization/validation through specific namespace workarounds.
Specifically, namespaced script elements (e.g., <svg:script> or <:svg:script>) were not properly identified as script elements by the Angular template preparser, allowing them to pass through template compilation without being stripped.
Furthermore, security context schema mappings for element attributes did not consistently handle attributes within namespaced elements (like SVG and MathML), opening up gaps where malicious namespaced attributes could bypass runtime and compile-time sanitizers.
Combined, these flaws enable an attacker who can inject or supply a template/tag structure with custom namespaces to bypass Angular's script-stripping logic and attribute sanitizers, leading to client-side Cross-Site Scripting (XSS).
Impact
Any Angular application that compiles user-controlled templates at runtime, or relies on sanitization of namespaced elements/attributes, is vulnerable to this security bypass.
Once exploited, this allows a malicious actor to inject a namespaced script element or dynamic attribute bindings, bypassing core sanitization constraints to execute arbitrary JavaScript within the target user's browser context. This could lead to session hijacking, sensitive data exposure, or unauthorized actions on behalf of the user.
Attack Preconditions
To successfully exploit these vulnerabilities, the following environment parameters and application states must all concurrently exist:
- User-Controlled Template Input: The application must accept user-controlled inputs that are directly processed by the Angular template compiler at runtime.
- Namespace Parsing Support: The input structure must employ custom namespace prefixes (such as
<svg:script>) to evade standard tag-name blocklists/checks. - Absence of Additional Context Sanitization: The application does not perform separate input sanitization before feeding values to the Angular compiler.
Patches
- 22.0.0-rc.2
- 21.2.15
- 20.3.22
- 19.2.23
References
| https://github.com/angular/angular/security/advisories/GHSA-f3m7-gqxr-g87x | third-party-advisory, web | |
| https://github.com/angular/angular/pull/68689 | issue-tracking, patch, web | |
| https://github.com/angular/angular/pull/68868 | issue-tracking, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2026-50557 | advisory | |
| https://github.com/angular/angular | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-50557 changed 2026-06-22 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-f3m7-gqxr-g87x changed 2026-09-10 | CC-BY-4.0 |
| NVD | CVE-2026-50557 changed 2026-07-09 | Public domain |