{"id":"CVE-2026-22689","aliases":["CVE-2026-22689","GHSA-524m-q5m7-79mm","GO-2026-4310"],"related":[],"kind":"vulnerability","state":"published","title":"Mailpit is vulnerable to Cross-Site WebSocket Hijacking (CSWSH) allowing unauthenticated access to emails","summary":"Mailpit is an email testing tool and API for developers. Prior to version 1.28.2, the Mailpit WebSocket server is configured to accept connections from any origin. This lack of Origin header validation introduces a Cross-Site WebSocket Hijacking (CSWSH) vulnerability. An attacker can host a malicious website that, when visited by a developer running Mailpit locally, establishes a WebSocket connection to the victim's Mailpit instance (default ws://localhost:8025). This allows the attacker to intercept sensitive data such as email contents, headers, and server statistics in real-time. This issue has been patched in version 1.28.2.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Mailpit is an email testing tool and API for developers. Prior to version 1.28.2, the Mailpit WebSocket server is configured to accept connections from any origin. This lack of Origin header validation introduces a Cross-Site WebSocket Hijacking (CSWSH) vulnerability. An attacker can host a malicious website that, when visited by a developer running Mailpit locally, establishes a WebSocket connection to the victim's Mailpit instance (default ws://localhost:8025). This allows the attacker to intercept sensitive data such as email contents, headers, and server statistics in real-time. This issue has been patched in version 1.28.2.","source":"cvelist"},{"lang":"en","text":"**Summary**\nThe Mailpit WebSocket server is configured to accept connections from any origin. This lack of Origin header validation introduces a Cross-Site WebSocket Hijacking (CSWSH) vulnerability.\n\nAn attacker can host a malicious website that, when visited by a developer running Mailpit locally, establishes a WebSocket connection to the victim's Mailpit instance (default ws://localhost:8025). This allows the attacker to intercept sensitive data such as email contents, headers, and server statistics in real-time.\n\n**Vulnerable Code**\nThe vulnerability exists in server/websockets/client.go where the CheckOrigin function is explicitly set to return true for all requests, bypassing standard Same-Origin Policy (SOP) protections provided by the gorilla/websocket library.\n\nhttps://github.com/axllent/mailpit/blob/877a9159ceeaf380d5bb0e1d84017b24d2e7b361/server/websockets/client.go#L34-L39\n\n**Impact**\nThis vulnerability impacts the Confidentiality of the data stored in or processed by Mailpit.\nAlthough Mailpit is often used as a local development tool, this vulnerability allows remote exploitation via a web browser.\n\n- **Scenario**: A developer has Mailpit running at localhost:8025.\n- **Trigger**: The developer visits a malicious website (or a compromised legitimate site) in the same browser.\n- **Exploitation**: The malicious site's JavaScript initiates a WebSocket connection to ws://localhost:8025/api/events. Since the origin check is disabled, the browser allows this cross-origin connection.\n- **Data Leak**: The attacker receives all broadcasted events, including full email details (subjects, sender/receiver info) and server metrics.\n\n**Attack Impact**\n- Real-time notification of new emails\n- Email metadata (sender, subject, recipients)\n- Mailbox statistics\n- All WebSocket broadcast data\n\n**Recommended Fix**\nThe `CheckOrigin` function should be removed to allow gorilla/websocket to enforce its default safe behavior (checking that the Origin matches the Host). Alternatively, strict validation logic should be implemented.\n\n**Proposed Change (Remove unsafe check):**\n\n```go\nvar upgrader = websocket.Upgrader{\n    ReadBufferSize:    1024,\n    WriteBufferSize:   1024,\n    // CheckOrigin: func(r *http.Request) bool { return true }, // REMOVED\n    EnableCompression: true,\n}\n```\n\n**Proof of Concept (PoC)**: To reproduce this vulnerability:\n\n- Start Mailpit (default settings).\n- Save the following HTML code as poc.html and serve it from a different origin (e.g., using python http.server on port 8000 or opening it directly as a file).\n- Open the [poc_websocket_hijack.html](https://github.com/user-attachments/files/24522726/poc_websocket_hijack.html) file in your browser.\n- Send a test email to Mailpit or perform any action in the Mailpit UI.\n- Observe that the \"malicious\" page successfully receives the event data.","format":"markdown","source":"ghsa"},{"lang":"en","text":"Mailpit is vulnerable to Cross-Site WebSocket Hijacking (CSWSH) allowing unauthenticated access to emails in github.com/axllent/mailpit.\n\nNOTE: The source advisory for this report contains additional versions that could not be automatically mapped to standard Go module versions.\n\n(If this is causing false-positive reports from vulnerability scanners, please suggest an edit to the report.)\n\nThe additional affected modules and versions are: github.com/axllent/mailpit before v0.0.0-20260110031614.","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.28.2, el servidor WebSocket de Mailpit está configurado para aceptar conexiones desde cualquier origen. Esta falta de validación del encabezado Origin introduce una vulnerabilidad de Cross-Site WebSocket Hijacking (CSWSH). Un atacante puede alojar un sitio web malicioso que, cuando es visitado por un desarrollador que ejecuta Mailpit localmente, establece una conexión WebSocket con la instancia de Mailpit de la víctima (por defecto ws://localhost:8025). Esto permite al atacante interceptar datos sensibles como el contenido de los correos electrónicos, los encabezados y las estadísticas del servidor en tiempo real. Este problema ha sido parcheado en la versión 1.28.2.","source":"nvd"}],"published":"2026-01-10T05:46:13.771Z","modified":"2026-06-17T10:20:14.330Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N","score":6.5,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N","score":6.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N","score":6.5,"rating":"MEDIUM"}],"cwes":["CWE-1385"],"affected":[{"ranges":[{"version":"< 1.28.2","status":"affected"}],"vendor":"axllent","product":"mailpit","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"1.2.6","status":"affected","fixed":"1.28.2"}],"ecosystem":"Go","package":"github.com/axllent/mailpit","purl":"pkg:golang/github.com/axllent/mailpit","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.0.0-20260110031614"}],"ecosystem":"Go","package":"github.com/axllent/mailpit","purl":"pkg:golang/github.com/axllent/mailpit","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"1.2.6","status":"affected","fixed":"1.28.2"}],"ecosystem":"Go","package":"github.com/axllent/mailpit","purl":"pkg:golang/github.com/axllent/mailpit","source":"go"},{"ranges":[{"status":"affected","fixed":"1.28.2"}],"vendor":"axllent","product":"mailpit","cpe":"cpe:2.3:a:axllent:mailpit:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/axllent/mailpit/security/advisories/GHSA-524m-q5m7-79mm","tags":["advisory","exploit","mitigation","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/axllent/mailpit/commit/6f1f4f34c98989fd873261018fb73830b30aec3f","tags":["fix","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-22689","tags":["advisory"],"sources":["ghsa","go"]},{"url":"https://github.com/axllent/mailpit","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-01-12T16:47:26.726Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-22689","url":"https://www.cve.org/CVERecord?id=CVE-2026-22689","licence":"CVE Terms of Use","modified":"2026-01-12T16:47:34.722Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-524m-q5m7-79mm","url":"https://github.com/advisories/GHSA-524m-q5m7-79mm","licence":"CC-BY-4.0","modified":"2026-02-03T03:01:29.999Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-4310","url":"https://pkg.go.dev/vuln/GO-2026-4310","licence":"CC-BY-4.0","modified":"2026-01-23T02:56:17.348Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-22689","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-22689","licence":"Public domain","modified":"2026-06-17T10:20:14.330Z"}],"updatedAt":"2026-11-25T22:59:12.716Z","epss":{"score":0.00239,"percentile":0.1607,"date":"2026-12-01T12:00:22.000Z"}}