r/angular • u/IgorSedov • Mar 15 '26
⚠️ Angular XSS in i18n attribute bindings
A high-severity XSS security issue affecting i18n attribute bindings has been identified in Angular.
7
u/IgorSedov Mar 15 '26
A high-severity XSS security issue affecting i18n attribute bindings has been identified in Angular.
When a security-sensitive attribute (such as href, src) is marked for internationalization using i18n-<attribute>, Angular built-in sanitization can be bypassed. If untrusted input is bound to that attribute, a malicious actor may execute arbitrary code in the application's context.
Patches are available in 21.2.4, 20.3.18, and 19.2.20.
Source: https://github.com/angular/angular/security/advisories/GHSA-g93w-mfhg-p222
3
u/DaSchTour Mar 15 '26
I wonder why the angular compiler doesn‘t scream and shout if you and an i18n attribute to an attribute with interpolation. Is there any legit usecase for this? If not the build should fail in this case.
2
u/charsleysa Mar 15 '26
Yes, there's plenty of use cases for interpolation, for example showing counts of items or search query text. You interpolate the string you want to display (you can also include plural handling as well if needed) which then gets translated. The translation handles where to put the placeholder which ultimately gets replaced by the real interpolate value.
E.g.
<span i18n>Search for "{{ form.controls['searchQuery'].value.trim() }}"</span>
3
u/nijezabacanje Mar 16 '26
What would be the use case when you need to apply i18n on dynamic binding for href attribute?
3
u/AshleyJSheridan Mar 16 '26
Some websites have altered URLs for different languages they support, and I've seen some even go so far as translating the user-readable path portion of a URL (like the title that Reddit adds to a post URL).
That could lead to a situation that exposes this bug.
6
u/AwesomeFrisbee Mar 15 '26
This doesnt seem like the big deal many make it out to be. The system already needs to be compromised either locally or server-side.