Skip to content
Path traversal Advisory Intermediate CVE-2022-22931

GHSL-2022-002_GHSL-2022-003: Partial path traversal in Apache James Server - CVE-2022-22931

The Apache James Server used a path validation check that compared canonical paths with a string prefix, which allowed a user to access mailboxes or Sieve scripts of other users whose names started with the same prefix. An attacker could read another user's mailbox or scripts by exploiting this partial path traversal.

jarlob Follow

Originally disclosed on GitHub Security Lab

Partial path traversal allows to break out of expected folder and access another user’s mailbox.

jarlob, on GitHub Security Lab

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 report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The code used a simple string prefix check on canonical paths without ensuring the expected root ended with a path separator, so a sibling directory with a name starting with the same characters passed the check.

Impact

A user could read mailboxes or Sieve scripts of other users whose names started with the same prefix, but only within the same parent directory.

What the attacker needed

A valid user account; knowledge of another username prefix

The fix

The issue was fixed in version 3.6.2 by ensuring the canonical root path ends with a slash before the prefix check.

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 report has not been written yet. The Original tab links to the source.

The server checked whether a file path started with a safe folder path, but it did not require a slash at the end. So a folder like '/mail/alice' would also match '/mail/alice2', letting one user reach another user's data. This is called a path traversal because the path can escape the intended folder.

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 jarlob

View all

192 more disclosed reports, best first.

More from GitHub Security Lab

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.