llamaCVEVulnerability Intelligence
/
Advisory · GitHub · npm · @angular/platform-server

GHSA-V3P8-WHQ6-R5JG

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

Parche disponible
Descargar PNG JSON
CVSS
—
high
Fuente: —
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche3 versionesPrimer parche a -15 d de la divulgación
Exposición69 dDesde la divulgación, 10 sept 2026, 3:25 p. m.
Detección67 dDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Modificada
Explotación
Remediación
Parche 20.3.30 +1
Parche 22.1.4
Monitoreo
Detectada
26 ago 26
27 ago 26
10 sept 26
25 sept 26
17 nov 26
19 nov 26
26 ago 26
17 sept 26
8 oct 26
29 oct 26
19 nov 26
FechaFaseEventoDetalle
Remediación Parche 20.3.30 @angular/platform-server · -15 d desde divulgación
Remediación Parche 21.2.22 @angular/platform-server · -15 d desde divulgación
Remediación Parche 22.1.4 @angular/platform-server · -14 d desde divulgación
Divulgación Publicada GHSA-V3P8-WHQ6-R5JG divulgada
Divulgación Modificada Última actualización del registro
Monitoreo Detectada Ingresó al índice
Resumen
Descripción del advisory
Texto original · GitHub · en inglés

### Summary
An XSS vulnerability exists in `@angular/platform-server` during server-side rendering (SSR) HTML serialization when traversing ancestor tags across `<template>` element boundaries. When an application renders untrusted user input within raw-text tags (`<xmp>`, `<style>`, `<script>`), comments, or text nodes inside a `<template>` 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 `<template>` 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 `<template>` 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 `<template>` markup requires relaxed template schema checks (`CUSTOM_ELEMENTS_SCHEMA` or `NO_ERRORS_SCHEMA`). However, standard HTML comments and text nodes inside `<template>` 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>
      <template>
        <xmp>{{ payload }}</xmp>
      </template>
    </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><template><xmp></noscript><img src=x onerror=alert("SSR_TEMPLATE_XSS")></xmp></template></noscript>

### Workarounds
* Avoid rendering untrusted user input inside `<template>` elements nested within `<noscript>`, `<iframe>`, `<noembed>`, or `<noframes>` in server-rendered templates.
* Avoid programmatic DOM assembly of `<template>` elements inside fallback containers when handling untrusted data.

Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.

Versiones

Rangos afectados

Afectada Corregida Última
@angular/platform-server≤ 19.2.25
@angular/platform-server≥ 20.0.0 < 20.3.30
@angular/platform-server≥ 21.0.0 < 21.2.22
@angular/platform-server≥ 22.0.0 < 22.1.4
19.2.25
20.0.0
20.3.30
21.0.0
21.2.22
22.0.0
22.1.4
22.2.6
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
npm@angular/platform-server
Corregida 20.3.30, 21.2.22, 22.1.4 -15 d · -15 d · -14 d 22.2.6 no afectada
Versiones corregidas20.3.3021.2.2222.1.4
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Otrahttps://github.com/angular/angular/security/advisories/GHSA-v3p8-whq6-r5jg
Otrahttps://github.com/angular/angular/commit/73d8bbd27cb46495426d4132975a1355b47ad915
Otrahttps://github.com/angular/angular/commit/89b20568dfaee1ec8e0b3bcf1872acdddd2f4fef
Otrahttps://github.com/angular/angular/commit/ba3bc47b20b3d12f5eb141ec9c651373ae4d15e8
Otrahttps://github.com/angular/domino/commit/04f987dc08ff3736b427f50941adf1722458528f
Otrahttps://github.com/angular/angular
Otrahttps://github.com/angular/angular/releases/tag/v20.3.30
Otrahttps://github.com/angular/angular/releases/tag/v21.2.22
Otrahttps://github.com/angular/angular/releases/tag/v22.1.4

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.