| Gói / sản phẩm | Phiên bản bị ảnh hưởng | Phiên bản đã vá |
|---|---|---|
| angular | ≥ 19.0.0, ≤ 19.2.25≥ 20.0.0, < 20.3.28≥ 21.0.0, < 21.2.20≥ 22.0.0, < 22.1.0 | 20.3.2821.2.2022.1.0 |
| @angular/compiler | ≥ 20.0.0, < 20.3.28≥ 21.0.0, < 21.2.20≥ 22.0.0, < 22.1.0≤ 19.2.25 | 20.3.2821.2.2022.1.0 |
| @angular/core | ≥ 20.0.0, < 20.3.28≥ 21.0.0, < 21.2.20≥ 22.0.0, < 22.1.0≤ 19.2.25 | 20.3.2821.2.2022.1.0 |
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,createComponent with custom hostElement or dynamic directives),<svg:a>, <math>), or: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.
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).
This issue has been resolved in versions:
22.1.021.2.2020.3.28Ensure 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://).
Bạn đang dùng một trong các sản phẩm này? Quét site để biết có đang lộ phiên bản có lỗ hổng không.
Quét site miễn phí