The vulnerability is a Cross-Site Scripting (XSS) issue within the Angular internationalization (i18n) pipeline. The root cause is the improper handling of HTML content embedded within ICU messages that are provided in translation files (e.g., XLIFF, XTB). An attacker who can compromise these translation files can inject malicious HTML.
The analysis of the security patches, particularly commit 306f367899dfc2e04238fecd3455547b5d54075d, reveals that the core of the vulnerability lies in the walkIcuTree function located in packages/core/src/render3/i18n/i18n_parse.ts. This function is responsible for parsing the ICU messages and generating internal rendering instructions for Angular.
Before the fix, walkIcuTree operated on a flawed assumption: it considered any attribute within the translated HTML to be safe as long as it didn't contain an Angular data binding. This meant that if a translator (or an attacker posing as one) included an attribute like <a href="javascript:alert('XSS')">, the function would process it without sanitization. The addCreateAttribute helper function would then be called to create the rendering instruction for this malicious attribute.
At runtime, when the Angular application would render the internationalized component, these instructions would be executed, creating the malicious element in the DOM and triggering the XSS payload.
The patch addresses this by fundamentally changing the trust model. The updated walkIcuTree function now validates all attributes against an allowlist (VALID_ATTRS). For attributes that are known to accept URIs (URI_ATTRS), it blocks any value from being set, effectively neutralizing any attempt to inject javascript: or other malicious URIs. Any attribute not on the allowlist is simply ignored. This ensures that only known, safe attributes are rendered from translated content, mitigating the XSS risk.