CVE-2024-39694: Duende.IdentityServer IdentityServer Open Redirect Vulnerability Vulnerability

MODERATE
Advisory Identifier: GHSA-ff4q-64jc-gx98
CVSS 4.7
CWE-601
Published
Advisory Summary

CVE-2024-39694 is a MODERATE (CVSS 4.7) identityserver open redirect vulnerability vulnerability (CWE-601: URL Redirection to Untrusted Site ('Open Redirect')) affecting Duende.IdentityServer libraries in the NuGet ecosystem. The issue involves identityserver open redirect vulnerability. Remediation is available by upgrading affected packages to version 7.0.6, 6.3.10, 6.2.5, 6.1.8, 6.0.5.

CVE-2024-39694 at a Glance

CVE Identifier CVE-2024-39694
GHSA Identifier GHSA-ff4q-64jc-gx98
Severity MODERATE
CVSS v3.1 Base Score 4.7
CWE Classification CWE-601: URL Redirection to Untrusted Site ('Open Redirect')
Affected Product Duende.IdentityServer
Package Ecosystem NuGet
Published Date
Last Updated

Security Impact

CVSS: 4.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2024-39694

To remediate this vulnerability, upgrade all affected Duende.IdentityServer dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

Duende.IdentityServer fixed: 7.0.6
Upgrade Duende.IdentityServer to 7.0.6
Duende.IdentityServer fixed: 6.3.10
Upgrade Duende.IdentityServer to 6.3.10
Duende.IdentityServer fixed: 6.2.5
Upgrade Duende.IdentityServer to 6.2.5
Duende.IdentityServer fixed: 6.1.8
Upgrade Duende.IdentityServer to 6.1.8
Duende.IdentityServer fixed: 6.0.5
Upgrade Duende.IdentityServer to 6.0.5
IdentityServer4 fixed: Latest secure release
Upgrade IdentityServer4 to Latest secure release
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for Duende.IdentityServer

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-39694, inspect your project dependencies for Duende.IdentityServer:

inspect dependencies for Duende.IdentityServer

Analyze the terminal output to locate any version of Duende.IdentityServer in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 7.0.6), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-601: URL Redirection to Untrusted Site ('Open Redirect'), where the web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a redirect. In Duende.IdentityServer, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact It is possible for an attacker to craft malicious Urls that certain functions in IdentityServer will incorrectly treat as local and trusted. If such a Url is returned as a redirect, some browsers will follow it to a third-party, untrusted site. _Note: by itself, this vulnerability does **not** allow an attacker to obtain user credentials, authorization codes, access tokens, refresh tokens, or identity tokens. An attacker could however exploit this vulnerability as part of a phishing attack designed to steal user credentials._ ### Affected Methods - In the `DefaultIdentityServerInteractionService`, the `GetAuthorizationContextAsync` method may return non-null and the `IsValidReturnUrl` method may return true for malicious Urls, indicating incorrectly that they can be safely redirected to. _UI code calling these two methods is the most commonly used code path that will expose the vulnerability. The default UI templates rely on this behavior in the Login, Challenge, Consent, and Account Creation pages. Customized user interface code might also rely on this behavior. The following uncommonly used APIs are also vulnerable:_ - The `ServerUrlExtensions.GetIdentityServerRelativeUrl`, `ReturnUrlParser.ParseAsync` and `OidcReturnUrlParser.ParseAsync` methods may incorrectly return non-null, and the `ReturnUrlParser.IsValidReturnUrl` and `OidcReturnUrlParser.IsValidReturnUrl` methods may incorrectly return true for malicious Urls. ### Patches This vulnerability is fixed in the following versions of Duende.IdentityServer: - 7.0.6 - 6.3.10 - 6.2.5 - 6.1.8 - 6.0.5 Duende.IdentityServer 5.1 and earlier and all versions of IdentityServer4 are no longer supported and will not be receiving updates. ### Workarounds If upgrading is not possible, use `IUrlHelper.IsLocalUrl` from ASP.NET Core 5.0 or later to validate return Urls in user interface code in the IdentityServer host.

CVE-2024-39694 Affected Duende.IdentityServer Versions

6 component(s)
Fixed Versions:
7.0.66.3.106.2.56.1.86.0.5
Product / Package Ecosystem Affected Versions Fixed Version
Duende.IdentityServer
NuGet
≥ 7.0.0-preview.1
< 7.0.6
7.0.6
Duende.IdentityServer
NuGet
≥ 6.3.0-preview.1
< 6.3.10
6.3.10
Duende.IdentityServer
NuGet
≥ 6.2.0-preview.1
< 6.2.5
6.2.5
Duende.IdentityServer
NuGet
≥ 6.1.0-preview.1
< 6.1.8
6.1.8
Duende.IdentityServer
NuGet
≥ 6.0.0-preview.1
< 6.0.5
6.0.5
IdentityServer4
NuGet
≤ 4.1.2

References

Frequently Asked Questions

