Skip to content

Privilege escalation by design

Critical
mdecimus published GHSA-rwp5-f854-ppg6 May 16, 2024

Package

Stalwart Mail Server

Affected versions

<= 0.7.3

Patched versions

0.8.0

Description

Summary

Attackers who achieved Arbitrary Code Execution as the stalwart-mail user (including web interface admins) can gain complete root access to the system.

Details

Usually, system services are run as a separate user (not as root) to isolate an attacker with Arbitrary Code Execution to the current service. Therefore, other system services and the system itself remains protected in case of a successful attack. stalwart-mail runs as a separate user, but it can give itself full privileges again in a simple way, so this protection is practically ineffective. Actually, it is so simple, there is even a web admin GUI to do this:
gui

PoC

  1. Modify the configuration to run stalwart-mail as root (either via overwriting the file as the local stalwart-mail user, or over the network using the admin interface needing admin credentials)
  2. Run arbitrary commands as root by configuring them as pipe filter and triggering these filters (technically, not part of the privilege escalation; untested)

Impact

  1. Server admins who handed out the admin credentials to the mail server, but didn't want to hand out complete root access to the system.
  2. Any attacked user when the attackers gained Arbitrary Code Execution using another vulnerability.

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
High
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:H/UI:N/S:C/C:H/I:H/A:H

CVE ID

CVE-2024-35187

Credits