Angular XSS Flaw Bypasses Sanitization via SVG Script Tags
CVE-2026-22610 lets attackers inject JavaScript through SVG script attributes that Angular's sanitizer fails to recognize. Patches available for versions 19-21.
A cross-site scripting vulnerability in Angular's template compiler allows attackers to bypass built-in security protections by exploiting SVG script element attributes. CVE-2026-22610 affects Angular versions 18 through 21 and carries a CVSS score of 8.5 (High).
The flaw stems from Angular's sanitization schema failing to recognize that SVG <script> elements use different attributes than HTML <script> elements. While Angular properly sanitizes src attributes on HTML scripts, it misses href and xlink:href on SVG scripts—allowing injection of malicious JavaScript.
How the Vulnerability Works
Angular includes robust XSS protections that automatically sanitize untrusted content in templates. When developers bind data to potentially dangerous contexts like URLs or HTML, Angular's sanitizer validates and strips malicious payloads.
The sanitizer knows that <script src="..."> in HTML can load arbitrary JavaScript and treats the src attribute as a "Resource URL context" requiring strict validation. External scripts, data URIs containing code, and other dangerous values get blocked.
SVG elements follow different conventions. The <script> element in SVG uses href and xlink:href attributes rather than src. Angular's sanitization schema didn't classify these attributes as Resource URL contexts, creating a bypass.
An attacker can craft a payload like:
<svg>
<script href="data:text/javascript,alert('XSS')"></script>
</svg>
If an Angular application binds attacker-controlled data to the href attribute of an SVG script element, the sanitizer passes it through unchanged. The browser executes the injected JavaScript in the context of the vulnerable page.
Exploitation Requirements
Not every Angular application is vulnerable. Successful exploitation requires three conditions:
- The application uses SVG
<script>elements in templates (uncommon but not rare in visualization-heavy applications) - The template uses property or attribute binding for
hreforxlink:hrefon those SVG scripts - The bound data originates from an untrusted source—URL parameters, user database entries, or unsanitized API responses
Applications that don't use SVG scripts or don't dynamically bind their URL attributes remain unaffected. But for those that do, the impact is significant.
Impact
Successful XSS exploitation enables:
- Session hijacking - Stealing authentication cookies and tokens
- Data exfiltration - Reading sensitive information displayed in the application
- Unauthorized actions - Clicking buttons, submitting forms, or calling APIs on behalf of the victim
- Credential theft - Injecting fake login forms to capture passwords
- Malware distribution - Redirecting users to malicious sites
The vulnerability is particularly concerning for applications handling sensitive data or administrative functions. An XSS flaw in an admin panel could compromise the entire system.
Affected and Patched Versions
| Affected | Fixed |
|---|---|
| 18.2.14 and earlier | No patch (end-of-life) |
| 19.0.0-next.0 to 19.2.17 | 19.2.18 |
| 20.0.0-next.0 to 20.3.15 | 20.3.16 |
| 21.0.0-next.0 to 21.0.6 | 21.0.7 |
| 21.1.0-next.0 to before 21.1.0-rc.0 | 21.1.0-rc.0 |
Organizations running Angular 18 or earlier face a harder decision. Those versions are end-of-life and won't receive security updates. Upgrading to a supported version is the only remediation path.
Temporary Mitigations
If immediate patching isn't possible:
- Audit SVG script usage - Search your codebase for
<script>elements within SVG contexts - Remove dynamic bindings - Don't bind
[attr.href]or[attr.xlink:href]on SVG scripts - Validate input server-side - If dynamic values must be used, validate against a strict allowlist of trusted URLs before they reach the template
- Content Security Policy - A restrictive CSP can limit damage from successful XSS, though it won't prevent the vulnerability
Why This Matters
Angular powers thousands of enterprise web applications. The framework's built-in security features—including automatic sanitization—give developers confidence that XSS vulnerabilities are handled by default. When that sanitization fails, applications that seemed secure become vulnerable.
The SVG-specific nature of this flaw highlights how subtle differences between HTML and SVG can create security gaps. Both use similar elements and attributes, but browsers handle them differently. Security tools and frameworks must account for these differences to provide comprehensive protection.
Development teams should update to patched Angular versions and audit their codebases for SVG script bindings. The 8.5 CVSS score reflects the potential severity when exploitation conditions align.
Related Articles
Cisco Patches ISE Flaw After Public PoC Exploit Emerges
CVE-2026-20029 lets authenticated admins read restricted system files through XML parsing weakness. Trend Micro ZDI researcher found the bug; no workarounds available.
Jan 11, 2026Cisco Snort 3 Flaws Enable DoS and Data Leaks
CVE-2026-20026 and CVE-2026-20027 allow remote attackers to crash Snort or extract sensitive data. No workarounds exist—patches are the only fix.
Jan 10, 2026Coolify Command Injection Flaws Grant Root Access
Five critical vulnerabilities in the self-hosting platform allow authenticated users to execute arbitrary commands as root. Over 52,000 instances are exposed globally.
Jan 10, 2026jsPDF Flaw Lets Attackers Embed Local Files in PDFs
CVE-2025-68428 enables path traversal in the popular JavaScript PDF library, allowing attackers to read arbitrary files from Node.js servers and exfiltrate them via generated documents.
Jan 9, 2026