Files
moloapp/audit/MOLO-STATIC-001

MOLO-STATIC-001: static-file jail escape via a symlinked intermediate directory

Scope: audit · README · AGENTS

In-house finding (not a public CVE), modeled on the general symlink-following path traversal class (CWE-61, "UNIX Symbolic Link Following") that underlies many static file server CVEs (for example nginx's historical alias-traversal advisories and assorted CMS/static-server CVEs that rely on O_NOFOLLOW being assumed sufficient).

Where

src/runtime/static/disk_provider.cpp, DiskProvider::open:

int fd = openat(root_fd_, path.c_str(), O_RDONLY | O_NOFOLLOW | O_CLOEXEC);

O_NOFOLLOW only blocks the kernel from dereferencing a symlink at the final component of path. If an earlier path segment is a symlink pointing outside the jailed root, the kernel follows it transparently while resolving the rest of the path, and openat succeeds. The realpath-based containment check a few lines below only runs when this openat call fails and follow_symlinks_ (default false, disk_provider.h) is true, so the strict, default configuration never reaches any containment check at all for this shape of symlink.

Relevance

DiskProvider is MoloApp's jailed static-file backend, the piece responsible for keeping /static/* requests inside the configured root. This defeats that jail with a single symlink an attacker needs only the ability to place inside the served directory tree (a common outcome of an unrelated file-upload or archive-extraction feature elsewhere in an app, or simply a misconfigured deploy that leaves a developer's symlink in place).

What the check does

Builds a scratch directory with www/escape -> outside/ (a symlink one level inside the served root) and outside/secret.txt holding a marker string, starts build/bin/runtime_interop_server on that root with follow_symlinks at its default (false), and requests GET /static/escape/secret.txt. PASS means the jail held (404); FAIL means the marker string came back.

Caveats

This does not test the follow_symlinks=true code path's own documented TOCTOU window (that path already states its own limitation in a code comment); it tests the supposedly-strict default, which the code comments do not flag as vulnerable to this shape of symlink at all.

Run: make test in this directory, or make -C audit test from the repo root.