CVE-2024-54151: Directus Directus Allows Unauthenticated Access To Vulnerability

HIGH
Advisory Identifier: GHSA-849r-qrwj-8rv4
CVSS 7.5
CWE-200
Published
Advisory Summary

CVE-2024-54151 is a HIGH (CVSS 7.5) directus allows unauthenticated access to vulnerability (CWE-200: Exposure of Sensitive Information to an Unauthorized Actor) affecting Directus libraries in the npm ecosystem. The issue involves directus allows unauthenticated access to websocket events and operations. Remediation is available by upgrading affected packages to version 11.3.0, 23.2.0.

CVE-2024-54151 at a Glance

CVE Identifier CVE-2024-54151
GHSA Identifier GHSA-849r-qrwj-8rv4
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-200: Exposure of Sensitive Information to an Unauthorized Actor
Affected Product Directus
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.5

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

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

How to Fix CVE-2024-54151

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

directus fixed: 11.3.0
npm install directus@11.3.0
@directus/api fixed: 23.2.0
npm install @directus/api@23.2.0
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 directus

How to Check if You Are Affected

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

npm ls directus

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

Note: The npm ls directus 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-200: Exposure of Sensitive Information to an Unauthorized Actor, where the product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. In Directus, 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

### Summary When setting `WEBSOCKETS_GRAPHQL_AUTH` or `WEBSOCKETS_REST_AUTH` to "public", an unauthenticated user is able to do any of the supported operations (CRUD, subscriptions) with full admin privileges. ### Details Accountability for unauthenticated WebSocket requests is set to null, which used to be "public permissions" until the Permissions Policy update which now defaults that to system/admin level access. So instead of null we need to make use of `createDefaultAccountability()` to ensure public permissions are used for unauthenticated users. ### PoC 1. Start directus with ```bash WEBSOCKETS_ENABLED=true WEBSOCKETS_GRAPHQL_AUTH=public WEBSOCKETS_REST_AUTH=public ``` 2. Subscribe using GQL or REST or do any CRUD operation on a user created collection (system tables are not reachable with crud) ```gql subscription { directus_users_mutated { key event data { id email first_name last_name password } } } ``` or ```json { "type": "items", "action": "read", "collection": "your_collection_name" } ``` 3a. Open up the data studio as any user. Observe how the subscriber gets notified on each page navigation (because the users `last_page` gets updated, the `password` fields is properly redacted here) 3b. Observe receiving all available items from the `your_collection_name` collection. ### Impact This impacts any Directus instance that has either `WEBSOCKETS_GRAPHQL_AUTH` or `WEBSOCKETS_REST_AUTH` set to `public` allowing unauthenticated users to subscribe for changes on any collection or do REST CRUD operations on user defined collections ignoring permissions.

CVE-2024-54151 Affected Directus Versions

2 component(s)
Fixed Versions:
11.3.023.2.0
Product / Package Ecosystem Affected Versions Fixed Version
directus
npm
≥ 11.0.0
< 11.3.0
11.3.0
@directus/api
npm
≥ 22.2.0
< 23.2.0
23.2.0

References

Frequently Asked Questions

What is CVE-2024-54151?
CVE-2024-54151 is a security vulnerability in Directus involving Directus allows unauthenticated access to WebSocket events and operations under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor.
Which Directus versions are affected?
Affected versions include releases prior to 11.3.0, 23.2.0 across affected packages: directus, @directus/api.
What version fixes CVE-2024-54151?
Upgrading to 11.3.0, 23.2.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is directus affected?
Yes, directus is affected in releases prior to 11.3.0. Upgrade your dependency to 11.3.0 or later.
Is @directus/api affected?
Yes, @directus/api is affected in releases prior to 23.2.0. Upgrade your dependency to 23.2.0 or later.
What is the CVSS score of CVE-2024-54151?
CVE-2024-54151 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2024-54151?
CVE-2024-54151 is classified under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor (The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.).
How can I check npm dependencies for CVE-2024-54151?
Run the dependency tree command: 'npm ls directus'. 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-849r-qrwj-8rv4",
  "modified" : "2024-12-09T21:54:13Z",
  "published" : "2024-12-09T20:40:54Z",
  "aliases" : [ "CVE-2024-54151" ],
  "summary" : "Directus allows unauthenticated access to WebSocket events and operations",
  "details" : "### Summary\nWhen setting `WEBSOCKETS_GRAPHQL_AUTH` or `WEBSOCKETS_REST_AUTH` to \"public\", an unauthenticated user is able to do any of the supported operations (CRUD, subscriptions) with full admin privileges.\n\n### Details\nAccountability for unauthenticated WebSocket requests is set to null, which used to be \"public permissions\" until the Permissions Policy update which now defaults that to system/admin level access. So instead of null we need to make use of `createDefaultAccountability()` to ensure public permissions are used for unauthenticated users.\n\n### PoC\n1. Start directus with\n```bash\nWEBSOCKETS_ENABLED=true\nWEBSOCKETS_GRAPHQL_AUTH=public\nWEBSOCKETS_REST_AUTH=public\n```\n\n2. Subscribe using GQL or REST or do any CRUD operation on a user created collection (system tables are not reachable with crud)\n```gql\nsubscription {\n    directus_users_mutated {\n        key\n        event\n        data {\n            id\n            email\n            first_name\n            last_name\n            password\n        }\n    }\n}\n```\nor\n```json\n{\n   \"type\": \"items\",\n   \"action\": \"read\",\n   \"collection\": \"your_collection_name\"\n}\n```\n3a. Open up the data studio as any user. Observe how the subscriber gets notified on each page navigation (because the users `last_page` gets updated, the `password` fields is properly redacted here)\n\n3b. Observe receiving all available items from the `your_collection_name` collection.\n\n### Impact\n\nThis impacts any Directus instance that has either `WEBSOCKETS_GRAPHQL_AUTH` or `WEBSOCKETS_REST_AUTH` set to `public` allowing unauthenticated users to subscribe for changes on any collection or do REST CRUD operations on user defined collections ignoring permissions.\n\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "directus"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "11.0.0"
      }, {
        "fixed" : "11.3.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@directus/api"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "22.2.0"
      }, {
        "fixed" : "23.2.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/directus/directus/security/advisories/GHSA-849r-qrwj-8rv4"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-54151"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/directus/directus/commit/ce0397d16cf767b5293cd57f626c5349b5732a21"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/directus/directus"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-200" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-12-09T20:40:54Z",
    "nvd_published_at" : "2024-12-09T21:15:08Z"
  }
}