Skip to content

Open Redirect in IdentityServer

Moderate
josephdecock published GHSA-ff4q-64jc-gx98 Jul 31, 2024

Package

nuget Duende.IdentityServer (NuGet)

Affected versions

<= 7.0.5
<= 6.3.9
<= 6.2.4
<= 6.1.7
<= 6.0.4

Patched versions

7.0.6
6.3.10
6.2.5
6.1.8
6.0.5
nuget IdentityServer4 (NuGet)
<= 4.1.2
None

Description

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.

Severity

Moderate

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
Low
Privileges required
None
User interaction
Required
Scope
Changed
Confidentiality
Low
Integrity
None
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:L/PR:N/UI:R/S:C/C:L/I:N/A:N

CVE ID

CVE-2024-39694

Weaknesses