/

CVE-2026-33506

Severity:

HIGH RISK

(8.8)

Cross-Site Scripting (XSS) in Ory Polis Login Flow

CVE-2026-33506

Analyzed

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-87, CWE-601

Impact:

Client-Side Code Execution and Open Redirect

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A DOM-based Cross-Site Scripting (XSS) issue in Ory Polis's login flow allows a crafted callbackUrl parameter to be used in a client-side redirect, enabling arbitrary JavaScript execution in the victim's browser.

If a user follows a malicious login link (while authenticated, or before subsequently logging in), an attacker can steal credentials, pivot into internal applications, or trigger unauthorized actions on the user's behalf.

Affected context

The vulnerability manifests in Ory Polis deployments that:

  • Use the SAML-to-OAuth 2.0 / OpenID Connect login bridge flow
  • Accept a callbackUrl parameter from the browser as part of the login process
  • Pass that parameter into client-side routing (router.push) without strict validation, normalization, or origin checks

The issue is limited to the browser context: JavaScript executes in the victim's session for the Ory Polis origin and any trusted applications that depend on that session.

Exploit preconditions

  • Attack surface: Public-facing login endpoints that accept a callbackUrl parameter in the URL.
  • Required access: Ability to convince a user to click or visit a crafted login link (e.g., via phishing email, chat message, or injected link on another site).
  • Victim state:
  • The victim is already authenticated with Ory Polis, or
  • The victim follows the link, completes login, and is then redirected in the same browser session.
  • Trigger point: The login flow processes the callbackUrl in client-side code and calls router.push with untrusted data.
  • Why exploitation is possible: The application implicitly trusts a user-controlled URL parameter and uses it to drive client-side navigation without enforcing constraints on scheme, origin, or path, enabling DOM-based open redirect and JavaScript execution.

Why this happens

This issue stems from insufficient validation and sanitization of a user-supplied URL parameter (callbackUrl) that is used to control client-side navigation logic.

In the affected implementation, the value from the query string is passed directly into router.push, allowing an attacker to influence where the browser navigates after login and how the DOM is updated. Because the routing logic does not properly constrain the target to trusted paths or origins and does not treat the value as untrusted, an attacker can use this behavior to create a DOM-based open redirect and potentially inject or execute arbitrary JavaScript in the context of the login application.

Conceptually, this maps to:

  • CWE-601: Open Redirect, where untrusted input is used as a redirect destination; and
  • CWE-87: Improper Neutralization of Alternate XSS Syntax, reflecting the failure to safely handle attacker-controlled data that influences script execution in the DOM.

The bug class is a classic client-side trust boundary violation: navigation and post-login behavior are driven directly by user-controlled data instead of validated, server-defined targets.

Potential impact

  • Hijacking of active login sessions or theft of session tokens, ID tokens, or authorization codes exposed to client-side scripts
  • Execution of arbitrary JavaScript in the victim's browser in the context of the Ory Polis origin
  • Phishing-style attacks where the user is silently redirected to a malicious site that mimics trusted login or application pages
  • Unauthorized actions performed on behalf of the victim against integrated applications that rely on the compromised session
  • Use of the victim's browser as a pivot point to access internal web applications reachable only from the victim's network
  • Reputation damage and reduced trust in the identity and login infrastructure

General mitigation guidance

Effective mitigation focuses on enforcing strict trust boundaries for redirect targets and minimizing the influence of user-controlled parameters on client-side routing:

  • Constrain callback targets:
  • Maintain a server-side or configuration-based allowlist of permitted post-login redirect URLs (e.g., exact paths or hostnames).
  • Resolve callbackUrl only against trusted origins and reject or normalize any external or unrecognized destinations.
  • Treat callbackUrl as untrusted input:
  • Avoid passing raw URL parameters directly into routing functions such as router.push or equivalent navigation APIs.
  • Parse and validate the URL components, ensuring allowed schemes (e.g., https), hosts, and paths before using them.
  • Prefer server-driven redirects:
  • Where possible, centralize redirect decisions on the server side instead of allowing arbitrary client-side control.
  • Use opaque state or nonce tokens that map to pre-validated redirect destinations rather than embedding full URLs in the browser's query string.
  • Harden client-side rendering:
  • Avoid using untrusted data in any context that can change the DOM or script execution paths without first encoding or validating it.
  • Isolate sensitive login flows from arbitrary script execution by limiting third-party scripts and enforcing least privilege in front-end code.
  • Defensive defaults and configuration:
  • Ship secure defaults that disable arbitrary external redirects and require explicit opt-in for additional callback targets.
  • Document clear guidance for integrators about safe redirect configuration patterns and the risks of over-broad whitelists.

How teams detect issues like this

Organizations can detect similar client-side redirect and XSS issues by combining static analysis, code review, and runtime monitoring:

  • Static analysis & linters:
  • Configure JavaScript/TypeScript linters or SAST tools to flag:
  • Calls to router.push, window.location, location.assign, or similar APIs that use unvalidated query parameters or window.location fragments.
  • Any concatenation of user-controlled data into URLs or paths used for navigation.
  • Enforce rules that require use of a redirect validation helper or wrapper function whenever user input influences navigation.
  • Targeted code review:
  • Systematically review authentication, SSO, and login-related components for:
  • Direct use of callbackUrl, redirect_uri, returnTo, or similar parameters in routing logic.
  • Lack of allowlist checks or origin validation around redirect destinations.
  • Pay special attention to code that runs before or after authentication events (login success, failure, logout).
  • Runtime monitoring & security testing:
  • Use automated DAST or browser-based security tests to crawl login flows and identify parameters that cause redirects or DOM changes when manipulated.
  • Log redirect events, including source pages and destinations, and alert on unusual external domains or unexpected schemes.
  • Perform regular penetration testing of SSO and federated login flows to validate that redirect handling is constrained.
  • Policy enforcement:
  • Integrate pre-commit or CI/CD checks that block merges when risky redirect patterns are detected in critical authentication components.
  • Maintain secure coding standards specifically for handling callback and redirect parameters in identity and login services.

Sources

SourceLink
github.comgithub.com/ory/polis/releases/tag/v26.2.0
github.comgithub.com/ory/polis/security/advisories/GHSA-3wjr-6gw8-9j22

Frequently asked

questions

Yes. An attacker can exploit it remotely by sending a crafted login URL to a victim. No direct network access to the victim's environment is required beyond the ability to deliver the link over email, chat, or a web page.

Not strictly. The attack can work against users who are already logged in, or against users who follow the malicious link, complete the login flow, and are then redirected within the same browser session. The key is that the victim's browser processes the untrusted callbackUrl.

The most robust pattern is to restrict post-login redirects to a predefined allowlist of trusted destinations, validate any callbackUrl against that list on the server or in a dedicated validation layer, and avoid passing raw query parameters directly into routing APIs.

Treat all redirect and callback parameters as untrusted input, enforce strict origin and path validation for navigation targets, centralize redirect handling in well-reviewed utility functions, and mandate security-focused code review and automated checks around authentication and SSO flows.

Find out what's already
exploitable in your codebase.