Summary
A reflected cross-site scripting vulnerability in Immich's /auth/login flow allows attacker-controlled JavaScript to execute in the application's origin via a crafted continue URL parameter.
When a victim clicks a malicious login link while authenticated, the injected script can abuse their existing session to mint all-permission API keys and fully compromise their account.
Affected context
The issue occurs in Immich deployments that use the affected commits and expose the /auth/login page to users.
It manifests when the continue query parameter from the URL is passed directly into SvelteKit's redirect() logic without validating scheme, origin, or content.
This context is most risky when users are already authenticated and can be induced to follow attacker-controlled login links, such as through phishing, chat messages, or embedded redirects.
Exploit preconditions
- Attack surface: Public-facing
/auth/loginendpoint in the Immich web UI. - Required access: Ability to convince a logged-in user to click a crafted URL containing a malicious
continueparameter. - Trigger point: Processing of the
continuequery parameter during the login flow and its use in SvelteKit'sredirect()call. - Why exploitation is possible: The application trusts the
continueparameter and uses it in redirect logic without validating scheme or origin, enabling attacker-controlled script execution within Immich's origin and under the victim's authenticated session.
Why this happens
The root cause is insufficient validation of user-controlled data used in redirect and navigation logic.
Specifically, the continue query parameter from the request URL is treated as a trusted redirect target and passed directly into SvelteKit's redirect() function, with no scheme, origin, or content checks.
This behavior aligns with CWE-79 (Improper Neutralization of Input During Web Page Generation) and CWE-601 (Open Redirect) because untrusted input influences the client's navigation in a way that can inject executable script into the application context.
The insecure pattern is relying on client-side redirects driven by unvalidated query parameters, effectively allowing an attacker to control where and how the browser executes code under the site's origin.
Potential impact
- An attacker may execute arbitrary JavaScript in the victim's browser under Immich's origin.
- An attacker could mint all-permission API keys using the victim's existing authenticated session.
- The attacker may gain persistent access to the victim's account and stored media.
- An attacker could perform privileged actions such as modifying settings, accessing private albums, or sharing content as the victim.
- The vulnerability can be used as a building block for broader lateral movement within environments that trust Immich API keys.
General mitigation guidance
Effective mitigation centers on reducing trust in user-controlled redirect parameters and preventing script execution through them.
Common defensive patterns include:
- Validating redirect targets against a strict allowlist of internal paths, rejecting any external schemes, origins, or malformed values.
- Avoiding direct use of query parameters in redirect logic without normalization and canonicalization.
- Ensuring that any data used in client-side navigation is encoded and treated as data, not executable content.
- Implementing robust output encoding in templates and components that render URL-derived values.
- Applying least-privilege principles to API keys and session actions so that a single compromised session cannot mint unconstrained credentials.
How teams detect issues like this
Detection usually combines review of redirect logic and analysis of user-controlled parameters:
- Static analysis rules targeting open redirect and XSS sinks, such as functions that perform redirects or manipulate
locationbased on query parameters. - Code review practices that flag direct usage of request parameters (e.g.,
continue,next,returnUrl) in redirect or navigation flows without validation or allowlisting. - Security-focused linting or automated tooling configured to detect unvalidated redirect targets and unencoded template outputs.
- Runtime monitoring of unusual redirect patterns and suspicious query parameters in authentication-related endpoints.
- Policy enforcement requiring explicit validation functions or helpers for all redirect parameters in web applications.

