Skip to content

Admin privilege escalation and arbitrary code execution via malicious *.etherpad imports

Critical
rhansen published GHSA-w3g3-qf3g-2mqc Dec 9, 2021

Package

npm ep_etherpad-lite (npm)

Affected versions

< 1.8.16

Patched versions

1.8.16
etherpad (n/a)
< 1.8.16
1.8.16

Description

Impact

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 on the Etherpad server (including system commands) and in the browsers of users connected to the Etherpad server.

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 (issue #5010), 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).

Even if a reverse proxy is configured to reject access to /admin/* pages, it is still possible to crash Etherpad or bypass authorization checks to access restricted pads.

Patches

The problem has been fixed in v1.8.16. If you cannot upgrade for some reason, you can try cherry-picking the fix commits:

git cherry-pick b7065eb9a0ec..77bcb507b30e

Workarounds

If you cannot upgrade to v1.8.16 or patch, any of the following will prevent exploit:

  • Install the ep_disable_imports plugin and configure it to block *.etherpad imports. For example, you can add the following to your settings.json:
      "ep_disable_imports": {
        "deny": ["etherpad"]
      },
  • Configure your reverse proxy to reject requests to /p/*/import. This will block all imports, not just *.etherpad imports.
  • Limit all users to read-only access.
  • Prevent the reuse of express_sid cookie values that refer to deleted express-session state:
    • Uninstall any plugins that enable users to delete express-session state (e.g., by calling req.session.destroy()). Known plugins:
    • If any sessionstorage:* records are deleted, delete SESSIONKEY.txt and restart Etherpad. Etherpad will generate a new SESSIONKEY.txt file with a different key, which will invalidate the signatures in old express_sid cookies.

General Mitigations

In addition to upgrading or patching, we recommend you do the following to reduce risk if another vulnerability is discovered:

  • Run Etherpad behind a reverse proxy.
  • Configure your reverse proxy to reject requests to /admin/* and /tests/*.
  • Configure SELiniux or AppArmor to limit command execution or file access outside of the etherpad-lite directory.
  • Run Etherpad as a non-root user.
  • Run Etherpad in a minimal container (see Docker instructions).

For more information

If you have any questions or comments about this advisory:

Severity

Critical

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H

CVE ID

CVE-2021-43802