CVE-2024-51987: Duende.AccessTokenManagement.OpenIdConnect HTTP Client Uses Incorrect Token Vulnerability

MODERATE
Advisory Identifier: GHSA-7mr7-4f54-vcx5
CVSS 5.4
CWE-270
Published
Advisory Summary

CVE-2024-51987 is a MODERATE (CVSS 5.4) http client uses incorrect token vulnerability (CWE-270: Privilege Context Switching Error) affecting Duende.AccessTokenManagement.OpenIdConnect libraries in the NuGet ecosystem. The issue involves http client uses incorrect token after refresh. Remediation is available by upgrading affected packages to version 3.0.1.

CVE-2024-51987 at a Glance

CVE Identifier CVE-2024-51987
GHSA Identifier GHSA-7mr7-4f54-vcx5
Severity MODERATE
CVSS v3.1 Base Score 5.4
CWE Classification CWE-270: Privilege Context Switching Error
Affected Product Duende.AccessTokenManagement.OpenIdConnect
Package Ecosystem NuGet
Published Date
Last Updated

Security Impact

CVSS: 5.4

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:U/C:L/I:L/A:N).

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

How to Fix CVE-2024-51987

To remediate this vulnerability, upgrade all affected Duende.AccessTokenManagement.OpenIdConnect 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.AccessTokenManagement.OpenIdConnect fixed: 3.0.1
Upgrade Duende.AccessTokenManagement.OpenIdConnect to 3.0.1
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.AccessTokenManagement.OpenIdConnect

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-51987, inspect your project dependencies for Duende.AccessTokenManagement.OpenIdConnect:

inspect dependencies for Duende.AccessTokenManagement.OpenIdConnect

Analyze the terminal output to locate any version of Duende.AccessTokenManagement.OpenIdConnect in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.0.1), 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-270: Privilege Context Switching Error, where the product does not properly manage privileges while it is switching between different contexts that have different privileges or spheres of control. In Duende.AccessTokenManagement.OpenIdConnect, 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 HTTP Clients created by `AddUserAccessTokenHttpClient` may use a different user's access token after a token refresh. This occurs because a refreshed token will be captured in pooled `HttpClient` instances, which may be used by a different user. ### Workarounds Instead of using `AddUserAccessTokenHttpClient` to create an `HttpClient` that automatically adds a managed token to outgoing requests, you can use the `HttpConext.GetUserAccessTokenAsync` extension method or the `IUserTokenManagementService.GetAccessTokenAsync` method. ### Patches This issue is fixed in Duende.AccessTokenManagement.OpenIdConnect 3.0.1.

CVE-2024-51987 Affected Duende.AccessTokenManagement.OpenIdConnect Versions

1 component(s)
Fixed Versions:
3.0.1
Product / Package Ecosystem Affected Versions Fixed Version
Duende.AccessTokenManagement.OpenIdConnect
NuGet
≥ 3.0.0
< 3.0.1
All 1 versions
3.0.0
3.0.1

References

Frequently Asked Questions

What is CVE-2024-51987?
CVE-2024-51987 is a security vulnerability in Duende.AccessTokenManagement.OpenIdConnect involving HTTP Client uses incorrect token after refresh under CWE-270: Privilege Context Switching Error.
Which Duende.AccessTokenManagement.OpenIdConnect versions are affected?
Affected versions include releases prior to 3.0.1 across affected packages: Duende.AccessTokenManagement.OpenIdConnect.
What version fixes CVE-2024-51987?
Upgrading to 3.0.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is Duende.AccessTokenManagement.OpenIdConnect affected?
Yes, Duende.AccessTokenManagement.OpenIdConnect is affected in releases prior to 3.0.1. Upgrade your dependency to 3.0.1 or later.
What is the CVSS score of CVE-2024-51987?
CVE-2024-51987 has a CVSS v3.1 base score of 5.4 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N.
What CWE is associated with CVE-2024-51987?
CVE-2024-51987 is classified under CWE-270: Privilege Context Switching Error (The product does not properly manage privileges while it is switching between different contexts that have different privileges or spheres of control.).
How can I check NuGet dependencies for CVE-2024-51987?
Run the dependency tree command: 'inspect dependencies for Duende.AccessTokenManagement.OpenIdConnect'. 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-7mr7-4f54-vcx5",
  "modified" : "2024-11-08T13:55:27Z",
  "published" : "2024-11-07T21:57:52Z",
  "aliases" : [ "CVE-2024-51987" ],
  "summary" : "HTTP Client uses incorrect token after refresh",
  "details" : "### Impact\nHTTP Clients created by `AddUserAccessTokenHttpClient` may use a different user's access token after a token refresh. This occurs because a refreshed token will be captured in pooled `HttpClient` instances, which may be used by a different user.\n\n### Workarounds\nInstead of using `AddUserAccessTokenHttpClient` to create an `HttpClient` that automatically adds a managed token to outgoing requests, you can use the `HttpConext.GetUserAccessTokenAsync` extension method or the `IUserTokenManagementService.GetAccessTokenAsync` method.\n\n### Patches\nThis issue is fixed in Duende.AccessTokenManagement.OpenIdConnect 3.0.1.\n\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "NuGet",
      "name" : "Duende.AccessTokenManagement.OpenIdConnect"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "3.0.1"
      } ]
    } ],
    "versions" : [ "3.0.0" ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/DuendeSoftware/Duende.AccessTokenManagement/security/advisories/GHSA-7mr7-4f54-vcx5"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-51987"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/DuendeSoftware/Duende.AccessTokenManagement/commit/09c73e32b182da5c6d7b55ec790cb2271cc4b63f"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/DuendeSoftware/Duende.AccessTokenManagement"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/DuendeSoftware/Duende.AccessTokenManagement/releases/tag/3.0.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-270" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-11-07T21:57:52Z",
    "nvd_published_at" : "2024-11-08T00:15:15Z"
  }
}