Advisory Database
  • Advisories
  • Dependency Scanning
  1. golang
  2. ›
  3. github.com/axllent/mailpit
  4. ›
  5. CVE-2026-22689

CVE-2026-22689: Mailpit is vulnerable to Cross-Site WebSocket Hijacking (CSWSH) allowing unauthenticated access to emails

January 13, 2026

Summary 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.

Vulnerable Code The 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.

https://github.com/axllent/mailpit/blob/877a9159ceeaf380d5bb0e1d84017b24d2e7b361/server/websockets/client.go#L34-L39

Impact This vulnerability impacts the Confidentiality of the data stored in or processed by Mailpit. Although Mailpit is often used as a local development tool, this vulnerability allows remote exploitation via a web browser.

  • Scenario: A developer has Mailpit running at localhost:8025.
  • Trigger: The developer visits a malicious website (or a compromised legitimate site) in the same browser.
  • 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.
  • Data Leak: The attacker receives all broadcasted events, including full email details (subjects, sender/receiver info) and server metrics.

Attack Impact

  • Real-time notification of new emails
  • Email metadata (sender, subject, recipients)
  • Mailbox statistics
  • All WebSocket broadcast data

Recommended Fix The 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.

Proposed Change (Remove unsafe check):

var upgrader = websocket.Upgrader{
ReadBufferSize:    1024,
WriteBufferSize:   1024,
// CheckOrigin: func(r *http.Request) bool { return true }, // REMOVED
EnableCompression: true,
}

Proof of Concept (PoC): To reproduce this vulnerability:

References

  • github.com/advisories/GHSA-524m-q5m7-79mm
  • github.com/axllent/mailpit
  • github.com/axllent/mailpit/commit/6f1f4f34c98989fd873261018fb73830b30aec3f
  • github.com/axllent/mailpit/security/advisories/GHSA-524m-q5m7-79mm
  • nvd.nist.gov/vuln/detail/CVE-2026-22689

Code Behaviors & Features

Detect and mitigate CVE-2026-22689 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 0.0.0-20260110031614, all versions starting from 1.2.6 before 1.28.2

Fixed versions

  • 1.28.2
  • 0.0.0-20260110031614

Solution

Upgrade to versions 0.0.0-20260110031614, 1.28.2 or above.

Impact 6.5 MEDIUM

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N

Learn more about CVSS

Weakness

  • CWE-1385: Missing Origin Validation in WebSockets

Source file

go/github.com/axllent/mailpit/CVE-2026-22689.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Wed, 04 Feb 2026 00:35:12 +0000.