{"id":"CVE-2026-88058","aliases":["CVE-2026-88058","GHSA-j3r3-mxqp-r2p4"],"related":[],"kind":"vulnerability","state":"published","title":"Angular: SSR XSS via Unescaped Processing Instruction (<?...?>) Nodes in Fallback Raw-Content Elements","summary":"Angular is a development platform for building mobile and desktop web applications using TypeScript/JavaScript and other languages. Prior to 20.3.30, 21.2.22, and 22.1.4, Angular server-side rendering (SSR) in @angular/platform-server serializes ProcessingInstruction DOM nodes inside fallback raw-content elements without escaping matching ancestor closing tags. ProcessingInstruction data escaped greater-than characters but left less-than characters untouched and did not inspect fallback ancestors, so data such as a matching closing tag prematurely terminates noscript, iframe, noembed, or noframes containers. The vulnerable nodes cannot be authored through standard Angular templates; reachability requires application or library code using inject(DOCUMENT).createProcessingInstruction with attacker-controlled data or Renderer2 DOM insertion inside a fallback container. In HTML5 RAWTEXT parsing, the premature close causes subsequent sibling elements to be interpreted as live HTML and enables arbitrary JavaScript execution in a victim's browser. This issue is fixed in versions 20.3.30, 21.2.22, and 22.1.4.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Angular is a development platform for building mobile and desktop web applications using TypeScript/JavaScript and other languages. Prior to 20.3.30, 21.2.22, and 22.1.4, Angular server-side rendering (SSR) in @angular/platform-server serializes ProcessingInstruction DOM nodes inside fallback raw-content elements without escaping matching ancestor closing tags. ProcessingInstruction data escaped greater-than characters but left less-than characters untouched and did not inspect fallback ancestors, so data such as a matching closing tag prematurely terminates noscript, iframe, noembed, or noframes containers. The vulnerable nodes cannot be authored through standard Angular templates; reachability requires application or library code using inject(DOCUMENT).createProcessingInstruction with attacker-controlled data or Renderer2 DOM insertion inside a fallback container. In HTML5 RAWTEXT parsing, the premature close causes subsequent sibling elements to be interpreted as live HTML and enables arbitrary JavaScript execution in a victim's browser. This issue is fixed in versions 20.3.30, 21.2.22, and 22.1.4.","source":"cvelist"},{"lang":"en","text":"### Summary\nAn XSS vulnerability exists in `@angular/platform-server` during server-side rendering (SSR) HTML serialization of `ProcessingInstruction` DOM nodes (`<?target data?>`, `nodeType === 7`) when nested inside fallback raw-content elements (`<noscript>`, `<iframe>`, `<noembed>`, `<noframes>`). While processing instruction data escaped `>` to `&gt;`, it did not check for or escape matching closing tags of ancestor fallback elements (e.g., `</noscript>`). When rendered in a browser with scripting enabled, an unescaped closing tag sequence in a processing instruction prematurely closes the fallback raw-content tag and causes subsequent sibling elements to execute as live HTML.\n\n### Technical Description\nIn HTML5 parsing, fallback raw-content elements (`<noscript>`, `<iframe>`, `<noembed>`, `<noframes>`) place the browser's HTML tokenizer into `RAWTEXT` mode. In `RAWTEXT` mode, processing instruction tokens (`<?...?>`) are treated as literal raw text rather than bogus comments, and the parser ignores `>` or `?>`. The only token sequence that terminates the container is an end tag matching the container tag name (`</noscript`, `</iframe`, etc.).\n\nDuring server-side HTML serialization, processing instruction nodes previously only replaced `>` with `&gt;` (preventing bogus comment breakouts in normal HTML data states) but left `<` untouched. Crucially, processing instruction serialization never inspected ancestor fallback raw-content tags. As a result, if a `ProcessingInstruction` node inside `<noscript>` contained `</noscript ` in its data payload, it was emitted unescaped as `<?x </noscript ?>`.\n\n### Impact & Reachability\n* **Reachability**: Processing instruction nodes cannot be authored directly through standard Angular template syntax (which parses `<?...>` into comment nodes in DOM position). Reaching this vulnerability requires application or library code calling `inject(DOCUMENT).createProcessingInstruction(target, data)` or `Renderer2` DOM insertion methods with untrusted user input passed to `data` inside a fallback raw-content container.\n* **Impact**: In applications that programmatically construct processing instruction nodes inside fallback elements during server-side rendering, an attacker controlling the processing instruction data can break out of the container and execute arbitrary JavaScript in victims' browsers.\n\n### Proof of Concept (Minimal Reproduction)\n```ts\nimport { Component, ElementRef, Renderer2, inject, DOCUMENT, AfterViewInit } from '@angular/core';\n\n@Component({\n  selector: 'app-root',\n  standalone: true,\n  template: `<noscript id=\"host\"></noscript>`\n})\nexport class AppComponent implements AfterViewInit {\n  private r = inject(Renderer2);\n  private el = inject(ElementRef);\n  private doc = inject(DOCUMENT);\n\n  ngAfterViewInit() {\n    const host = this.el.nativeElement.querySelector('#host');\n    \n    // Attacker-controlled input passed as Processing Instruction data\n    const pi = this.doc.createProcessingInstruction('x', '</noscript ');\n    this.r.appendChild(host, pi);\n    \n    // Sibling markup that should remain inert inside <noscript>\n    const img = this.r.createElement('img');\n    this.r.setAttribute(img, 'src', 'x');\n    this.r.setAttribute(img, 'onerror', 'alert(\"SSR_PI_XSS\")');\n    this.r.appendChild(host, img);\n  }\n}\n```\n**Vulnerable SSR Output**:\n```html\n<noscript><?x </noscript ?><img src=\"x\" onerror=\"alert('SSR_PI_XSS')\"></noscript>\n```\n\n### Workarounds\n* Avoid passing untrusted user input into `document.createProcessingInstruction(target, data)` when the node is inserted into `<noscript>`, `<iframe>`, `<noembed>`, or `<noframes>` during server-side rendering.\n* Manually sanitize or replace `<` with `&lt;` in any untrusted data passed to processing instruction nodes on the server.","format":"markdown","source":"ghsa"}],"published":"2026-09-10T18:56:03.369Z","modified":"2026-09-29T19:01:24.747Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N","score":8.6,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N","score":8.6,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N","rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"}],"cwes":["CWE-79","CWE-116"],"affected":[{"ranges":[{"version":"<= 19.2.25","status":"affected"},{"version":">= 20.0.0, < 20.3.30","status":"affected"},{"version":">= 21.0.0, < 21.2.22","status":"affected"},{"version":">= 22.0.0, < 22.1.4","status":"affected"}],"vendor":"angular","product":"angular","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"22.0.0","status":"affected","fixed":"22.1.4"}],"ecosystem":"npm","package":"@angular/platform-server","purl":"pkg:npm/%40angular/platform-server","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"21.0.0","status":"affected","fixed":"21.2.22"}],"ecosystem":"npm","package":"@angular/platform-server","purl":"pkg:npm/%40angular/platform-server","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"20.0.0","status":"affected","fixed":"20.3.30"}],"ecosystem":"npm","package":"@angular/platform-server","purl":"pkg:npm/%40angular/platform-server","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","lastAffected":"19.2.25"}],"ecosystem":"npm","package":"@angular/platform-server","purl":"pkg:npm/%40angular/platform-server","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"19.0.0","lastAffected":"19.2.25"},{"status":"affected","introduced":"20.0.0","fixed":"20.3.30"},{"status":"affected","introduced":"21.0.0","fixed":"21.2.22"},{"status":"affected","introduced":"22.0.0","fixed":"22.1.4"}],"vendor":"angular","product":"angular","cpe":"cpe:2.3:a:angular:angular:*:*:*:*:*:node.js:*:*","source":"nvd"}],"references":[{"url":"https://github.com/angular/angular/security/advisories/GHSA-j3r3-mxqp-r2p4","tags":["exploit","third-party-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/angular/angular/issues/70146","tags":["exploit","issue-tracking","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/angular/angular/commit/73d8bbd27cb46495426d4132975a1355b47ad915","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/angular/angular/commit/89b20568dfaee1ec8e0b3bcf1872acdddd2f4fef","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/angular/angular/commit/ba3bc47b20b3d12f5eb141ec9c651373ae4d15e8","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/angular/domino/commit/04f987dc08ff3736b427f50941adf1722458528f","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/angular/angular/releases/tag/v20.3.30","tags":["release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/angular/angular/releases/tag/v21.2.22","tags":["release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/angular/angular/releases/tag/v22.1.4","tags":["release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-88058","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/angular/angular","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"total","date":"2026-09-11T15:14:28.505Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-88058","url":"https://www.cve.org/CVERecord?id=CVE-2026-88058","licence":"CVE Terms of Use","modified":"2026-09-11T15:14:37.967Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-j3r3-mxqp-r2p4","url":"https://github.com/advisories/GHSA-j3r3-mxqp-r2p4","licence":"CC-BY-4.0","modified":"2026-09-28T20:45:04.134Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-88058","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-88058","licence":"Public domain","modified":"2026-09-29T19:01:24.747Z"}],"updatedAt":"2026-11-25T22:59:37.894Z","epss":{"score":0.00281,"percentile":0.2214,"date":"2026-12-01T12:00:22.000Z"}}