GHSA-6VX2-3GWR-958V
Stored XSS in HTML diff export via unescaped author color values in getHTMLFromAtext
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-6VX2-3GWR-958V divulgada · CVSS 6.1 (GitHub) | |
| Divulgación | Modificada | Última actualización del registro | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
Etherpad's HTML export builder `getHTMLFromAtext` in `src/node/utils/ExportHtml.ts` interpolates the pad author id and its resolved color into an inline `<style>` block without any HTML or CSS escaping. An attacker who imports a crafted `.etherpad` file can plant an arbitrary, non hex `colorId` on a `globalAuthor` record (the import path writes the record verbatim and performs no color format validation), and can plant an arbitrary author attribute value in the pad pool. When an integrator later calls the `createDiffHTML` HTTP API, the unvalidated values are concatenated directly into the exported `<style>` element, so the attacker can break out of the CSS context and inject arbitrary HTML/script, yielding stored cross site scripting in whatever consumer renders the diff HTML. In a default deployment pad import is available to anonymous users.
Root Cause
The security invariant that user controlled attribute pool data must be neutralized before it is placed into HTML output is violated on the author colors branch of the export builder. The published fix for CVE-2026-55090 (GHSA-2jp7-wwpg-3p9w) added `Security.escapeHTMLAttribute` only to the `exportHtmlAdditionalTagsWithData` plugin hook callback; a separate, later, synchronous block that builds the per author background color CSS was never guarded. The author id is passed through `stripDotFromAuthorID`, which only replaces `.` with `_`, and the color value is emitted with no neutralization at all. A second contributing defect is that the `.etherpad` import path stores imported `globalAuthor` records verbatim and never validates the `colorId` format, so the hex color guards enforced on the live socket path never apply to imported data.
Sink: getHTMLFromAtext, src/node/utils/ExportHtml.ts (author colors branch)
css += `.${propName} {background-color: ${authorColors[attr[1]]}}\n`;
propName = `author${stripDotFromAuthorID(attr[1])}` // only "." -> "_"
Enabler: setPadRaw, src/node/utils/ImportEtherpad.ts
imported globalAuthor record (including colorId) written verbatim, no color validation
Color source: getAllAuthorColors, src/node/db/Pad.ts
returnTable[authorId] = colorPalette[colorId] || colorId // returns raw value for a non-numeric colorIdImpact
An attacker needs only the ability to import a `.etherpad` file, which is anonymous by default (`requireAuthentication` defaults to `false`, and a fresh pad passes the import revision gate). By planting a non hex `colorId` (and an author attribute value in the pad pool), the attacker causes arbitrary HTML/script to be emitted into the `<style>` block of the `createDiffHTML` output. When a consumer renders that diff HTML, the injected script executes in the consumer's origin, enabling session or token theft and actions performed as the victim. Execution depends on a consumer that renders the diff HTML: Etherpad's own bundled UI does not render `createDiffHTML` output, so the script fires in an integrating application (for example an administrative, moderation, or history review integration) that displays the diff. This is the same export rendered by a consumer threat model under which the primary CVE was accepted. No direct availability impact is demonstrated.
Proof of Concept
`Node.js (tested with v24), no dependencies. The script reproduces the exact vulnerable concatenation from the author colors branch of getHTMLFromAtext, fed the two attacker controlled inputs that reach it at runtime: an author attribute value in apool.numToAttrib and the raw colorId returned by getAllAuthorColors.`
- Plant a `globalAuthor` record with a malicious `colorId` and an `['author', <id>]` attribute in the pad pool by importing a crafted `.etherpad` file into a fresh pad.
- Cause an integrator to call `createDiffHTML` for that pad, which resolves the author color and emits the export.
- Observe the unescaped payload in the emitted `<style>` block.
const stripDotFromAuthorID = (id) => id.replace(/\./g, '_');
function buildAuthorCss(apool, authorColors) {
let css = '';
if (authorColors) {
css += '<style>\n';
for (const a of Object.keys(apool.numToAttrib)) {
const attr = apool.numToAttrib[a];
if (attr[0] === 'author' && attr[1] !== '') {
const propName = `author${stripDotFromAuthorID(attr[1])}`;
css += `.${propName} {background-color: ${authorColors[attr[1]]}}\n`;
}
}
css += '</style>';
}
return css;
}
const apool = { numToAttrib: { '0': ['author', 'a.evil'] } };
const payload = 'red}</style><script>alert(document.domain)</script><style>{';
console.log(buildAuthorCss(apool, { 'a.evil': payload }));<style>
.authora_evil {background-color: red}</style><script>alert(document.domain)</script><style>{}
</style>Negative control: routing the same value through `Security.escapeHTMLAttribute` (the escaping the primary fix applies on the plugin hook branch) neutralizes the payload, confirming the missing escape on the author colors branch is the root cause.
Attack Chain
- Exposure: In a default deployment anonymous users may create and import into pads (`requireAuthentication` defaults to `false`), and `POST /p/<pad>/import` accepts a `.etherpad` file for a fresh pad (the `headCount >= 10` gate passes at head 0).
- Control: The attacker fully controls a `globalAuthor.colorId` string and an `['author', <id>]` pool attribute inside the crafted `.etherpad` file.
- Path: `setPadRaw` writes the imported `globalAuthor` record verbatim (only `padIDs` type, pad id consistency, and author existence are checked; `colorId` is never inspected), so the socket side hex color guards never run on this data.
- Path: An integrator calls `createDiffHTML`, which invokes `PadDiff.getHtml`, calls `getAllAuthorColors` (returning `colorPalette[colorId] || colorId`, that is the raw payload for a non numeric value), and passes it as `authorColors` to `getHTMLFromAtext`.
- Guard: The author colors branch of `getHTMLFromAtext` applies no HTML or CSS escaping to either the author id (CSS selector) or the color value; the escaping added for CVE-2026-55090 lives in a different callback and does not execute here.
- Primitive: The raw payload is concatenated into the `<style>` element, allowing a break out of the CSS context into arbitrary HTML.
- Result: Stored XSS executes in the origin of any consumer that renders the `createDiffHTML` output, enabling session or token theft and actions as the victim.
Bypass Evidence
The prior advisory GHSA-2jp7-wwpg-3p9w (CVE-2026-55090) is the relevant reference. Its fix (PR #7905) escapes only the `exportHtmlAdditionalTagsWithData` plugin hook value (`span data-<k>="<v>"`); the advisory text and the released source both confirm the fix does not touch the author colors `<style>` branch. The following disproof attempts were made and all failed to invalidate the finding:
- Checked whether `colorId` is validated anywhere on the import path: `setPadRaw` performs no color validation and `getAuthorColorId` returns the stored value raw.
- Checked whether the palette lookup neutralizes the payload: the color palette is an array, so a non numeric string index resolves to `undefined` and the `|| colorId` fallback returns the raw attacker string.
- Checked whether the browser CSSOM rejects the invalid color: CSSOM validation applies only to the client side color assignment sinks, not to this server side string concatenation into exported HTML.
- Checked whether the branch is dead code: `getHTMLFromAtext` is invoked with an `authorColors` argument from exactly one caller, the live `createDiffHTML` API, so the branch is reachable.
- Checked whether this is a duplicate: the released v3.3.3 artifact still emits the unescaped concatenation at the author colors branch, so the primary fix does not cover this path.
The verified v3.3.3 released artifact retains `Security.escapeHTMLAttribute` on the plugin hook branch while the author colors branch still concatenates the color value unescaped, confirming the gap is present in the latest release.
Affected Versions
- `Ecosystem: npm`
- `Package: ep_etherpad-lite`
- `Confirmed affected range: <= 3.3.3`
- `Latest release checked: v3.3.3 (GitHub release, published 2026-07-29; source and Docker image etherpad/etherpad)`
- `Fix status: not fixed (the author colors export branch remains unescaped on the current release and development branch)`
Distribution coordinate disagreement: the npm coordinate `ep_etherpad-lite` is frozen at 1.8.14 and does not carry the modern 3.x line, which is distributed through GitHub source releases and the Docker image `etherpad/etherpad`. Affectedness was verified against the v3.3.3 released source of `src/node/utils/ExportHtml.ts`, which still contains the unescaped author colors concatenation. The introduction boundary is not precisely pinned because the vulnerable export code and the unvalidated import write are both long standing, so an open ended lower bound is used and the earliest affected release is not asserted. No fixed release exists.
Suggested Fix
Enforce output neutralization on the author colors branch of `getHTMLFromAtext`: escape or strictly constrain the author id used in the CSS selector (for example restrict it to `[A-Za-z0-9_-]`) and validate or escape the resolved color value, rejecting anything that is not a well formed `#hex` color before it is interpolated into the `<style>` block, consistent with the escaping already applied on the plugin hook branch. As defense in depth, validate the `colorId` format for imported `globalAuthor` records in `setPadRaw` so that imported data is subject to the same constraints as data set through the live socket path. Interim mitigation: restrict pad import to trusted authenticated users and ensure integrations that render `createDiffHTML` output sanitize it before display.
Reported by zx (GitHub: @manus-pi).
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 |
|---|---|---|---|---|
npmep_etherpad-lite |
Sin parche | — | — | 1.8.14 afectada |
Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/ether/etherpad/security/advisories/GHSA-6vx2-3gwr-958vLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
