Skip to main content
Vulnerability Database/CVE-2025-62379

CVE-2025-62379: Reflex Python Library XSS Vulnerability

CVE-2025-62379 is a cross-site scripting vulnerability in Reflex Python library that enables attackers to redirect users to malicious external URLs through unvalidated parameters. This article covers technical details, affected versions, impact assessment, and mitigation strategies.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2025-62379 Overview

CVE-2025-62379 is an open redirect vulnerability [CWE-601] in Reflex, a Python library for building full-stack web applications. The flaw affects versions 0.5.4 through 0.8.14 and resides in the /auth-codespace endpoint. The endpoint assigns the redirect_to query parameter directly to a client-side anchor element and triggers an automatic click when the page loads. Attackers can craft URLs that redirect users to arbitrary external domains. The route only registers when a GitHub Codespaces environment is detected, but the detection can be triggered in production if the GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN environment variable is set. Reflex patched the issue in version 0.8.15.

Critical Impact

Attackers can redirect authenticated users to attacker-controlled domains, enabling phishing and credential theft campaigns that leverage the trusted Reflex application origin.

Affected Products

  • Reflex versions 0.5.4 through 0.8.14
  • Deployments with GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN environment variable set
  • GitHub Codespaces environments running Reflex applications

Discovery Timeline

  • 2025-10-15 - CVE-2025-62379 published to NVD
  • 2026-10-19 - Last updated in NVD database

Technical Details for CVE-2025-62379

Vulnerability Analysis

The vulnerability resides in the client-side JavaScript served by the /auth-codespace endpoint in reflex/utils/codespaces.py. The doRedirect function reads the redirect_to query parameter and assigns it directly to an anchor element's href property. The code then immediately simulates a click, triggering automatic navigation to the specified URL.

The execution is gated only by a sessionStorage flag named authenticated_github_codespaces. On first visits or in incognito/private browsing windows, this flag is absent and the redirect fires immediately. No server-side origin validation, scheme whitelist, or internal path enforcement exists in vulnerable versions.

Root Cause

The root cause is missing input validation on the redirect_to parameter before using it as a navigation target. The code trusts the user-supplied URL and performs no comparison against the application's own hostname or allowed destinations. This matches the classic pattern described in CWE-601: URL Redirection to Untrusted Site.

Attack Vector

An attacker crafts a URL pointing to the vulnerable /auth-codespace endpoint with a malicious redirect_to parameter. When a victim clicks the link, the Reflex application loads and the client-side script automatically navigates the browser to the attacker-controlled domain. The redirect occurs under the Reflex application's trusted origin, improving the credibility of downstream phishing pages.

python
 const thisUrl = new URL(window.location.href);
 const params = new URLSearchParams(thisUrl.search)
 
+function sameHostnameDifferentPort(one, two) {{
+    const hostnameOne = one.hostname;
+    const hostnameTwo = two.hostname;
+    const partsOne = hostnameOne.split(".");
+    const partsTwo = hostnameTwo.split(".");
+    if (partsOne.length !== partsTwo.length) {{ return false;  }}
+    for (let i = 1; i < partsOne.length; i++) {{
+        if (partsOne[i] !== partsTwo[i]) {{ return false; }}
+    }}
+    const uniqueNameOne = partsOne[0];
+    const uniqueNameTwo = partsTwo[0];
+    const uniqueNamePartsOne = uniqueNameOne.split("-");
+    const uniqueNamePartsTwo = uniqueNameTwo.split("-");
+    if (uniqueNamePartsOne.length !== uniqueNamePartsTwo.length) {{ return false;  }}
+    for (let i = 0; i < uniqueNamePartsOne.length - 1; i++) {{
+        if (uniqueNamePartsOne[i] !== uniqueNamePartsTwo[i]) {{ return false;  }}
+    }}
+    return true;
+}}
+
 function doRedirect(url) {{
     if (!window.sessionStorage.getItem("authenticated_github_codespaces")) {{
         const a = document.createElement("a");
         if (params.has("redirect_to")) {{
-            a.href = params.get("redirect_to")
+            const redirect_to = new URL(params.get("redirect_to"));
+            if (!sameHostnameDifferentPort(thisUrl, redirect_to)) {{

Source: Reflex patch commit ade12549. The patch introduces sameHostnameDifferentPort to confirm the destination shares the application's base hostname before performing the redirect.

Detection Methods for CVE-2025-62379

Indicators of Compromise

  • HTTP requests to /auth-codespace containing a redirect_to query parameter pointing to external domains
  • Referer chains showing navigation from Reflex applications to unexpected third-party hosts
  • Production servers with the GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN environment variable set
  • Phishing emails or messages containing links to legitimate Reflex application domains with redirect_to parameters

Detection Strategies

  • Review web server access logs for requests to /auth-codespace with redirect_to values whose hostname does not match the application's own domain
  • Inspect running Reflex deployments for the GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN environment variable
  • Enumerate deployed Reflex versions and flag any instance within the 0.5.4 through 0.8.14 range

Monitoring Recommendations

  • Alert on outbound navigations originating from /auth-codespace to hostnames outside the organization's approved domain list
  • Monitor environment variable configurations in production container images and deployment manifests
  • Track dependency manifests (requirements.txt, pyproject.toml) for pinned Reflex versions below 0.8.15

How to Mitigate CVE-2025-62379

Immediate Actions Required

  • Upgrade Reflex to version 0.8.15 or later across all development, staging, and production deployments
  • Audit production environments and remove the GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN environment variable where it is not required
  • Review authentication flows that rely on redirect_to parameters and validate downstream URLs against an allow list

Patch Information

The fix is available in Reflex 0.8.15. The patch, committed as ade12549f3c0ddab3d7382c581bc04a3c1f989ec, adds the sameHostnameDifferentPort helper and restricts redirects to URLs that share the application's base hostname. Full details are in the GitHub Security Advisory GHSA-rfh5-c9h5-q8jm.

Workarounds

  • Ensure GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN is unset in all production environments to prevent registration of the vulnerable route
  • Deploy a reverse proxy rule that blocks requests to /auth-codespace when the application is not running inside GitHub Codespaces
  • Implement Content Security Policy (CSP) headers restricting navigation targets where feasible
bash
# Verify the environment variable is not set in production
unset GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN

# Upgrade Reflex to the patched version
pip install --upgrade "reflex>=0.8.15"

# Confirm installed version
pip show reflex | grep Version

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.