GHSA-hh8m-fm6v-7cvg

Suggest an improvement
Source
https://github.com/advisories/GHSA-hh8m-fm6v-7cvg
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/09/GHSA-hh8m-fm6v-7cvg/GHSA-hh8m-fm6v-7cvg.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-hh8m-fm6v-7cvg
Aliases
Downstream
CGA (2)
Published
2026-09-10T20:18:02Z
Modified
2026-09-10T20:30:04Z
Severity
  • 5.3 (Medium) CVSS_V4 - CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N CVSS Calculator
Summary
Angular: Sanitization bypass via directive host bindings on concrete host elements in @angular/core and @angular/compiler
Details

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://).

Database specific
{
    "cwe_ids":  [
        "CWE-79"
    ],
    "github_reviewed":  true,
    "github_reviewed_at":  "2026-09-10T20:18:02Z",
    "nvd_published_at":  null,
    "severity":  "MODERATE"
}
References

Affected packages

npm
@angular/core

Package

Name
@angular/core
View open source insights on deps.dev
Purl
pkg:npm/%40angular/core

Affected ranges

Type
SEMVER
Events
Introduced
22.0.0
Fixed
22.1.0

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/09/GHSA-hh8m-fm6v-7cvg/GHSA-hh8m-fm6v-7cvg.json"
@angular/compiler

Package

Name
@angular/compiler
View open source insights on deps.dev
Purl
pkg:npm/%40angular/compiler

Affected ranges

Type
SEMVER
Events
Introduced
22.0.0
Fixed
22.1.0

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/09/GHSA-hh8m-fm6v-7cvg/GHSA-hh8m-fm6v-7cvg.json"
@angular/core

Package

Name
@angular/core
View open source insights on deps.dev
Purl
pkg:npm/%40angular/core

Affected ranges

Type
SEMVER
Events
Introduced
21.0.0
Fixed
21.2.20

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/09/GHSA-hh8m-fm6v-7cvg/GHSA-hh8m-fm6v-7cvg.json"
@angular/compiler

Package

Name
@angular/compiler
View open source insights on deps.dev
Purl
pkg:npm/%40angular/compiler

Affected ranges

Type
SEMVER
Events
Introduced
21.0.0
Fixed
21.2.20

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/09/GHSA-hh8m-fm6v-7cvg/GHSA-hh8m-fm6v-7cvg.json"
@angular/core

Package

Name
@angular/core
View open source insights on deps.dev
Purl
pkg:npm/%40angular/core

Affected ranges

Type
SEMVER
Events
Introduced
20.0.0
Fixed
20.3.28

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/09/GHSA-hh8m-fm6v-7cvg/GHSA-hh8m-fm6v-7cvg.json"
@angular/compiler

Package

Name
@angular/compiler
View open source insights on deps.dev
Purl
pkg:npm/%40angular/compiler

Affected ranges

Type
SEMVER
Events
Introduced
20.0.0
Fixed
20.3.28

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/09/GHSA-hh8m-fm6v-7cvg/GHSA-hh8m-fm6v-7cvg.json"
@angular/core

Package

Name
@angular/core
View open source insights on deps.dev
Purl
pkg:npm/%40angular/core

Affected ranges

Type
SEMVER
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Last Affected
19.2.25

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/09/GHSA-hh8m-fm6v-7cvg/GHSA-hh8m-fm6v-7cvg.json"
@angular/compiler

Package

Name
@angular/compiler
View open source insights on deps.dev
Purl
pkg:npm/%40angular/compiler

Affected ranges

Type
SEMVER
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Last Affected
19.2.25

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/09/GHSA-hh8m-fm6v-7cvg/GHSA-hh8m-fm6v-7cvg.json"