Summary
ZITADEL Login V2 contains a stored cross-site scripting vulnerability in certain OIDC and SAML error paths where redirect URIs are used without safety checks.
If an administrator configures a malicious JavaScript or data URI as the default redirect, it can execute in a user's browser whenever the affected login error condition is triggered.
Affected context
This vulnerability appears in ZITADEL's Login V2 flows for OIDC and SAML when handling FailedPrecondition errors.
It is relevant in deployments where organization or instance administrators can set loginSettings.defaultRedirectUri, and where those values are later used for client-side navigation.
The issue manifests when redirect URIs are not validated against a safelist or scheme check before being passed to the routing logic in the browser.
Exploit preconditions
- Attack surface: User login flows in ZITADEL Login V2 for OIDC and SAML.
- Required access: Ability to configure
loginSettings.defaultRedirectUri(typically organization or instance admin privileges). - Trigger point: A FailedPrecondition error during login that causes the client to call
router.pushwith the stored default redirect. - Why exploitation is possible: The redirect value is used without applying an
isSafeRedirectUricheck, allowing JavaScript or data URIs to be interpreted and executed by the browser.
Why this happens
The underlying bug is a client-side redirect handling pattern that assumes stored redirect URIs are safe and does not re-validate them at use time.
In the FailedPrecondition error paths, loginSettings.defaultRedirectUri is passed directly to router.push without invoking the safety check (isSafeRedirectUri), violating the expectation that navigation targets are constrained to benign locations.
This maps to CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting), because attacker-controlled script-capable URIs are incorporated into the web application flow and can lead to execution in the user's browser.
Potential impact
- Malicious JavaScript execution in the user's browser during login error handling.
- Theft of session tokens or other sensitive authentication data.
- Phishing-style UI manipulation within the identity portal.
- Unwanted redirection to attacker-controlled resources.
- Potential compromise of accounts through injected scripts that act on behalf of the user.
General mitigation guidance
Effective mitigation focuses on consistently validating and constraining redirect targets used in authentication flows.
Recommended patterns include:
- Applying a strict
isSafeRedirectUri-style check to all redirect URIs at the point of use, not just at configuration time. - Restricting allowed URI schemes to HTTPS (and other trusted schemes) and rejecting
javascript:ordata:URIs outright. - Using an allowlist of known-good domains or paths for post-login and error redirects, with centralized enforcement.
- Treating administrative configuration values as untrusted input and subjecting them to the same validation and encoding rules as user input.
- Designing login error handling to avoid dynamic client-side navigation based on unvalidated configuration fields.
How teams detect issues like this
Detection can rely on a combination of code-level and configuration-level analysis:
- Static analysis rules that flag uses of client-side routing APIs (e.g.,
router.push) with unvalidated configuration or request parameters. - Code review checklists that require verification of redirect validation logic in all authentication and error-handling paths.
- Security tests that attempt to store
javascript:ordata:URIs in redirect-related configuration and observe browser behavior during login failures. - Policy enforcement that scans configuration stores for unsafe URI schemes or patterns and alerts maintainers.
- Use of automated application security testing tools that specialize in discovering XSS and unsafe redirect behaviors in login flows.

