Skip to content
RCE Write-up Advanced

Zimbra - Remote Command Execution (CVE-2024-45519)

The Zimbra postjournal service passed unsanitised SMTP recipient addresses to popen, allowing command injection. An unauthenticated attacker could execute arbitrary commands as the Zimbra user if the service was enabled and the attacker was within the allowed network range.

httpvoid.com

Published on httpvoid.com

Note - This is cross post from our work at Projectdiscovery Blog

The author, on httpvoid.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The unpatched postjournal binary constructed a shell command string from user-supplied SMTP recipient addresses and passed it to popen without sanitisation.

Impact

An unauthenticated attacker could execute arbitrary commands as the Zimbra user, but only if the postjournal service was enabled and the attacker's IP was within the allowed mynetworks range.

What the attacker needed

Postjournal service enabled; attacker IP in mynetworks range; SMTP access to port 25 or 10027

The fix

The patched version replaced popen with execvp and added an is_safe_input function to sanitise input.

How it was found

  1. Send an SMTP EHLO command to the postjournal service on port 10027.
  2. Send a MAIL FROM command with a sender address.
  3. Send a RCPT TO command with a recipient address containing shell metacharacters.
  4. Send DATA and a message body, then a dot to end the message.
  5. Observe that the injected command executes (e.g., a file is created or an out-of-band request is made).

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

The postjournal program took an email address from an SMTP command and used it to build a shell command without cleaning it. Because special characters like $() were not removed, an attacker could make the server run their own commands. This only worked if the postjournal service was turned on and the attacker's IP was in the allowed list.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.