What is CVE-2024-39694?
CVE-2024-39694 is a security vulnerability in Duende.IdentityServer involving IdentityServer Open Redirect vulnerability under CWE-601: URL Redirection to Untrusted Site ('Open Redirect').
Which Duende.IdentityServer versions are affected?
Affected versions include releases prior to 7.0.6, 6.3.10, 6.2.5, 6.1.8, 6.0.5 across affected packages: Duende.IdentityServer, IdentityServer4.
What version fixes CVE-2024-39694?
Upgrading to 7.0.6, 6.3.10, 6.2.5, 6.1.8, 6.0.5 (or the latest patched release for your respective branch) resolves the vulnerability.
Is Duende.IdentityServer affected?
Yes, Duende.IdentityServer is affected in releases prior to 7.0.6, 6.3.10, 6.2.5, 6.1.8, 6.0.5. Upgrade your dependency to 7.0.6, 6.3.10, 6.2.5, 6.1.8, 6.0.5 or later.
Is IdentityServer4 affected?
Yes, IdentityServer4 is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2024-39694?
CVE-2024-39694 has a CVSS v3.1 base score of 4.7 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:N/A:N.
What CWE is associated with CVE-2024-39694?
CVE-2024-39694 is classified under CWE-601: URL Redirection to Untrusted Site ('Open Redirect') (The web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a redirect.).
How can I check NuGet dependencies for CVE-2024-39694?
Run the dependency tree command: 'inspect dependencies for Duende.IdentityServer'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-ff4q-64jc-gx98",
  "modified" : "2024-07-31T19:57:30Z",
  "published" : "2024-07-31T15:28:54Z",
  "aliases" : [ "CVE-2024-39694" ],
  "summary" : "IdentityServer Open Redirect vulnerability",
  "details" : "### Impact\nIt is possible for an attacker to craft malicious Urls that certain functions in IdentityServer will incorrectly treat as local and trusted. If such a Url is returned as a redirect, some browsers will follow it to a third-party, untrusted site.\n\n_Note: by itself, this vulnerability does **not** allow an attacker to obtain user credentials, authorization codes, access tokens, refresh tokens, or identity tokens. An attacker could however exploit this vulnerability as part of a phishing attack designed to steal user credentials._\n\n### Affected Methods\n- In the `DefaultIdentityServerInteractionService`, the `GetAuthorizationContextAsync` method may return non-null and the `IsValidReturnUrl` method may return true for malicious Urls, indicating incorrectly that they can be safely redirected to.\n\n   _UI code calling these two methods is the most commonly used code path that will expose the vulnerability. The default UI templates rely on this behavior in the Login, Challenge, Consent, and Account Creation pages. Customized user interface code might also rely on this behavior. The following uncommonly used APIs are also vulnerable:_\n\n- The `ServerUrlExtensions.GetIdentityServerRelativeUrl`, `ReturnUrlParser.ParseAsync` and `OidcReturnUrlParser.ParseAsync`  methods may incorrectly return non-null, and the `ReturnUrlParser.IsValidReturnUrl` and `OidcReturnUrlParser.IsValidReturnUrl` methods may incorrectly return true for malicious Urls.\n\n### Patches\nThis vulnerability is fixed in the following versions of Duende.IdentityServer:\n- 7.0.6\n- 6.3.10\n- 6.2.5\n- 6.1.8\n- 6.0.5\n\nDuende.IdentityServer 5.1 and earlier and all versions of IdentityServer4 are no longer supported and will not be receiving updates. \n\n### Workarounds\n\nIf upgrading is not possible, use `IUrlHelper.IsLocalUrl` from ASP.NET Core 5.0 or later to validate return Urls in user interface code in the IdentityServer host. ",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:N/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:L/VI:N/VA:N/SC:L/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "NuGet",
      "name" : "Duende.IdentityServer"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "7.0.0-preview.1"
      }, {
        "fixed" : "7.0.6"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 7.0.5"
    }
  }, {
    "package" : {
      "ecosystem" : "NuGet",
      "name" : "Duende.IdentityServer"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.3.0-preview.1"
      }, {
        "fixed" : "6.3.10"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 6.3.9"
    }
  }, {
    "package" : {
      "ecosystem" : "NuGet",
      "name" : "Duende.IdentityServer"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.2.0-preview.1"
      }, {
        "fixed" : "6.2.5"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 6.2.4"
    }
  }, {
    "package" : {
      "ecosystem" : "NuGet",
      "name" : "Duende.IdentityServer"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.1.0-preview.1"
      }, {
        "fixed" : "6.1.8"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 6.1.7"
    }
  }, {
    "package" : {
      "ecosystem" : "NuGet",
      "name" : "Duende.IdentityServer"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.0.0-preview.1"
      }, {
        "fixed" : "6.0.5"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 6.0.4"
    }
  }, {
    "package" : {
      "ecosystem" : "NuGet",
      "name" : "IdentityServer4"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "4.1.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/DuendeSoftware/IdentityServer/security/advisories/GHSA-ff4q-64jc-gx98"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/IdentityServer/IdentityServer4/security/advisories/GHSA-55p7-v223-x366"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-39694"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/DuendeSoftware/IdentityServer/commit/269ca2171fe1e901c87f2f0797bbc7c230db87c6"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/DuendeSoftware/IdentityServer/commit/765116a2d4fb0671b6eba015e698533900c61c8e"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/DuendeSoftware/IdentityServer/commit/d0d8eab35ad9183b14925496803ed8b36658d0a1"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/DuendeSoftware/IdentityServer/commit/f04cf0be859b93f43563f8f812eb92206ad94011"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/DuendeSoftware/IdentityServer/commit/fe817b499933d6ed6141b153492d7335c28b184a"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/DuendeSoftware/IdentityServer"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-601" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-07-31T15:28:54Z",
    "nvd_published_at" : "2024-07-31T16:15:04Z"
  }
}