Логотип exploitDog
Консоль
Логотип exploitDog

exploitDog

github логотип

GHSA-v3p8-whq6-r5jg

Опубликовано: 10 сент. 2026
Источник: github
Github: Прошло ревью
CVSS4: 8.6

Описание

Angular: SSR XSS via Unescaped <template> Content Across DocumentFragment Boundaries in Fallback Raw-Content Elements

Summary

An XSS vulnerability exists in @angular/platform-server during server-side rendering (SSR) HTML serialization when traversing ancestor tags across &lt;template&gt; element boundaries. When an application renders untrusted user input within raw-text tags (<xmp>, <style>, <script>), comments, or text nodes inside a &lt;template&gt; that is nested within a fallback raw-content element (<noscript>, <iframe>, <noembed>, <noframes>), matching closing tags (e.g., </noscript>) are not escaped during HTML serialization. When rendered in a browser, this unescaped closing tag prematurely terminates the fallback container and executes trailing markup as active DOM elements.

Technical Description

In HTML5 parsing, fallback raw-content elements (<noscript>, <iframe>, <noembed>, <noframes>) place the browser's tokenizer into RAWTEXT mode. In this mode, inner content is parsed as literal text until an end tag matching the container tag name (e.g., </noscript>) is encountered.

To prevent XSS breakout vectors during SSR serialization, the DOM serializer inspects a node's ancestors to escape any matching fallback closing tags (</tag -> &lt;/tag). However:

  1. Per DOM specifications, the children of a &lt;template&gt; element reside in a separate DocumentFragment (template.content), whose own parentNode is null.
  2. The serializer's ancestor traversal previously only inspected element nodes. When traversing upward from a node inside template.content, traversal terminated immediately at the DocumentFragment boundary.
  3. Because traversal stopped before reaching the outer document tree, enclosing fallback raw-content ancestors (such as <noscript> or <iframe>) were not discovered. As a result, closing sequences like </noscript> within &lt;template&gt; content were emitted unescaped.

Impact & Reachability

  • Framework Guarantee Bypass: Angular guarantees that standard text interpolation ({{ userInput }} bound as element text content) is safe by default without manual sanitization. This vulnerability bypasses that guarantee during SSR HTML serialization when untrusted input is interpolated inside template content within fallback containers.
  • Template Authoring: Writing literal <xmp> or <style> directly inside a component's &lt;template&gt; markup requires relaxed template schema checks (CUSTOM_ELEMENTS_SCHEMA or NO_ERRORS_SCHEMA). However, standard HTML comments and text nodes inside &lt;template&gt; within <noscript> are reachable without relaxed schemas.
  • Imperative DOM Construction: Components or directives that construct DOM structures imperatively via Renderer2 bypass template compiler schema checks entirely and are unconditionally affected.

Proof of Concept (Minimal Reproduction)

import { Component } from '@angular/core'; @Component({ selector: 'app-root', standalone: true, template: ` <noscript> &lt;template&gt; <xmp>{{ payload }}</xmp> &lt;/template&gt; </noscript> ` }) export class AppComponent { // Attacker-controlled input bound via standard text interpolation payload = '</noscript><img src=x onerror=alert("SSR_TEMPLATE_XSS")>'; }

Vulnerable SSR Output:

<noscript>&lt;template&gt;<xmp></noscript><img src=x onerror=alert("SSR_TEMPLATE_XSS")></xmp>&lt;/template&gt;</noscript>

Workarounds

  • Avoid rendering untrusted user input inside &lt;template&gt; elements nested within <noscript>, <iframe>, <noembed>, or <noframes> in server-rendered templates.
  • Avoid programmatic DOM assembly of &lt;template&gt; elements inside fallback containers when handling untrusted data.

Пакеты

Наименование

@angular/platform-server

npm
Затронутые версииВерсия исправления

>= 22.0.0, < 22.1.4

22.1.4

Наименование

@angular/platform-server

npm
Затронутые версииВерсия исправления

>= 21.0.0, < 21.2.22

21.2.22

Наименование

@angular/platform-server

npm
Затронутые версииВерсия исправления

>= 20.0.0, < 20.3.30

20.3.30

Наименование

@angular/platform-server

npm
Затронутые версииВерсия исправления

<= 19.2.25

Отсутствует

EPSS

Процентиль: 51%
0.00696
Низкий

8.6 High

CVSS4

Дефекты

CWE-79
CWE-116

Связанные уязвимости

ubuntu
8 дней назад

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 untrusted input inside template content nested in fallback raw-content elements such as noscript, iframe, noembed, and noframes. The Domino serializer's fallbackRawContentTags traversal stopped at the DocumentFragment used by template.content, so matching closing tags in xmp, style, script, comments, or text nodes were not escaped. Standard interpolation with comments or text nodes is reachable without relaxed schemas; literal xmp or style requires CUSTOM_ELEMENTS_SCHEMA or NO_ERRORS_SCHEMA, while Renderer2 imperative DOM construction is unconditionally affected. When HTML5 RAWTEXT browser parsing encounters the unescaped closing tag, it exits the fallback container and interprets trailing markup as active DOM elements, enabling arbitrary Ja...

nvd
8 дней назад

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 untrusted input inside template content nested in fallback raw-content elements such as noscript, iframe, noembed, and noframes. The Domino serializer's fallbackRawContentTags traversal stopped at the DocumentFragment used by template.content, so matching closing tags in xmp, style, script, comments, or text nodes were not escaped. Standard interpolation with comments or text nodes is reachable without relaxed schemas; literal xmp or style requires CUSTOM_ELEMENTS_SCHEMA or NO_ERRORS_SCHEMA, while Renderer2 imperative DOM construction is unconditionally affected. When HTML5 RAWTEXT browser parsing encounters the unescaped closing tag, it exits the fallback container and interprets trailing markup as active DOM elements, enabling arbitrary JavaS

debian
8 дней назад

Angular is a development platform for building mobile and desktop web ...

EPSS

Процентиль: 51%
0.00696
Низкий

8.6 High

CVSS4

Дефекты

CWE-79
CWE-116