CVE-2024-22206: @clerk/nextjs @clerk/nextjs Auth() And GetAuth() Methods Vulnerability

CRITICAL
Advisory Identifier: GHSA-q6w5-jg5q-47vg
CVSS 9.0
CWE-284 CWE-639 CWE-287
Published
Advisory Summary

CVE-2024-22206 is a CRITICAL (CVSS 9.0) @clerk/nextjs auth() and getauth() methods vulnerability (CWE-284: Improper Access Control) affecting @clerk/nextjs libraries in the npm ecosystem. The issue involves @clerk/nextjs auth() and getauth() methods vulnerable to insecure direct object reference (idor). Remediation is available by upgrading affected packages to version 4.29.3.

CVE-2024-22206 at a Glance

CVE Identifier CVE-2024-22206
GHSA Identifier GHSA-q6w5-jg5q-47vg
Severity CRITICAL
CVSS v3.1 Base Score 9.0
CWE Classification CWE-284: Improper Access Control
Affected Product @clerk/nextjs
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 9.0

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

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

How to Fix CVE-2024-22206

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

@clerk/nextjs fixed: 4.29.3
npm install @clerk/nextjs@4.29.3
Verify Direct and Transitive Dependencies

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

npm ls @clerk/nextjs

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2024-22206, inspect your project dependencies using npm:

npm ls @clerk/nextjs

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

Note: The npm ls @clerk/nextjs command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-284: Improper Access Control, where the product does not restrict or incorrectly restricts access to a resource from an unauthorized actor. In @clerk/nextjs, 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 Unauthorized access or privilege escalation due to a logic flaw in `auth()` in the App Router or `getAuth()` in the Pages Router. ### Affected Versions All applications that that use `@clerk/nextjs` versions in the range of `>= 4.7.0`,`< 4.29.3` in a Next.js backend to authenticate API Routes, App Router, or Route handlers. Specifically, those that call `auth()` in the App Router or `getAuth()` in the Pages Router. Only the `@clerk/nextjs` SDK is impacted. Other SDKs, including other Javascript-based SDKs, are not impacted. ### Patches Fix included in `@clerk/nextjs@4.29.3`. ### References - https://clerk.com/changelog/2024-01-12 - https://github.com/clerk/javascript/releases/tag/%40clerk%2Fnextjs%404.29.3

CVE-2024-22206 Affected @clerk/nextjs Versions

1 component(s)
Fixed Versions:
4.29.3
Product / Package Ecosystem Affected Versions Fixed Version
@clerk/nextjs
npm
≥ 4.7.0
< 4.29.3
4.29.3

References

Frequently Asked Questions

What is CVE-2024-22206?
CVE-2024-22206 is a security vulnerability in @clerk/nextjs involving @clerk/nextjs auth() and getAuth() methods vulnerable to insecure direct object reference (IDOR) under CWE-284: Improper Access Control.
Which @clerk/nextjs versions are affected?
Affected versions include releases prior to 4.29.3 across affected packages: @clerk/nextjs.
What version fixes CVE-2024-22206?
Upgrading to 4.29.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @clerk/nextjs affected?
Yes, @clerk/nextjs is affected in releases prior to 4.29.3. Upgrade your dependency to 4.29.3 or later.
What is the CVSS score of CVE-2024-22206?
CVE-2024-22206 has a CVSS v3.1 base score of 9.0 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H.
What CWE is associated with CVE-2024-22206?
CVE-2024-22206 is classified under CWE-284: Improper Access Control (The product does not restrict or incorrectly restricts access to a resource from an unauthorized actor.).
How can I check npm dependencies for CVE-2024-22206?
Run the dependency tree command: 'npm ls @clerk/nextjs'. 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-q6w5-jg5q-47vg",
  "modified" : "2024-01-12T22:33:02Z",
  "published" : "2024-01-12T20:27:29Z",
  "aliases" : [ "CVE-2024-22206" ],
  "summary" : "@clerk/nextjs auth() and getAuth() methods vulnerable to insecure direct object reference (IDOR) ",
  "details" : "### Impact\nUnauthorized access or privilege escalation due to a logic flaw in `auth()` in the App Router or `getAuth()` in the Pages Router.\n\n### Affected Versions\nAll applications that that use `@clerk/nextjs` versions in the range of `>= 4.7.0`,`< 4.29.3` in a Next.js backend to authenticate API Routes, App Router, or Route handlers. Specifically, those that call `auth()` in the App Router or `getAuth()` in the Pages Router. Only the `@clerk/nextjs` SDK is impacted. Other SDKs, including other Javascript-based SDKs, are not impacted.\n\n### Patches\nFix included in `@clerk/nextjs@4.29.3`.\n\n### References\n- https://clerk.com/changelog/2024-01-12\n- https://github.com/clerk/javascript/releases/tag/%40clerk%2Fnextjs%404.29.3",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@clerk/nextjs"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.7.0"
      }, {
        "fixed" : "4.29.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/clerk/javascript/security/advisories/GHSA-q6w5-jg5q-47vg"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-22206"
  }, {
    "type" : "WEB",
    "url" : "https://clerk.com/changelog/2024-01-12"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/clerk/javascript"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/clerk/javascript/releases/tag/%40clerk%2Fnextjs%404.29.3"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-284", "CWE-287", "CWE-639" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-01-12T20:27:29Z",
    "nvd_published_at" : "2024-01-12T20:15:47Z"
  }
}