MEDIUM 6.1

CVE-2026-52725: Angular Script Injection via Dynamic Component Creation

Angular's dynamic component creation feature contains a security flaw that allows attackers to bypass script-execution protections. When an Angular application dynamically creates a component, the framework should prevent mounting that component onto dangerous HTML elements like <script> tags. This vulnerability fails to enforce that restriction, meaning an attacker who can control where a component is mounted could force it onto a script tag, causing arbitrary JavaScript code to execute in the user's browser. This is a client-side XSS vulnerability that requires user interaction and control over component placement to exploit.

Source data · NVD / CISA · public domain

CVSS
3.1 · 6.1 MEDIUM · CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Weaknesses (CWE)
CWE-79
Affected products
16 configuration(s)
Published / Modified
2026-06-22 / 2026-07-09

NVD description (verbatim)

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.23, an issue in the @angular/core package allows bypassing script-execution restrictions during dynamic component creation. Specifically, the dynamic component instantiation mechanism (createComponent) failed to reject mounting components directly onto a <script> or namespaced script element (such as <svg:script>). This enabled the initialization of custom components on a tag that executes scripts, allowing attackers to hijack or inject script-executing hosts. This flaw enables an attacker who can control the host element or selector parameter passed to createComponent to initialize or mount an Angular component directly onto a <script> tag, leading to execution of untrusted code or 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.23.

3 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

The @angular/core package's createComponent API fails to validate and reject host elements that are script-execution contexts. Specifically, when instantiating dynamic components, the framework does not prevent attachment to <script> elements or namespaced variants such as <svg:script>. An attacker controlling the host element selector or the mounting context can leverage this to initialize a component on a script tag, triggering script execution. The vulnerability stems from insufficient validation in the dynamic component instantiation mechanism prior to DOM attachment. This affects Angular versions prior to 22.0.0-rc.2, 21.2.15, 20.3.22, and 19.2.23. The CVSS 3.1 score of 6.1 (MEDIUM) reflects network exploitability, low attack complexity, no privilege requirement, and user interaction as a prerequisite.

Business impact

Applications using vulnerable Angular versions in user-facing web interfaces face elevated XSS risk. If an attacker can influence which component gets mounted or where it mounts—through malicious input, compromised third-party libraries, or insecure application logic—they can execute arbitrary JavaScript with the same privileges as the web application. This could enable credential theft, session hijacking, defacement, or exfiltration of sensitive user data. The attack requires user interaction, limiting the scope somewhat, but the consequence is full client-side compromise. Development teams relying on Angular's security model must patch immediately to restore the intended protection boundaries.

Affected systems

All Angular applications using versions prior to 22.0.0-rc.2 (current dev), 21.2.15, 20.3.22, or 19.2.23 are affected. This includes any project using @angular/core from these older version families. The vulnerability applies regardless of platform (web, mobile-web, or desktop-web via Electron or similar), provided the application uses the createComponent API. Developers should verify their current Angular version and update to the patched releases.

Exploitability

This vulnerability requires an attacker to control the component being instantiated or the host element selector passed to createComponent. The attack surface exists when an application accepts user input that influences component mounting decisions, or when third-party libraries have untrusted code paths. The attack is not automatically triggered; it demands either application-level misconfiguration or a supply-chain compromise. The user-interaction requirement (indicated by the CVSS vector) means the user must visit a malicious or compromised page or trigger the vulnerable code path. While not trivial to exploit in well-architected applications, it presents a meaningful risk in applications with dynamic component logic or untrusted input handling.

Remediation

Upgrade Angular immediately to version 22.0.0-rc.2, 21.2.15, 20.3.22, or 19.2.23 or later, depending on your current major version line. These releases include validation to reject mounting components onto script elements. Run 'npm update @angular/core' or update your package.json and reinstall dependencies. After patching, rebuild and re-test your application, particularly any code paths involving dynamic component creation or user-influenced component placement. Review application code for patterns where user input or external data controls component mounting; refactor to eliminate such control flow where possible.

Patch guidance

Angular provides patched versions across multiple support lines: verify against the vendor advisory (angular.io/guide/releases) for your specific version. For production environments on older major versions (19.x, 20.x, 21.x), update to the respective patch release. Teams on 22.x should update to rc.2 or later. Patch testing should focus on dynamic component creation scenarios. No breaking changes are expected in patch releases. Plan the upgrade during your next maintenance window; do not delay given the nature of XSS vulnerabilities.

Detection guidance

Monitor Angular application logs and network traffic for unusual component mounting patterns. Code review tools can flag uses of createComponent with externally-controlled host selectors. Static analysis should identify dynamic component instantiation without validation of the host element. Security testing should include scenarios where user input might influence component placement. Browser-based detection is difficult (XSS payloads would execute before detection), so prevention via patching and secure coding practices is paramount. Monitor your dependency tree for outdated @angular/core versions in development and production environments.

Why prioritize this

Despite a MEDIUM CVSS score, this vulnerability should be prioritized because XSS vulnerabilities enable direct compromise of user sessions and data. The attack surface is broad (any application using dynamic components), and the impact is severe (arbitrary code execution). The lack of CISA KEV listing does not diminish the need for rapid patching; patches are readily available and low-risk. Organizations should treat this as a priority update, especially for applications handling sensitive data or serving high-traffic user bases.

Risk score, explained

The CVSS 3.1 score of 6.1 reflects: network-accessible attack vector (AV:N), low attack complexity (AC:L), no privilege requirement (PR:N), and required user interaction (UI:R). Scope is changed (S:C), indicating impact beyond the vulnerable component. Confidentiality and integrity are both impacted (C:L, I:L), but availability is not (A:N). This is a typical XSS profile—easily exploitable but requiring some form of user engagement. The MEDIUM classification is appropriate for a client-side XSS; however, context (data sensitivity, user base size) may warrant treating it as HIGH priority operationally.

Frequently asked questions

Does this vulnerability require an attacker to have backend access?

No. This is a client-side vulnerability in the Angular framework itself. An attacker needs only to control the component instantiation logic or host element selector—either through malicious input to a vulnerable application, a compromised third-party library, or a supply-chain compromise. No backend access is required.

What versions of Angular should I update to?

Update to version 22.0.0-rc.2 or later, 21.2.15 or later, 20.3.22 or later, or 19.2.23 or later, depending on which major version line your application uses. Consult the official Angular release notes to confirm the exact patched versions for your branch.

Can I mitigate this without upgrading if patching is delayed?

Partial mitigation is possible through secure coding practices: avoid passing user-controlled data directly to the host selector in createComponent, validate component placement logic, and use Content Security Policy (CSP) headers to restrict script execution. However, these are workarounds; patching is the only reliable fix.

Is this vulnerability actively exploited in the wild?

As of the publication date, this vulnerability is not listed in CISA's Known Exploited Vulnerabilities (KEV) catalog. However, XSS vulnerabilities are commonly exploited once disclosed, so prompt patching is essential regardless of current threat intelligence.

This analysis is based on CVE-2026-52725 details published on the CVE record as of July 2026. Verify all patch version numbers and release dates against official Angular vendor advisories before applying fixes. This summary is for informational purposes and does not constitute security advice for any specific environment. Organizations should conduct their own risk assessment and testing before deploying patches. No exploit code or weaponized proof-of-concept is provided or recommended herein. Source: NVD (public-domain), retrieved 2026-07-28. Analysis generated by SEC.co (claude-haiku-4-5).