Skip to content

Commit ab9ebd0

Browse files
1 parent e6465ff commit ab9ebd0

1 file changed

Lines changed: 84 additions & 0 deletions

File tree

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
2+
"schema_version": "1.4.0",
3+
"id": "GHSA-524m-q5m7-79mm",
4+
"modified": "2026-01-13T15:11:42Z",
5+
"published": "2026-01-13T15:11:42Z",
6+
"aliases": [
7+
"CVE-2026-22689"
8+
],
9+
"summary": "Mailpit is vulnerable to Cross-Site WebSocket Hijacking (CSWSH) allowing unauthenticated access to emails",
10+
"details": "**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.",
11+
"severity": [
12+
{
13+
"type": "CVSS_V3",
14+
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N"
15+
}
16+
],
17+
"affected": [
18+
{
19+
"package": {
20+
"ecosystem": "Go",
21+
"name": "github.com/axllent/mailpit"
22+
},
23+
"ranges": [
24+
{
25+
"type": "ECOSYSTEM",
26+
"events": [
27+
{
28+
"introduced": "1.2.6"
29+
},
30+
{
31+
"fixed": "1.28.2"
32+
}
33+
]
34+
}
35+
]
36+
},
37+
{
38+
"package": {
39+
"ecosystem": "Go",
40+
"name": "github.com/axllent/mailpit"
41+
},
42+
"ranges": [
43+
{
44+
"type": "ECOSYSTEM",
45+
"events": [
46+
{
47+
"introduced": "0"
48+
},
49+
{
50+
"fixed": "0.0.0-20260110031614"
51+
}
52+
]
53+
}
54+
]
55+
}
56+
],
57+
"references": [
58+
{
59+
"type": "WEB",
60+
"url": "https://github.com/axllent/mailpit/security/advisories/GHSA-524m-q5m7-79mm"
61+
},
62+
{
63+
"type": "ADVISORY",
64+
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-22689"
65+
},
66+
{
67+
"type": "WEB",
68+
"url": "https://github.com/axllent/mailpit/commit/6f1f4f34c98989fd873261018fb73830b30aec3f"
69+
},
70+
{
71+
"type": "PACKAGE",
72+
"url": "https://github.com/axllent/mailpit"
73+
}
74+
],
75+
"database_specific": {
76+
"cwe_ids": [
77+
"CWE-1385"
78+
],
79+
"severity": "MODERATE",
80+
"github_reviewed": true,
81+
"github_reviewed_at": "2026-01-13T15:11:42Z",
82+
"nvd_published_at": "2026-01-10T06:15:51Z"
83+
}
84+
}

0 commit comments

Comments
 (0)