CVE-2026-88057: Angular: Sanitization bypass via directive host bindings on concrete host elements in @angular/core and @angular/compiler

Published Sep 10, 2026
·
Updated

Angular automatically sanitizes untrusted values bound to security-sensitive DOM sinks (such as href, src, action, xlink:href, and data) to protect against Cross-Site Scripting (XSS).

Prior to the fix, the Angular compiler determined the SecurityContext for directive host bindings (host: {'[attr.href]': 'value'} or @HostBinding('attr.href')) based solely on the declaring directive or component selector at compile time, rather than the concrete host element that the directive was applied to.

When a directive with a security-sensitive host binding was applied to a different concrete host element—such as through: - hostDirectives composition, - Class inheritance of host bindings, - Dynamic component instantiation (createComponent with custom hostElement or dynamic directives), - Elements with SVG/MathML namespaces (e.g. <svg:a>, <math>), or - Elements using tag-neutral selectors (e.g. :not(...)),

the compiler either failed to associate a sanitizer with the host binding or attached an incorrect security context. As a result, untrusted inputs (e.g. javascript:... URLs) bound via the host binding would be written to the DOM attribute without passing through Angular's built-in sanitizer.

Impact An attacker capable of controlling the value bound to an affected directive host binding could execute arbitrary JavaScript in the user's browser context (Cross-Site Scripting).

Patches This issue has been resolved in versions: - 22.1.0 - 21.2.20 - 20.3.28

Workarounds Ensure that any user-controlled values assigned to properties bound via directive host bindings are explicitly sanitized using DomSanitizer.sanitize(SecurityContext.URL, ...) before assignment, or restrict the input to validated safe URL schemes (e.g. http://, https://).

Other sources

Angular is a development platform for building mobile and desktop web applications using TypeScript/JavaScript and other languages. Prior to 20.3.28, 21.2.20, and 22.1.0, Angular's compiler and runtime in @angular/core and @angular/compiler could omit or select an incorrect sanitizer for security-sensitive directive host bindings because SecurityContext was derived from the declaring directive or component selector rather than the concrete host element. The mismatch is reachable through hostDirectives composition, inherited HostBinding declarations, createComponent with a custom hostElement or dynamic directives, SVG/MathML namespace elements, and tag-neutral selectors such as :not(...). Attacker-controlled href, src, action, xlink:href, or data values can therefore reach DOM attributes without Angular's built-in sanitizer and execute arbitrary JavaScript in the user's browser context. Applications unable to upgrade can use DomSanitizer.sanitize with SecurityContext.URL before assignment or restrict inputs to validated HTTP and HTTPS URL schemes. This issue is fixed in versions 20.3.28, 21.2.20, and 22.1.0.

MITRE

Affected Software

9 affected componentsFixes available
Google Angular<20.3.28, <21.2.20, <22.1.0
npm/@angular/compiler<=19.2.25
npm/@angular/core<=19.2.25
npm/@angular/compiler>=20.0.0<20.3.28
20.3.28
npm/@angular/core>=20.0.0<20.3.28
20.3.28
npm/@angular/compiler>=21.0.0<21.2.20
21.2.20
npm/@angular/core>=21.0.0<21.2.20
21.2.20
npm/@angular/compiler>=22.0.0<22.1.0
22.1.0
npm/@angular/core>=22.0.0<22.1.0
22.1.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/@angular/compiler to a version that resolves this vulnerability.

    Fixed in 20.3.28
  2. Upgrade

    Upgrade npm/@angular/core to a version that resolves this vulnerability.

    Fixed in 20.3.28
  3. Upgrade

    Upgrade npm/@angular/compiler to a version that resolves this vulnerability.

    Fixed in 21.2.20
  4. Upgrade

    Upgrade npm/@angular/core to a version that resolves this vulnerability.

    Fixed in 21.2.20
  5. Upgrade

    Upgrade npm/@angular/compiler to a version that resolves this vulnerability.

    Fixed in 22.1.0
  6. Upgrade

    Upgrade npm/@angular/core to a version that resolves this vulnerability.

    Fixed in 22.1.0
  7. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 20.3.28
  8. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 21.2.20
  9. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 22.1.0
  10. Configuration

    If upgrading is not possible, explicitly sanitize any user-controlled values assigned to properties bound via directive host bindings by applying `DomSanitizer.sanitize(SecurityContext.URL, ...)` before setting the bound value, or restrict inputs to validated safe URL schemes such as `http://` and `https://` (so `javascript:...` is rejected).

    Angular application code using directive host bindings sanitize user-controlled values bound via directive host bindings for security-sensitive DOM sinks (href/src/action/xlink:href/data) = DomSanitizer.sanitize(SecurityContext.URL, ...) before assignment (or restrict to validated HTTP/HTTPS URL schemes)

Event History

Sep 10, 2026
CVE Published
via MITRE·06:46 PM
Data Sourced
via MITRE·06:46 PM
DescriptionWeakness
Advisory Published
via GitHub·08:18 PM
Data Sourced
via GitHub·08:18 PM
DescriptionWeaknessAffected Software

Frequently Asked Questions

1

Which applications are realistically exposed to this issue?

Applications using affected Angular versions are exposed when security-sensitive directive host bindings are applied to concrete host elements in patterns such as hostDirectives composition, inherited HostBinding declarations, createComponent with a custom hostElement or dynamic directives, SVG or MathML elements, or tag-neutral selectors such as :not(...). The affected values include attacker-controlled href, src, action, xlink:href, and data attributes.

2

What would an attacker need to exploit the vulnerability?

An attacker needs a way to control a value assigned through an affected directive host binding to a security-sensitive URL-related attribute. Successful exploitation can allow arbitrary JavaScript execution in the browser context of a user viewing the application.

3

Are default Angular sanitization protections sufficient?

No. In the affected cases, Angular can omit sanitization or select the wrong sanitizer because the SecurityContext is derived from the directive or component selector instead of the actual host element.

4

What can be done if upgrading is not immediately possible?

Sanitize values with DomSanitizer.sanitize using SecurityContext.URL before assignment, or restrict inputs to validated HTTP and HTTPS URL schemes. Upgrade to 20.3.28, 21.2.20, or 22.1.0 when possible.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203