Skip to content
Path traversal Write-up Advanced

Unrar Path Traversal Vulnerability affects Zimbra Mail

A path traversal flaw in the unrar utility allowed a crafted RAR archive to write files outside the intended extraction directory. In Zimbra, an unauthenticated attacker could send such an archive as an email attachment, leading to remote code execution.

sonarsource Follow

Published on blog.sonarsource.com

At Sonar, we are studying real-world vulnerabilities to improve our code analyzers, and to help the open-source community to secure their projects. To uncover and understand complex vulnerabilities in high-profile applications, our researchers need to take the perspective of real-world attackers.

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

The symbolic link target was validated before backslashes were converted to forward slashes, so a path traversal sequence using backslashes bypassed the check.

Impact

An unauthenticated attacker could execute arbitrary code on the Zimbra server, potentially accessing all emails and escalating privileges, though on distributed installations some exploitation paths may not work.

What the attacker needed

Unrar installed on the server; ability to send email to a Zimbra mailbox

The fix

RarLab patched unrar to ensure the validated path matches the path used to create the symlink, and Zimbra mitigated by configuring Amavis to use 7z instead of unrar.

How it was found

  1. Craft a RAR archive containing a symbolic link of type FSREDIR_WINSYMLINK with a target that uses backslashes to attempt path traversal.
  2. Send the archive as an email attachment to a Zimbra mailbox.
  3. Zimbra's Amavis service automatically extracts the archive using unrar.
  4. The symbolic link is created outside the extraction directory, allowing file write to arbitrary locations.
  5. Use the file write to place a malicious file (e.g., a JSP shell) in a web-accessible directory to achieve code execution.

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 unrar tool, used to unpack RAR archives, failed to properly check symbolic links inside archives. A malicious archive could trick it into writing files to any location on the server. In Zimbra, this meant an attacker could email a specially crafted RAR file and gain control of the server without needing any login.

What is Path traversal?

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.

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.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.