Stalwart: Delegate with One Shared Folder Reads and Deletes the Entire Mailbox
A user who was given access to a single folder of someone else's mailbox attaches every message of the account to that folder through JMAP, reads it in full and can delete it.
Advisory ID: TP-2026-138
Product: Stalwart (open-source mail and collaboration server with SMTP, IMAP, JMAP, CalDAV, CardDAV and WebDAV)
Vulnerability type: Missing authorization check in JMAP Email/set (CWE-863)
CVE: not requested
CVSS 3.1: 8.1 (High) · CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N
Affected versions: up to and including v0.16.27 (verified live: v0.16.22)
Fixed in: v1.0.0
Reported: 17 September 2026
Summary
Stalwart is an open-source mail and collaboration server in which users share individual folders of their mailbox with others. The update path of JMAP Email/set loads a message by its id alone and, when a mailbox is added, checks only the rights on the target mailbox. Whether the caller may read the message at all is not checked. A delegate with read and insert rights on a single shared folder attaches every message of the account to that folder and then reads it in full, including messages from Inbox, Drafts, Sent and Trash. IMAP is not affected.
Root cause
Line numbers refer to v0.16.22. The update path of Email/set computes the ACL bitmaps of the mailboxes (crates/jmap/src/email/set.rs:84-86) and then loads each message by its document_id alone, without checking that it lies in a mailbox the caller can read (crates/jmap/src/email/set.rs:823-828).
An added mailbox is authorized against the target mailbox only (crates/jmap/src/email/set.rs:986-992); the mailboxes that already contain the message are not consulted.
The destroy path of the same file filters per message through shared_messages (crates/jmap/src/email/set.rs:1147), and so does Email/copy (crates/jmap/src/email/copy.rs:80).
The update path resolves only the document id and ignores the thread prefix of the JMAP id, so counting through small integers reaches every message of the account.
The rights lri on one folder are sufficient, the minimum of a usable share; lr alone is rejected.
Proof of Concept
["Email/set", {
"accountId": "<owner account>",
"update": { "<email id>": { "mailboxIds/<id of the shared folder>": true } }
}, "0"],
["Email/get", {
"accountId": "<owner account>",
"ids": ["<email id>"],
"properties": ["subject", "from", "bodyValues", "textBody"],
"fetchAllBodyValues": true
}, "1"]
The first call attaches a message from a folder that is not shared to the shared folder as well, the second reads it through the read right on that folder. Verified on v0.16.22 in the default configuration; adding, reading and removing again leave the owner's view unchanged and produce no entry at the default log level.
Impact
- Read access to every message of the account for any delegate with read and insert rights on a single folder.
- With a typical full share of the folder, the delegate sets keywords on arbitrary messages and deletes them permanently from the owner's account.
- The response also discloses the ids of mailboxes on which the caller has no rights.
- The access leaves no trace in the log in the default configuration.
References
Is Something Like This in Your Software?
Our team found this vulnerability during its work. Have your applications tested by the same specialists, with a penetration test from turingpoint.
