Title: Angular i18n markers in a translation can overwrite an existing `TNode` and disable sanitization · Issue #71219 · angular/angular · GitHub
Open Graph Title: Angular i18n markers in a translation can overwrite an existing `TNode` and disable sanitization · Issue #71219 · angular/angular
X Title: Angular i18n markers in a translation can overwrite an existing `TNode` and disable sanitization · Issue #71219 · angular/angular
Description: Which @angular/* package(s) are the source of the bug? core Is this a regression? No Description A translation can contain Angular's reserved U+FFFD characters, and the i18n runtime parses them as if the compiler had generated them. A ma...
Open Graph Description: Which @angular/* package(s) are the source of the bug? core Is this a regression? No Description A translation can contain Angular's reserved U+FFFD characters, and the i18n runtime parses them as ...
X Description: Which @angular/* package(s) are the source of the bug? core Is this a regression? No Description A translation can contain Angular's reserved U+FFFD characters, and the i18n runtime parses them...
Opengraph URL: https://github.com/angular/angular/issues/71219
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Angular i18n markers in a translation can overwrite an existing `TNode` and disable sanitization","articleBody":"### Which @angular/* package(s) are the source of the bug?\n\ncore\n\n### Is this a regression?\n\nNo\n\n### Description\n\nA translation can contain Angular's reserved U+FFFD characters, and the i18n runtime parses them as if the compiler had generated them.\n\nA marker can point at a declaration index that already holds an element. `createTNodeAtIndex()` then replaces that `TNode` without checking it:\n\n```ts\nconst tNode = tView.data[index] = createTNode(tView, parent, type, index, name, attrs);\n```\n\n`LView[index]` still holds the real element, but the new `TNode` has no tag name. Anything that resolves its security context from the tag name now gets an empty one, and for a host-bound `src` the sanitizer just returns the value:\n\n```ts\nfunction ɵɵsanitizeUrlOrResourceUrl(unsafeUrl, tag, prop) {\n return getUrlSanitizer(tag, prop)?.(unsafeUrl) ?? unsafeUrl;\n}\n```\n\nThe catalog does not need to carry a payload. The whole change to the translation is two markers around normal text:\n\n```xml\n\u003ctarget>�#2�Insercion lista�/#2�\u003c/target>\n```\n\nA minimal example only needs an ordinary embed directive that host-binds `src` from the query string, and an iframe declared before an i18n message:\n\n```ts\n@Directive({\n selector: 'iframe[appEmbed]',\n host: {'[attr.src]': 'src'},\n})\nexport class Embed {\n readonly src = inject(ActivatedRoute).snapshot.queryParamMap.get('p') ?? 'about:blank';\n}\n\n@Component({\n imports: [Embed],\n template: `\n \u003ciframe title=\"embed\" appEmbed>\u003c/iframe>\n {state, select, ready {Embed ready} other {Embed pending}}\n `,\n})\nexport class Src {\n protected readonly state = 'ready';\n}\n```\n\n`iframe[src]` is a `RESOURCE_URL`, so in the untranslated build `?p=javascript:...` is rejected with `NG0904` and no `src` is written. With the forged catalog the same URL is written as is and runs on load, with no click.\n\nThe same marker on a plain `[attr.srcdoc]` binding makes `ɵɵsanitizeHtml` see an empty tag name. `srcdoc` is only registered for `iframe`, so the context resolves to `NONE` and the HTML comes back unsanitized, `onerror` included.\n\nAlso `getOrCreateTNode()` upgrades an i18n placeholder in place, and restores `type`, `value` and `attrs` but not `namespace`:\n\n```ts\n} else if (tNode.type & 64) {\n tNode.type = type;\n tNode.value = name;\n tNode.attrs = attrs;\n const parent = getCurrentParentTNode();\n tNode.injectorIndex = parent === null ? -1 : parent.injectorIndex;\n}\n```\n\nAn i18n block predeclares the elements it contains as placeholders while the namespace is still HTML, so any SVG element inside one keeps HTML metadata. The renderer still creates the node in the right namespace, so the DOM is a normal `SVGSetElement` and only Angular's view of it is wrong:\n\n```ts\n@Component({\n template: `\n \u003csection i18n>\n Open profile\n \u003csvg>\n \u003ca>\n \u003cset attributeName=\"href\" [attr.to]=\"payload\">\u003c/set>\n \u003c/a>\n \u003c/svg>\n \u003c/section>\n `,\n})\nexport class NsBlock {\n payload = 'javascript:alert(\\'XSS\\')';\n}\n```\n\n`checkSecurityContext('set', 'to', undefined)` resolves to `NONE` instead of `ATTRIBUTE_NO_BINDING`, so `ɵɵvalidateAttribute()` returns early and `to` reaches the node with no `NG0910`. This one does not involve a translation catalog, and it reproduces in both locales.\n\n#70491 fixed this on 22.x from 22.1.5 by falling back to the SVG schema when the namespace is missing. It never reached 21.x, which is in LTS, so `21.2.25` is still affected.\n\n\n`getOrCreateTNode()` is the same on both lines, so the metadata is still wrong on 22.x too. The fallback only helps lookups that go through the SVG schema.\n\n\n### Please provide a link to a minimal reproduction of the bug\n\nSee https://github.com/SkyZeroZx/angular-i18n-marker-xss-poc\n \n\n### Anything else?\n\n I was reported on https://issuetracker.google.com/issues/550667019\n\n#71206 strips U+FFFD from translations, which closes the way in for `src` and `srcdoc`, so I think it can be backported.\n\nI think this can be considered like the earlier i18n advisories, since the attack mechanism is the same and based on the translation. GHSA-prjf-86w9-mfqv states \"The attacker must compromise the translation file (xliff, xtb, etc.).\" and GHSA-jj27-h5hq-8x99 needs an attacker that \"can control or influence the translation files used during localization\", so this one could possibly be classified the same way.\n","author":{"url":"https://github.com/SkyZeroZx","@type":"Person","name":"SkyZeroZx"},"datePublished":"2026-10-07T04:55:13Z","url":"https://github.com/angular/angular/issues/71219"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7ca70d5d-8396-566f-78c5-afc0569957ae |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BFFE:4279A:10E1E04:16B848B:6B012117 |
| html-safe-nonce | 9c3a3d68e6bb0a49479f56db699d4a4517c8ae19dc89ee31d4f249afaab7cac6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRkZFOjQyNzlBOjEwRTFFMDQ6MTZCODQ4Qjo2QjAxMjExNyIsInZpc2l0b3JfaWQiOiIzNjU4MDI2MzUzNjI3ODMyNTk5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 88aa0ccbe911448d27dfa1a4e0223caa8aad0183c58fc1359392cbcfcb9c92d4 |
| hovercard-subject-tag | issue:5739590497 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/71219/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ca0a64f64f0878b34b3978b97eb9b53dba1d8855f2cc392849281d17e0bbd591/angular/angular/issues/71219 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ca0a64f64f0878b34b3978b97eb9b53dba1d8855f2cc392849281d17e0bbd591/angular/angular/issues/71219 |
| og:image:alt | Which @angular/* package(s) are the source of the bug? core Is this a regression? No Description A translation can contain Angular's reserved U+FFFD characters, and the i18n runtime parses them as ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | SkyZeroZx |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width