Skip to main content
Vulnerability Database/CVE-2024-58398

CVE-2024-58398: Coder Open Redirect Vulnerability

CVE-2024-58398 is an open redirect flaw in Coder affecting versions 2.3.1 to 2.14.3, 2.15.0 to 2.15.2, and 2.16.0. Attackers exploit improper sanitization to redirect users to malicious sites for phishing attacks.

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-2024-58398 Overview

CVE-2024-58398 is an open redirect vulnerability [CWE-601] affecting Coder, a self-hosted platform for provisioning remote development environments. The flaw exists in the login page, where the redirect query parameter is improperly sanitized. Attackers can craft a malicious Coder login URL that, when clicked by an authenticated user, redirects the victim to an attacker-controlled website. The redirect leverages the trusted Coder domain to improve the credibility of phishing campaigns targeting developers and engineering teams.

Critical Impact

Attackers can abuse the trust of a legitimate Coder deployment to redirect authenticated users to phishing pages designed to harvest credentials or deliver malware.

Affected Products

  • Coder 2.3.1 before 2.14.4
  • Coder 2.15.x before 2.15.3
  • Coder 2.16.0 before 2.16.1

Discovery Timeline

  • 2026-10-17 - CVE-2024-58398 published to NVD
  • 2026-10-21 - Last updated in NVD database

Technical Details for CVE-2024-58398

Vulnerability Analysis

The vulnerability resides in the Coder web application's login flow, specifically in site/src/pages/LoginPage/LoginPage.tsx. The login page accepts a redirect query parameter that controls where the user is sent after successful authentication. The application fails to validate that the destination URL points to a trusted internal location.

An attacker constructs a URL such as https://coder.example.com/login?redirect=https://attacker.example/. When a user clicks the link and completes authentication, the application follows the attacker-supplied destination. Because the initial domain belongs to a legitimate Coder deployment, users are more likely to trust the redirect and submit credentials on the attacker-controlled page.

Root Cause

The root cause is missing validation of the redirectTo value before use. The pre-patch code passed the parameter directly from retrieveRedirect into navigation logic without confirming the destination was same-origin or restricted to an allowlisted path. CWE-601 (URL Redirection to Untrusted Site) applies.

Attack Vector

Exploitation requires user interaction. The attacker distributes a crafted login URL through email, chat, or forum posts. The target must click the link and authenticate, after which the browser is redirected to the attacker-controlled destination.

text
// Patch excerpt - site/src/pages/LoginPage/LoginPage.tsx
 const navigate = useNavigate();
 const { metadata } = useEmbeddedMetadata();
 const buildInfoQuery = useQuery(buildInfo(metadata["build-info"]));
+ let redirectError: Error | null = null;
+ let redirectUrl: URL | null = null;
+ try {
+   redirectUrl = new URL(redirectTo);
+ } catch {
+   // Do nothing
+ }
+
+ const isApiRouteRedirect = redirectTo.startsWith("/api/v2");

 useEffect(() => {
   if (!buildInfoQuery.data || isSignedIn) {
// Source: https://github.com/coder/coder/commit/69c1d981e3131e50d52b01f6a360abadaad699e6

The patch parses redirectTo as a URL object and introduces an isApiRouteRedirect check so only internal API paths or validated URLs are honored.

Detection Methods for CVE-2024-58398

Indicators of Compromise

  • Login requests to /login containing a redirect query parameter pointing to an external hostname not matching the Coder deployment domain.
  • HTTP referer logs showing authenticated sessions followed by navigation to unknown external domains immediately post-login.
  • User reports of unexpected redirects to credential prompts after accessing Coder links.

Detection Strategies

  • Inspect reverse proxy or load balancer access logs for /login?redirect= values with absolute URLs containing external schemes or hostnames.
  • Correlate authentication events in Coder audit logs with outbound DNS or proxy requests to newly observed domains.
  • Scan corporate email gateways for messages containing Coder login URLs with suspicious redirect parameter values.

Monitoring Recommendations

  • Alert on anomalous redirect parameter patterns on the Coder login endpoint, especially those encoding full URLs or using URL-encoded protocol handlers.
  • Monitor for phishing kits that spoof Coder's authentication UI by watching certificate transparency logs for lookalike domains.

How to Mitigate CVE-2024-58398

Immediate Actions Required

  • Upgrade Coder to a fixed release: 2.14.4, 2.15.3, 2.16.1, or later depending on your current branch.
  • Audit recent login traffic for suspicious redirect parameter values and notify affected users.
  • Rotate credentials for any users suspected of interacting with malicious login URLs.

Patch Information

The fix is delivered in commit 69c1d981e3131e50d52b01f6a360abadaad699e6, which parses redirectTo as a URL and restricts post-login navigation to internal paths or /api/v2 routes. Full details are available in the Coder GitHub Security Advisory GHSA-wcx9-ccpj-hx3c and the VulnCheck Advisory for Coder.

Workarounds

  • Deploy a web application firewall rule that strips or rejects redirect query parameters containing absolute URLs on /login requests.
  • Educate users on verifying the browser address bar after authenticating, particularly if a Coder link was received from an external source.
  • Restrict Coder access through SSO flows and conditional access policies that limit exposure to unauthenticated phishing lures.
bash
# Example nginx rule to strip external redirect targets on login
location = /login {
    if ($arg_redirect ~* "^https?://") {
        return 302 /login;
    }
    proxy_pass http://coder_backend;
}

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.