CVE-2026-81036: Stalwart Mail Server through 0.16.19 Authorization Code Disclosure via Unvalidated OAuth redirect_uri
Stalwart Mail Server does not compare an OAuth redirect target against any registered destination in its default configuration. The validation routine in crates/http/src/auth/oauth/registration.rs returns success immediately when the client-authentication requirement is disabled, and that requirement is false in the shipped settings, so the supplied redirect value is neither matched against a registered client nor otherwise constrained. The value is stored with the authorization code, and the login page reads it back and sends the browser to it with the code attached. A request naming a destination the attacker controls therefore delivers a valid authorization code there once the account holder authenticates, and because the token endpoint checks only that the redirect presented at exchange matches the one recorded with the code, the same party can exchange it for access and refresh tokens and read the account's mail.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
Stalwart Mail Serverto a version that resolves this vulnerability.Fixed in 0.16.19 - Configuration
Enable the client-authentication requirement so the OAuth redirect_uri is validated against a registered client; this prevents authorization codes from being disclosed to an unvalidated redirect target.
Stalwart Mail Server OAuth registration/authorization code flow client-authentication requirement = true
Event History
Frequently Asked Questions
Are installations using the shipped settings affected?
Yes. The shipped settings disable the client-authentication requirement, which causes redirect URI validation to succeed without checking the supplied destination against a registered client.
What does an attacker need to exploit this?
The attacker needs to send a victim through an OAuth authorization flow using a redirect URI under the attacker’s control and have the account holder authenticate. No attacker privileges are required, but victim interaction is required.
What can an attacker obtain after a successful attack?
The attacker can receive the authorization code at their chosen redirect destination, then exchange it using the same redirect URI for access and refresh tokens. The provided data states that these tokens can be used to read the victim’s mail.