Summary
ZITADEL's login V2 password reset mechanism constructs the reset confirmation URL using the unvalidated Forwarded or X-Forwarded-Host headers supplied by the client or intermediate proxies.
Under certain deployment configurations this can allow an attacker to influence the host portion of the emailed reset link, potentially redirecting users—and their secret reset code—to attacker-controlled domains.
Affected context
This vulnerability affects ZITADEL instances running login V2 between versions 4.0.0-rc.1 and 4.7.0 where:
- The application is deployed behind reverse proxies, load balancers, or API gateways that populate Forwarded or X-Forwarded-Host.
- These headers are trusted without strict validation or whitelisting of allowed hostnames.
- Users rely on password reset emails containing a clickable link with a secret reset code.
In such environments, an attacker able to inject or manipulate these headers on incoming requests may influence the host used in the generated password reset confirmation URL.
Exploit preconditions
- Attack surface: HTTP(S) endpoint handling password reset initiation in login V2.
- Required access: Ability to send HTTP requests to the affected ZITADEL instance and to control or influence the Forwarded or X-Forwarded-Host header (e.g., via misconfigured proxy, shared hosting, or direct header injection).
- Victim interaction: The victim must click the crafted password reset link sent to their email, which appears legitimate but points to an attacker-controlled host.
- Trigger point: Generation of the password reset confirmation URL during the "forgot password" flow, where the host is derived from Forwarded / X-Forwarded-Host rather than a fixed, trusted configuration.
- Why exploitation is possible: The application implicitly trusts client/proxy-supplied host headers to build security-sensitive links containing a secret reset code, without constraining them to an expected set of domains.
Why this happens
The underlying issue is reliance on untrusted request metadata (Forwarded and X-Forwarded-Host headers) to construct a security-sensitive URL that embeds a secret token.
This corresponds to CWE-601: URL Redirection to Untrusted Site ('Open Redirect'), where user-controllable or environment-controllable data influences the final redirect or URL destination.
Instead of using a canonical, configured application base URL, the implementation dynamically derives the host from headers that can be spoofed or incorrectly propagated, allowing attackers to direct users to domains under their control while preserving the legitimate-looking path and secret parameters.
Potential impact
- Attackers may craft password reset flows that send users to attacker-controlled domains mimicking the legitimate ZITADEL interface.
- Users could inadvertently disclose their secret password reset code or new password to an attacker-controlled service.
- Account takeover is possible if the attacker can capture the reset code or trick users into completing the reset on a malicious site that forwards the code to the attacker.
- Phishing effectiveness may increase due to the email coming from a trusted identity provider but containing a subtly manipulated host in the URL.
- Brand and trust damage for organizations relying on ZITADEL for identity and access management.
General mitigation guidance
Effective mitigation patterns focus on eliminating trust in client- or proxy-supplied host headers for security-sensitive link generation:
- Prefer a static, canonical application base URL defined in configuration or environment variables when constructing password reset and other sensitive links, rather than deriving it from request headers.
- If dynamic host handling is unavoidable, enforce strict whitelisting or allow-list validation of acceptable hostnames and schemes before using them in redirects or URLs.
- Normalize and validate Forwarded / X-Forwarded-* headers against deployment expectations, and ignore them entirely when the request path involves secret-bearing links.
- Decouple security tokens from redirect targets by treating the redirect destination as untrusted input that must be independently validated, even when it appears in internal flows.
- Harden the surrounding flows with short token lifetimes, single-use tokens, and robust verification of token binding to the intended user and context.
These practices reduce the risk that untrusted header data can influence security-critical URLs.
How teams detect issues like this
Organizations can detect and prevent similar issues using a combination of automated and manual approaches:
- Static analysis: Define rules to flag usages where:
- Forwarded, X-Forwarded-Host, Host, or related headers are read and used to build URLs or redirect targets.
- Unvalidated request headers or query parameters are concatenated into security-sensitive links.
- Code review: During manual review, focus on:
- Password reset, account activation, email verification, and login-link flows.
- Any code constructing absolute URLs using request headers or client-controlled fields.
- Security testing:
- Perform penetration tests that inject arbitrary values into Forwarded / X-Forwarded-Host to observe whether generated links or redirects reflect them.
- Use dynamic analysis tools and proxy-based testing to detect open redirect patterns and host header-based issues.
- Policy enforcement:
- Establish architectural guidelines that all externally visible URLs in authentication flows must originate from configuration, not from request metadata.
- Integrate secure coding checks into CI/CD pipelines, using linters or SAST tools configured with rules for open redirects and host header misuse.

