github.com/axllent/mailpit
Affected
- introduced
1.2.6, fixed1.28.2(semver)
Fixed versions
1.28.2
Fix
- Fixed version
1.28.2go get github.com/axllent/[email protected]
Advisory
Also known as: CVE-2026-22689, GO-2026-4310
Mailpit is vulnerable to Cross-Site WebSocket Hijacking (CSWSH) allowing unauthenticated access to emails
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.
Attack Impact
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:
Medium Basis: The source's own band: MODERATE
1.2.6, fixed 1.28.2 (semver)1.28.2
1.28.2go get github.com/axllent/[email protected]0, fixed 0.0.0-20260110031614 (semver)0.0.0-20260110031614
0.0.0-20260110031614go get github.com/axllent/[email protected]Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0