CVE-2026-12985 is a critical OAuth redirect URI validation flaw in Mattermost's Dynamic Client Registration (DCR) endpoint. The vulnerability stems from glob pattern matching against raw URI strings rather than parsed URL components—specifically, the scheme, host, port, path, query, and fragment are not separated before matching. This allows an attacker to register a malicious OAuth client with a redirect URI containing a legitimate allowlisted prefix while smuggling the true target into the query string. During authorization, the server approves the redirect because the raw string technically matches the glob pattern.

The attack requires no authentication to register the malicious client. An attacker registers the client, thenphishes or socially engineers a victim through the authorization flow. When the victim authenticates, the authorization code routes to the attacker-controlled endpoint embedded in the redirect URI.

Affected versions span 11.7.x through 11.9.x—this indicates the flaw persisted across three release cycles, likely surviving code review because validation was occurring, just at the wrong abstraction layer.

Priority actions: First, verify whether your Mattermost deployment exposes the DCR endpoint (typically at /api/v4/oauth/register) to untrusted networks—if so, restrict access immediately. Second, audit existing dynamically-registered OAuth clients for redirect URIs containing suspicious query parameters or unexpected hosts. Third, if patching is imminent, note that the fix requires proper URL parsing before glob matching—verify the vendor patch enforces host-boundary semantics rather than merely tightening the glob patterns. Finally, treat a compromised Mattermost OAuth token as organizational-level compromise: tokens grant access to channels, files, integrations, and bot accounts, creating potential lateral movement paths into connected systems.