Summary
Homarr's /auth/login page contains a DOM-based Cross-Site Scripting vulnerability where the callbackUrl parameter is trusted and passed directly into redirect logic.
When a victim opens a crafted login link while authenticated, an attacker-controlled callbackUrl can trigger a client-side redirect and execute arbitrary JavaScript in the victim's browser.
Affected context
The vulnerability occurs in Homarr's web login flow on the /auth/login page, specifically in how the application processes the callbackUrl parameter supplied in the browser's address bar.
The issue manifests in deployments where:
- The login page is reachable by users (including over the internet), and
- The application passes callbackUrl from the URL directly into redirect and router navigation logic on the client.
It becomes especially risky when authenticated users can be tricked into clicking attacker-crafted login links that include a malicious callbackUrl.
Exploit preconditions
- Attack surface: Web browser, via HTTP(S) requests to Homarr's
/auth/loginendpoint. - Required access: Ability to send or host a malicious link that a logged-in user will open (e.g., via email, chat, or another website).
- Victim state: The victim must be authenticated or must log in after following the link so that the redirect occurs in a valid session.
- Trigger point: The login page's client-side code reads the callbackUrl parameter from the URL and passes it into redirect / router.push without proper validation or sanitization.
- Why exploitation is possible: The application implicitly trusts callbackUrl, allowing attacker-controlled values to influence navigation and script execution in the victim's browser context.
Why this happens
The underlying problem is improper handling of untrusted data in client-side navigation logic, aligning with CWE-601: Open Redirect and related DOM-based XSS patterns.
The login page reads callbackUrl directly from the URL query string and feeds it into redirect mechanisms (e.g., router.push) without enforcing a strict allowlist of trusted destinations or normalizing and encoding the value.
In a DOM-based XSS scenario, this means attacker-controlled URL parameters influence browser behavior entirely on the client side: the JavaScript logic interprets or constructs URLs using untrusted input, which can be abused to execute arbitrary JavaScript within the application's origin.
Abstractly, this is an instance of "trusting client-controlled navigation parameters," where redirect targets are not treated as tainted data and are reused without validation or encoding.
Potential impact
- Theft of session tokens, API keys, or other sensitive data accessible via the victim's browser context.
- Execution of arbitrary JavaScript in the user's session, allowing an attacker to perform actions on behalf of the victim.
- Phishing or credential harvesting via convincing but malicious redirects.
- Internal network pivoting by using the victim's browser to send requests to internal services.
- Persistent or repeated unauthorized operations if the attacker's script maintains control through the browser session.
General mitigation guidance
Effective mitigation for this vulnerability class focuses on reducing trust in navigation parameters and strictly constraining redirects:
- Treat all URL parameters (especially redirect/callback URLs) as untrusted user input.
- Enforce a strict allowlist of permitted redirect targets, such as same-origin paths or specifically enumerated routes within the application.
- Normalize and validate callbackUrl before using it: strip protocol/host components, reject external origins, and block JavaScript or data URLs.
- Avoid passing raw, attacker-controlled parameters directly into router.push or similar navigation APIs; instead, map them to internal route identifiers or state keys.
- Apply defense-in-depth content security measures (e.g., CSP with no unsafe-inline/scripts from trusted origins only) to reduce the blast radius of any remaining XSS vectors.
- Use secure-by-default routing helpers or wrappers that encapsulate safe redirect behavior and discourage ad hoc handling of navigation parameters.
How teams detect issues like this
Detection can rely on both code-centric and behavior-centric approaches:
- Static analysis: Configure linters or SAST tools to flag uses of redirect or router navigation functions that incorporate raw URL parameters (e.g., callback, next, redirect, returnUrl).
- Code review signals: Look for patterns where query parameters are read from window.location, router query, or search params and are then used directly in redirects, window.location assignments, or dynamic script construction.
- Security testing: Use targeted penetration tests for login and redirect flows, verifying that callback/redirect parameters cannot be used to send users off-site or execute script.
- Policy enforcement: Introduce coding guidelines or ESLint/TypeScript rules that require redirect targets to pass through centralized validation utilities rather than being used directly in UI components.

