GHSA-WG58-MHWV-35PQ
copyPad/movePad destinationID allows the ueberdb key delimiter ':' , bypassing the force=false overwrite guard and corrupting another pad's revision records
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:N/I:L/A:L
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-WG58-MHWV-35PQ divulgada · CVSS 3.8 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Etherpad: `copyPad`/`movePad` `destinationID` permits the ueberdb key delimiter `:`, bypassing the `force=false` overwrite guard and clobbering another pad's internal records
Target: `ether/etherpad-lite` (TypeScript, Node.js), HEAD `0cd01fce` (v3.3.2).
Class: CWE-138 Improper Neutralization of Special Elements (the ueberdb key-namespace delimiter `:`) in a pad identifier + CWE-20 improper input validation, leading to a silent overwrite-guard bypass and cross-pad data corruption.
Impact: an HTTP-API caller can supply a `destinationID` like `victim:revs:0` to `copyPad`/`movePad`/`copyPadWithoutHistory`. The embedded `:` (a) bypasses the `force=false` "destination already exists" protection and (b) writes into a different pad's internal `pad:<id>:revs:<n>` / `:chat:<n>` sub-records, corrupting that pad's revision history (time-slider, historical export, `getRevisionChangeset`, `pad.check()` break) — persistently. The pad's current head text survives, so the corruption is silent.
Channel: GitHub PVR on `ether/etherpad-lite` (open). Finder credit.
Summary
Etherpad stores every pad record in ueberdb under colon-delimited keys: `pad:<padId>` (head),
`pad:<padId>:revs:<n>` (per-revision), `pad:<padId>:chat:<n>` (chat). The pad-id validator, however,
does not forbid the `:` delimiter:
// src/node/db/PadManager.ts (isValidPadId, ~202)
const padIdRegex = /^(g.[a-zA-Z0-9]{16}\$)?[^$]+$/; // forbids '$' only — ':' is allowedThe HTTP API sanitizes the `padID`/`padName` fields (`APIHandler.ts:222-230` runs `sanitizePadId`,
which maps `:`→`_`), but the copy/move family takes its destination via the `destinationID` field
(`APIHandler.ts` version map: `copyPad`/`movePad`/`copyPadWithoutHistory` use `sourceID`/`destinationID`,
not `padID`/`padName`), so `destinationID` is never sanitized and a `:` survives into the engine.
`Pad.copy()` (`src/node/db/Pad.ts:~634`) guards against overwriting an existing destination via
`removePadIfForceIsTrueAndAlreadyExist(destinationID, force)`, which calls
`padManager.doesPadExist(destinationID)`. But `doesPadExist` (`PadManager.ts:~156`) decides existence by
reading the record's top-level `atext` field:
const value = await db.get(`pad:${padId}`);
return value != null && value.atext != null;A revision record (`pad:victim:revs:0`) stores its atext under `meta`, not at the top level, so
`doesPadExist('victim:revs:0')` returns false even though the record exists. The guard is therefore
silently bypassed (even with `force=false`), and `copyRecord` executes
`db.set('pad:victim:revs:0', <source head object>)` — overwriting the victim pad's revision-0 snapshot
with an object that has no valid changeset/meta.
Runtime PoC (RUNTIME-PROVEN against a live instance)
Etherpad v3.3.2, default dirtyDB, `authenticationMethod: apikey`. Full transcript in
`req-resp/poc-run.txt`, re-runnable via `repro.sh` (reads the apikey from `APIKEY.txt`/env, never
hardcoded; uses unique pad names so it is idempotent):
pads: victim=victim_6925921c src=src_6925921c
victim rev0 BEFORE : Z:1>p*0+p$TOP-SECRET-victim-content
CONTROL copy src->victim (force=false): {code:1, "destinationID already exists"} <-- guard fires normally
EXPLOIT copy src->victim:revs:0 (force=false): {code:0, "ok"} <-- guard BYPASSED by ':'
victim rev0 AFTER : None <-- victim rev-0 record corrupted
victim head still loads : {text: "TOP-SECRET-victim-content\n"} <-- silent (head intact)The control proves the `force=false` existence guard normally rejects a duplicate destination; the
exploit shows the same call with a `:`-bearing `destinationID` succeeds and destroys the victim pad's
revision-0 changeset (`getRevisionChangeset(victim,0)` now returns `null` instead of the original
changeset). `movePad` behaves identically and additionally deletes the source; `copyPadWithoutHistory`
shares the unsanitized `destinationID`.
Severity
`CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:N/I:L/A:L` = 4.2 (Medium).
- `PR:H` — reaching the unsanitized `destinationID` requires the global API key (or an OAuth-admin token); ordinary end-user surfaces (web `/p/`, socket `CLIENT_READY`, `createPad`/`createGroupPad`) all sanitize the `:` away, so this is not reachable by an unauthenticated/low-priv user.
- `I:L` / `A:L` — persistent corruption of an arbitrary pad's revision history and a partial DoS of that pad's history features (time-slider, historical export, `getRevisionChangeset`, `pad.check`); the pad's current head content is unaffected. `C:N` — no read-back.
Honest framing. The API-key holder is a trusted actor who can already `deletePad`/`setText` any pad, so this is not a privilege-boundary break. What makes it a genuine, fixable defect rather than expected admin power: (1) `force=false` is a documented safety contract (“do not overwrite an existing destination”) that this silently violates; (2) the write lands in a different pad's internal namespace than the one named, via a delimiter the id validator should never have allowed; (3) it is a latent footgun for any integration that forwards a user-controlled value into the documented `destinationID` parameter. The fix is small and unambiguous.
Suggested fix
Forbid the ueberdb delimiter `:` in `isValidPadId` (and/or run `sanitizePadId` on `sourceID`/`destinationID`
in `APIHandler` exactly as for `padID`/`padName`), and make `doesPadExist` robust (e.g. check key
presence, not just a top-level `atext`) so the overwrite guard cannot be bypassed by sub-namespace keys.
Dup-gate
Distinct from all 8 published advisories: none touch `copyPad`/`movePad`, `isValidPadId`'s `:` handling,
the ueberdb key namespace, or the `doesPadExist`/`force` guard. (GHSA-2jwf is import/export temp paths;
GHSA-w3g3 is `.etherpad` import RCE; the rest are XSS / admin-header / token / OAuth-claim issues.) FRESH.
## Evidence
- `repro.sh` — deterministic, idempotent PoC (reads apikey from env/APIKEY.txt).
- `req-resp/poc-run.txt` — captured run: control (guard fires) vs exploit (guard bypassed + rev-0 corrupted).
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-wg58-mhwv-35pqLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
