Angularに不適切なエンコード・エスケープの脆弱性(CVE-2026-88058)
概要
Angularに不適切なエンコード・エスケープ・クロスサイトスクリプティング(XSS)の脆弱性が確認されました。
バージョン 22.0.0 以上 22.1.4 未満、21.0.0 以上 21.2.22 未満、20.0.0 以上 20.3.30 未満、19.2.25 以前に影響があります。
修正版 22.1.4 / 21.2.22 / 20.3.30 への更新が推奨されます。
脆弱性の基本情報
| 脆弱性ID |
CVE-2026-88058 GHSA-j3r3-mxqp-r2p4 |
|---|---|
| 脆弱性の種類 | 不適切なエンコード・エスケープ クロスサイトスクリプティング(XSS) |
| 危険度 | 中 |
| CVSSスコア |
6.1(CVSS v3.1) CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N |
| 公開日 | 2026年9月28日 |
| 更新日 | 2026年9月29日 |
影響を受ける製品
| 製品 | 影響を受けるバージョン | 修正版 | 出典 |
|---|---|---|---|
| Angular |
22.0.0 以上 22.1.4 未満、21.0.0 以上 21.2.22 未満、20.0.0 以上 20.3.30 未満、19.2.25 以前 | 22.1.4 / 21.2.22 / 20.3.30 | OSV.dev |
推奨対応
- Angularを、ご利用中の系列に対応する修正版(22.1.4 / 21.2.22 / 20.3.30)またはそれ以降の公式最新版へ更新してください。
情報元の原文
OSV.dev
Angular SSR: XSS via Unescaped Processing Instruction (<?...?>) Nodes in Fallback Raw-Content Elements
### Summary
An 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 `>`, 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.
### Technical Description
In 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.).
During server-side HTML serialization, processing instruction nodes previously only replaced `>` with `>` (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 ?>`.
### Impact & Reachability
* **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.
* **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.
### Proof of Concept (Minimal Reproduction)
```ts
import { Component, ElementRef, Renderer2, inject, DOCUMENT, AfterViewInit } from '@angular/core';
@Component({
selector: 'app-root',
standalone: true,
template: `<noscript id="host"></noscript>`
})
export class AppComponent implements AfterViewInit {
private r = inject(Renderer2);
private el = inject(ElementRef);
private doc = inject(DOCUMENT);
ngAfterViewInit() {
const host = this.el.nativeElement.querySelector('#host');
// Attacker-controlled input passed as Processing Instruction data
const pi = this.doc.createProcessingInstruction('x', '</noscript ');
this.r.appendChild(host, pi);
// Sibling markup that should remain inert inside <noscript>
const img = this.r.createElement('img');
this.r.setAttribute(img, 'src', 'x');
this.r.setAttribute(img, 'onerror', 'alert("SSR_PI_XSS")');
this.r.appendChild(host, img);
}
}
```
**Vulnerable SSR Output**:
```html
<noscript><?x </noscript ?><img src="x" onerror="alert('SSR_PI_XSS')"></noscript>
```
### Workarounds
* 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.
* Manually sanitize or replace `<` with `<` in any untrusted data passed to processing instruction nodes on the server.
利用条件:CC BY 4.0
出典: GitHub Advisory Database(OSV.dev 経由で取得)。原文のまま掲載(改変なし)
NVD(National Vulnerability Database / NIST)
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.
利用条件:米国政府の著作物(パブリックドメイン)・原文のまま掲載
Copyright 1999-2026 The MITRE Corporation
CVE Usage: MITRE hereby grants you a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute Common Vulnerabilities and Exposures (CVE®). Any copy you make for such purposes is authorized provided that you reproduce MITRE's copyright designation and this license in any such copy.
情報元
- OSV.dev
https://github.com/advisories/GHSA-j3r3-mxqp-r2p4 - NVD(National Vulnerability Database / NIST)
https://nvd.nist.gov/vuln/detail/CVE-2026-88058