Skip to content

Open Redirect in GitHub Codespaces Environments

Low
adhami3310 published GHSA-rfh5-c9h5-q8jm Oct 14, 2025

Package

pip reflex (pip)

Affected versions

>=0.5.4, <0.8.15

Patched versions

0.8.15

Description

Mitigation

Make sure GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN is not set in a production environment. So the following is correct:

assert os.getenv("GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN") is None

Vulnerability Description


Vulnerability Overview

  • When the GET /auth-codespace page loads in a GitHub Codespaces environment, it automatically assigns the redirect_to query parameter value directly to client-side links without any validation and triggers automatic clicks. This allows attackers to redirect users to arbitrary external URLs.
  • The route is only registered when a Codespaces environment is detected, and the detection is controlled by environment variables. This means that the same behavior can be activated in production if the corresponding environment variable is set.

Vulnerable Code Analysis

@once
def redirect_script() -> str:
"""Get the redirect script for Github Codespaces.
Returns:
The redirect script as a string.
"""
return f"""
const thisUrl = new URL(window.location.href);
const params = new URLSearchParams(thisUrl.search)
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")
}} else if (!window.location.href.startsWith(url)) {{
a.href = url + `?redirect_to=${{window.location.href}}`
}} else {{
return
}}
a.hidden = true;
a.click();
a.remove();
window.sessionStorage.setItem("authenticated_github_codespaces", "true")
}}
}}
doRedirect("{Endpoint.AUTH_CODESPACE.get_url()}")
"""

  • This code assigns the redirect_to query parameter directly to a.href without any validation and immediately triggers a click (automatic navigation), allowing users to be sent to arbitrary external domains, resulting in an open redirect vulnerability.
  • The execution condition is simply based on the presence of a sessionStorage flag, meaning it triggers immediately on first visits or in incognito/private browsing windows, with no server-side origin/scheme whitelist or internal path enforcement defenses in place.

PoC


PoC Description

image
  • Used the production configuration from docker-example (docker-example/production-compose).
  • Added a Codespaces detection environment variable to the app container in compose.yaml to forcibly expose the route.
  • GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN: dummy
  • The reverse proxy (Caddy) needs to be configured to forward /auth-codespace to the backend (required depending on the environment).

curl Example

https://localhost/auth-codespace?redirect_to=http://google.com

PoC MP4
https://file.notion.so/f/f/d105d145-04bc-45c5-b46c-ed880895e9de/a86c3e3b-f67f-45d1-8fa2-4aa0ba7d0068/poc.mp4?table=block&id=26955717-5d2e-805a-b53c-e25ee03f1d4b&spaceId=d105d145-04bc-45c5-b46c-ed880895e9de&expirationTimestamp=1760508000000&signature=ZPp8PVldfGOh0gB5tVElRV6GN789R-EG0oxZgkFjjLU&downloadName=poc.mp4

image image

Impact


Phishing/Social Engineering Attacks

Users can be exploited by immediately redirecting from a trusted domain to external malicious sites, taking advantage of user trust. This enables login page spoofing, credential harvesting, and redirection to malware distribution pages.

Authentication/Session Flow Disruption

When users with valid sessions/cookies from the same origin click the link, they are redirected to unintended external domains, which can bypass or disrupt authentication/authorization flows. When combined with redirect-based flows like OAuth/OIDC, this can escalate into security incidents.

Severity

Low

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
High
Privileges required
None
User interaction
Required
Scope
Unchanged
Confidentiality
None
Integrity
Low
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:L/A:N

CVE ID

CVE-2025-62379

Weaknesses

URL Redirection to Untrusted Site ('Open Redirect')

A web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a Redirect. This simplifies phishing attacks. Learn more on MITRE.

Credits