GHSA-4373-R6WJ-CHQ8
HAXCMS stored XSS sanitizer bypass via slash-delimited event attributes
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-4373-R6WJ-CHQ8 divulgada | |
| Remediación | Parche 26.8.1 | @haxtheweb/haxcms-nodejs · 0 d desde divulgación | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
`@haxtheweb/haxcms-nodejs` 26.0.1 still has a stored XSS sanitizer bypass after the recent `saveNode` event-handler hardening. The current `sanitizeHTMLForStorage()` implementation removes event handler attributes when they are preceded by whitespace or quotes, but it does not handle HTML attributes separated from the tag name or a previous attribute by `/`.
Browsers normalize payloads such as:
<svg/onload="alert(1)"></svg>
<details/open/ontoggle="alert(1)">x</details>
<video><source/onerror="alert(1)" src="x"></video>
<input autofocus/onfocus="alert(1)">into normal event handler attributes, for example `<svg onload="...">`, and execute them. Because HAXCMS stores sanitized page content to generated page files, an authenticated page editor can persist JavaScript that executes when the page is viewed.
This appears to be a bypass/incomplete fix for the sanitizer class of issues recently addressed in `CVE-2026-48527` / `GHSA-g2g8-95qg-v35h`.
Affected component
Package: `@haxtheweb/haxcms-nodejs`
Observed latest version: `26.0.1`
Source repository: `haxtheweb/haxcms-nodejs`
Security policy/reporting repository: `haxtheweb/issues`
Relevant code paths:
- `src/lib/sanitizeContent.js`: `sanitizeHTMLForStorage()` removes event handler attributes using regexes that require whitespace or quotes before the attribute name.
- `src/routes/saveNode.js`: saves `sanitizeHTMLForStorage(data.content)` via `page.writeLocation(...)` and regenerates alternate page formats.
- `src/routes/createNode.js`, `src/routes/saveOutline.js`, and `src/routes/siteSearch.js` also store content after `sanitizeHTMLForStorage(...)`.
Technical details
The vulnerable sanitizer logic is:
clean = clean.replace(/(\s+|["'])on[a-z0-9_-]+\s*=\s*(".*?"|'.*?'|[^\s>]+)/gi, '$1')
clean = clean.replace(
/(\s+|["'])([a-zA-Z_:][a-zA-Z0-9_.:-]*)\s*=\s*("([^"]*)"|'([^']*)'|([^\s>]+))/g,
...
)Both patterns require the attribute boundary to be whitespace or a quote. HTML parsers also accept `/` as a separator in these payload shapes, so the sanitizer misses event handler attributes like `/onload=` and `/ontoggle=`.
Local function-level verification on 26.0.1:
const { sanitizeHTMLForStorage } = require('./src/lib/sanitizeContent.js');
console.log(sanitizeHTMLForStorage('<svg/onload=alert(1)>'));
console.log(sanitizeHTMLForStorage('<details/open/ontoggle=alert(1)>x</details>'));
console.log(sanitizeHTMLForStorage('<video><source/onerror=alert(1) src=x></video>'));
console.log(sanitizeHTMLForStorage('<input autofocus/onfocus=alert(1)>'));Observed output:
<svg/onload=alert(1)>
<details/open/ontoggle=alert(1)>x</details>
<video><source/onerror=alert(1) src=x></video>
<input autofocus/onfocus=alert(1)>Browser behavior validation with the default HAXCMS CSP policy showed execution after HTML parsing:
- `<svg/onload="parent.__pushed.push('svgOnload')"></svg>` executed.
- `<details/open/ontoggle="parent.__pushed.push('detailsOntoggle')">x</details>` executed.
- `<video><source/onerror="parent.__pushed.push('sourceOnerror')" src=x></video>` executed.
- `<input autofocus/onfocus="parent.__pushed.push('inputAutofocus')">` executed.
- `<body/onload="parent.__pushed.push('bodyOnload')">` executed.
The browser normalized these into standard event-handler attributes, for example:
<svg onload="..."></svg>
<details open="" ontoggle="...">x</details>
<source onerror="..." src="x">
<input autofocus="" onfocus="...">Impact
An authenticated user with page editing permissions can inject stored JavaScript into HAXCMS page content. When another user views the affected page, the script executes in the HAXCMS page context under the site's CSP, which permits inline JavaScript. This can expose browser-accessible HAXCMS state/tokens or allow actions as the victim within their permissions, similar to prior stored XSS advisories.
I would classify this as High severity because it is a stored XSS bypass in a CMS content editing endpoint and can affect privileged viewers.
Suggested remediation
Regex-based HTML sanitization is fragile here. Prefer parsing HTML and removing dangerous nodes/attributes from the parsed tree, or use a maintained sanitizer such as DOMPurify in server-side mode with an explicit allowlist.
If keeping the current approach temporarily, the event and URL-like attribute matching needs to treat `/` and other browser-accepted separators as attribute boundaries, and it should be covered by regression tests for at least:
<svg/onload=...>
<details/open/ontoggle=...>
<video><source/onerror=... src=x></video>
<input autofocus/onfocus=...>
<body/onload=...>Credit
Please credit the finder as: Yaohui Wang
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
npm@haxtheweb/haxcms-nodejs |
Corregida | 26.8.1 | 0 d | 26.8.1 no afectada |
26.8.1Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/haxtheweb/issues/security/advisories/GHSA-4373-r6wj-chq8Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
