GHSA-6WRV-5CP6-H3C5
sanitize-html mXSS via namespace-blind MathML integration point
CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:L/I:L/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-6WRV-5CP6-H3C5 divulgada · CVSS 3.7 (GitHub) | |
| Divulgación | Modificada | Última actualización del registro | |
| Remediación | Parche 2.18.2 | sanitize-html · 0 d desde divulgación | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
With math, annotation-xml and style allowed, sanitize-html 2.18.1 returns the payload unchanged and it executes on innerHTML. htmlparser2 treats annotation-xml as an HTML integration point in every namespace and ignores its encoding attribute, so the inner style is RAWTEXT to the parser but foreign content to Chromium.
Details
htmlparser2 Parser.ts:103 builds htmlIntegrationElements with no namespace or encoding check; Parser.ts:432 pushes ForeignContext.None for every match, so the inner style becomes RAWTEXT and its body reaches sanitize-html as one text node. Chromium keeps annotation-xml in foreign content unless encoding is text/html, does not RAWTEXT the style, and breaks out on img, creating a live element with its handler. sanitize-html index.js:671-676 appends that body raw; the textarea/xmp branches at index.js:680-704 do escape theirs, so the 2.17.6 fix was never extended to style. Suggested fix: escape < unconditionally in style bodies; in htmlparser2 split the set and gate annotation-xml on encoding.
Proof of concept
options = { allowedTags: ['math','annotation-xml','style'], allowVulnerableTags: true }
in = <math><annotation-xml><style><img src=x onerror=alert(1)></style></annotation-xml></math>
sanitizeHtml(in, options) returns in byte for byte, and sanitizeHtml(output, options) returns it again. Assigning the output to innerHTML fires the handler.Impact
XSS in the session of any viewer, in applications that allow those three tags. img and on* do not need to be allowed.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
npmsanitize-html |
Corregida | 2.18.2 | 0 d | 2.18.2 no afectada |
2.18.2Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/apostrophecms/apostrophe/security/advisories/GHSA-6wrv-5cp6-h3c5Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
