/

CVE-2026-81036

Severity:

HIGH RISK

(8.1)

OAuth Open Redirect (CWE-601) in Stalwart Mail Server

CVE-2026-81036

Deferred

Vulnerability type

Category:

Open Redirect

CWE:

CWE-601

Impact:

OAuth Authorization Code and Mail Account Compromise

Severity:

HIGH RISK

(8.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Stalwart Mail Server may accept an OAuth redirect destination without checking it against a registered client destination in its default configuration. An attacker who can initiate an authorization request with a destination they control may capture a valid authorization code and exchange it for access and refresh tokens after the account holder authenticates.

Affected context

The issue occurs in OAuth authorization flows where client authentication is disabled and redirect destinations are therefore not constrained by registered client metadata. The supplied destination is retained with the authorization code, returned through the login flow, and later accepted by the token endpoint when it matches the value recorded with that code.

Exploit preconditions

  • Attack surface: OAuth authorization and login endpoints
  • Required access: Ability to construct or submit an OAuth authorization request; the victim must authenticate to the affected account
  • Trigger point: Processing the authorization request and redirecting the browser after authentication
  • Why exploitation is possible: The default validation path can return success without matching the redirect against a registered destination, while the token exchange validates only consistency with the stored value

Why this happens

The underlying bug is insufficient validation of an OAuth redirect URI, mapping to CWE-601: URL Redirection to Untrusted Site. When client authentication is disabled, the validation routine accepts the supplied destination instead of requiring an exact match against an approved registration. The authorization code is then bound to that attacker-controlled destination, allowing the code to be delivered outside the intended trust boundary.

Potential impact

  • An attacker could capture an authorization code
  • The attacker may exchange the code for access and refresh tokens
  • Unauthorized parties could read the affected account's mail
  • Compromised tokens could enable persistent access until revoked or expired
  • The issue could facilitate privacy breaches and account-level abuse

General mitigation guidance

Mitigation generally focuses on making redirect validation mandatory and

fail-closed.

Common defensive patterns include:

  • Require exact matching against pre-registered redirect destinations
  • Avoid accepting arbitrary redirect values from authorization requests
  • Treat client authentication and redirect registration as security controls
  • Use narrowly scoped, short-lived authorization codes and tokens
  • Apply least privilege to OAuth clients and limit mail access scopes
  • Bind authorization codes to the intended client and other relevant request context
  • Provide token revocation and monitoring controls for suspicious OAuth activity

How teams detect issues like this

Organizations can look for:

  • Static analysis findings where redirect parameters are accepted without allowlist comparison
  • Code review signals showing validation bypasses when client authentication is disabled
  • OAuth tests that submit unregistered, cross-origin, or attacker-controlled redirect destinations
  • Policy checks requiring exact redirect URI matching and fail-closed behavior
  • Logs containing unusual redirect destinations, repeated authorization requests, or unexpected token exchanges
  • Automated security testing or code review tools that model OAuth redirect-flow misuse

Sources

SourceLink
github.comgithub.com/stalwartlabs/stalwart
github.comgithub.com/stalwartlabs/stalwart/blob/v0.16.19/crates/http/src/auth/oauth/registration.rs
github.comgithub.com/stalwartlabs/stalwart/issues/3205
vulncheck.comvulncheck.com/advisories/stalwart-mail-server-through-0.16.19-authorization-code-disclosure-via-unvalidated-oauth-redirect-uri

Frequently asked

questions

It may be exploitable through the OAuth web flow when an attacker can submit a

crafted authorization request and persuade an account holder to authenticate.

The attacker generally does not need the victim's password, but must control

or monitor the destination supplied in the authorization request and induce the

victim to complete the login flow.

Require every redirect destination to match an approved, registered value using

strict, fail-closed validation. Do not treat disabled client authentication as

permission to accept arbitrary redirect targets.

Test OAuth flows with unregistered and cross-origin destinations, enforce

redirect allowlists through policy, use short-lived and narrowly scoped tokens,

and monitor authorization and token-exchange activity.

Find out what's already
exploitable in your codebase.