Summary
Ech0 improperly validates OAuth redirect URIs by checking only their scheme and host, while ignoring path, query, and fragment components. An attacker may use an attacker-controlled path on an allowed host to receive a one-time authorization exchange code and, if that code leaks, exchange it for a victim's access and refresh tokens.
Affected context
The vulnerability occurs in Ech0's OAuth authentication flow when a client-supplied redirect_uri is accepted by parseAndValidateClientRedirect and later embedded in the signed state token. Deployments are at risk when the configured allowlist contains a host that can serve attacker-influenced paths, expose referrer data, or provide an open redirect, and when the resulting exchange code can reach an attacker.
Exploit preconditions
- Attack surface: OAuth authorization and callback handling in the Ech0 authentication service
- Required access: Ability to initiate or influence an OAuth authorization request with a crafted redirect URI; victim interaction is generally required
- Trigger point: Redirect URI validation during login, followed by the OAuth exchange and callback redirect
- Additional condition: The one-time exchange code must leak through a referrer, analytics system, open redirect, or comparable channel
- Why exploitation is possible: Validation compares only scheme and host, allowing attacker-influenced path components to pass while the full URI is preserved for the post-authentication redirect
Why this happens
The underlying bug is incomplete redirect URI validation, mapping to CWE-601: URL Redirection to Untrusted Site. The implementation treats matching scheme and host as sufficient proof that the complete redirect destination is trusted, even though path, query, and fragment components can alter where sensitive callback data is delivered. Embedding the insufficiently validated URI into the signed state token preserves the unsafe destination through the authentication flow.
Potential impact
- An attacker could obtain a victim's one-time OAuth exchange code
- The leaked code could be exchanged for the victim's access and refresh tokens
- A victim account could be compromised or impersonated
- Unauthorized actions could be performed with the victim's privileges
- Tokens or authentication metadata could be exposed through browser and telemetry channels
General mitigation guidance
Mitigation generally focuses on validating the complete redirect URI against an explicit, trusted allowlist rather than comparing only its origin.
Common defensive patterns include:
- Require exact matching of approved scheme, host, port, path, and relevant URI components
- Prefer registered, fixed callback endpoints over user-controlled redirect paths
- Reject ambiguous, normalized, encoded, or otherwise non-canonical URI forms
- Keep authorization codes out of destinations that may expose them to referrers or third-party scripts
- Apply short lifetimes, single use, and strict client binding to authorization exchange codes
- Limit token scope and service privileges according to least-privilege principles
- Use browser and response policies that reduce referrer and unintended data disclosure
How teams detect issues like this
Detection can combine static analysis, code review, and runtime policy enforcement.
- Search for redirect validation that compares only scheme, host, or origin without exact path validation
- Review every location where
redirect_uriis parsed, stored, signed, redirected, or returned to a browser - Flag OAuth callbacks that place authorization codes in destinations controlled by request data
- Test allowlist enforcement with differing paths, ports, encoded characters, query strings, and fragments
- Monitor exchange endpoints for unusual code redemption patterns, mismatched clients, or rapid redemption from unrelated locations
- Enforce centralized OAuth redirect URI policies through CI checks and automated security review tools

