# CVE-2024-39694: Duende IdentityServer Open Redirect vulnerability

> Attackers can craft malicious URLs to redirect users to untrusted sites, facilitating phishing attacks against IdentityServer users.

- **Severity:** Medium 4.7 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:N/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 31 Jul 2024
- **Updated:** 31 Jul 2024
- **Also known as:** GHSA-ff4q-64jc-gx98

## What is CVE-2024-39694?

CVE-2024-39694 is a medium-severity vulnerability in DuendeSoftware IdentityServer, published on 31 Jul 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

Duende IdentityServer is an OpenID Connect and OAuth 2.x framework for ASP.NET Core. 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. This vulnerability is fixed in 7.0.6, 6.3.10, 6.2.5, 6.1.8, and 6.0.5. Duende.IdentityServer 5.1 and earlier and all versions of IdentityServer4 are no longer supported and will not be receiving updates. If upgrading is not possible, use `IUrlHelper.IsLocalUrl` from ASP.NET Core to validate return Urls in user interface code in the IdentityServer host.

Weakness: CWE-601 (URL Redirection to Untrusted Site)

## Which versions are affected by CVE-2024-39694?

12 open source packages ship an affected version, including Duende.IdentityServer and IdentityServer4.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `Duende.IdentityServer` | NuGet | From 6.0.0-preview.1 | 6.0.5 |
| `Duende.IdentityServer` | NuGet | From 6.0.0-preview.1 | 6.0.5 |
| `Duende.IdentityServer` | NuGet | From 6.1.0-preview.1 | 6.1.8 |
| `Duende.IdentityServer` | NuGet | From 6.1.0-preview.1 | 6.1.8 |
| `Duende.IdentityServer` | NuGet | From 6.2.0-preview.1 | 6.2.5 |
| `Duende.IdentityServer` | NuGet | From 6.2.0-preview.1 | 6.2.5 |
| `Duende.IdentityServer` | NuGet | From 6.3.0-preview.1 | 6.3.10 |
| `Duende.IdentityServer` | NuGet | From 6.3.0-preview.1 | 6.3.10 |
| `Duende.IdentityServer` | NuGet | From 7.0.0-preview.1 | 7.0.6 |
| `Duende.IdentityServer` | NuGet | From 7.0.0-preview.1 | 7.0.6 |
| `IdentityServer4` | NuGet | All versions to 4.1.2 | None |
| `IdentityServer4` | NuGet | All versions to 4.1.2 | None |

## How do I fix CVE-2024-39694?

Upgrade Duende.IdentityServer to a fixed version for your release line: 6.0.5, 6.1.8, 6.2.5 or 6.3.10.

## Is CVE-2024-39694 being exploited?

There is no known exploitation of CVE-2024-39694 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-39694 and fix it if it is affected.

What it is: CVE-2024-39694 is a medium-severity vulnerability in DuendeSoftware IdentityServer, published on 31 Jul 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2024-39694 in the wild and no public exploit code.

Affected packages and fixed versions:
- Duende.IdentityServer (NuGet): affected from 6.0.0-preview.1; fixed in 6.0.5
- Duende.IdentityServer (NuGet): affected from 6.0.0-preview.1; fixed in 6.0.5
- Duende.IdentityServer (NuGet): affected from 6.1.0-preview.1; fixed in 6.1.8
- Duende.IdentityServer (NuGet): affected from 6.1.0-preview.1; fixed in 6.1.8
- Duende.IdentityServer (NuGet): affected from 6.2.0-preview.1; fixed in 6.2.5
- Duende.IdentityServer (NuGet): affected from 6.2.0-preview.1; fixed in 6.2.5
- Duende.IdentityServer (NuGet): affected from 6.3.0-preview.1; fixed in 6.3.10
- Duende.IdentityServer (NuGet): affected from 6.3.0-preview.1; fixed in 6.3.10
- Duende.IdentityServer (NuGet): affected from 7.0.0-preview.1; fixed in 7.0.6
- Duende.IdentityServer (NuGet): affected from 7.0.0-preview.1; fixed in 7.0.6
- IdentityServer4 (NuGet): affected all versions up to 4.1.2; no fix listed
- IdentityServer4 (NuGet): affected all versions up to 4.1.2; no fix listed

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-39694/ (Markdown: https://insights.sbomify.com/CVE-2024-39694/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-39694
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-39694
- OSV: https://osv.dev/vulnerability/CVE-2024-39694

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-39694/
Summaries are generated and may contain mistakes; the official description above is the record.
