Skip to content
Cache bugs Write-up Advanced

Zimbra Email - Stealing Clear-Text Credentials via Memcache injection

Zimbra's reverse proxy failed to escape newline characters in usernames before sending them to Memcached, allowing an attacker to inject arbitrary Memcached commands. An unauthenticated attacker could poison route cache entries so that when a victim's mail client reconnects, its clear-text IMAP credentials are forwarded to an attacker-controlled server.

sonarsource Follow

Published on sonarsource.com

Zimbra is an enterprise-level email solution, similar to Microsoft Exchange. It comes with mail servers, load balancing features, a powerful web interface, and more.

Sonar (@SonarSource), on sonarsource.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

Likely the reverse proxy constructed Memcached commands from user-controlled input without escaping carriage-return and line-feed characters, and it also did not validate the key in Memcached responses.

Impact

An unauthenticated attacker could steal clear-text credentials of users who connect via IMAP, gaining access to their mailboxes; the attack requires no user interaction and works with default configurations, though it does not affect users who only use the web client.

What the attacker needed

No authentication needed; victim uses an IMAP mail client; attacker knows victim's email address (first strategy); or use response smuggling (second strategy)

The fix

Zimbra patched the vulnerability by hashing all Memcache keys with SHA-256 before sending them, so newlines cannot be injected.

How it was found

  1. Send an HTTP request to the Zimbra proxy with a crafted username containing newline characters and an injected Memcached command.
  2. The proxy forwards the injected command to Memcached, which executes it.
  3. Use the injection to overwrite the IMAP route cache entry for a known victim with an attacker-controlled server address.
  4. Wait for the victim's mail client to reconnect, causing its clear-text credentials to be sent to the attacker's server.

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.

Zimbra is an email server. Its front door (a reverse proxy) uses a fast in-memory cache called Memcached to remember which back-end server holds each user's mailbox. The proxy built cache commands by pasting in the username without cleaning it, so a username containing line breaks could add extra commands. An attacker could then change the stored route for a victim so that the victim's email program sends its password to the attacker's server.

What is Cache bugs?

A cache and the origin disagree about a request, so a poisoned response is served to everyone or a private page is stored as public.

More by sonarsource

View all

5 more disclosed reports, best first.

More from Zimbra

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Web cache poisoning and deception

The lesson behind this report.

A cache and the origin disagree about a request, so a poisoned response is served to everyone or a private page is stored as public.