CVE-2024-39701: Directus Directus Incorrectly Handles `_in` Filter Vulnerability

HIGH
Advisory Identifier: GHSA-hxgm-ghmv-xjjm
CVSS 6.3
CWE-284
Published
Advisory Summary

CVE-2024-39701 is a HIGH (CVSS 6.3) directus incorrectly handles `_in` filter vulnerability (CWE-284: Improper Access Control) affecting Directus libraries in the npm ecosystem. The issue involves directus incorrectly handles `_in` filter. Remediation is available by upgrading affected packages to version 10.6.0.

CVE-2024-39701 at a Glance

CVE Identifier CVE-2024-39701
GHSA Identifier GHSA-hxgm-ghmv-xjjm
Severity HIGH
CVSS v3.1 Base Score 6.3
CWE Classification CWE-284: Improper Access Control
Affected Product Directus
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 6.3

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

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

How to Fix CVE-2024-39701

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: 10.6.0
npm install directus@10.6.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-39701, 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 10.6.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-284: Improper Access Control, where the product does not restrict or incorrectly restricts access to a resource from an unauthorized actor. 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 Directus >=9.23.0, <=v10.5.3 improperly handles _in, _nin operators. It evaluates empty arrays as valid so expressions like {"role": {"_in": $CURRENT_USER.some_field}} would evaluate to true allowing the request to pass. ### Details This results in Broken Access Control because the rule fails to do what it was intended to do: Pass rule if **field** matches any of the **values**. ref: https://docs.directus.io/reference/filter-rules.html#filter-operators In my example this would translate to "Pass rule if **<collection>.role** matches any of **[]**". Which should fail. This instead passes in Directus <= v10.5.3, >=v9.23.0 ### PoC {"role": {"_in": $CURRENT_USER.some_field}} field validation would pass if $CURRENT_USER.some_field is null. Real scenario: Using https://github.com/u12206050/directus-extension-role-chooser with the specified versions of Directus (I tested on 10.0.0) allows users with access to this feature set their role to whatever role if they don't have any roles assigned (user_roles.role is left with the default value, null) despite the validation rule being ```yaml validation: role: _in: $CURRENT_USER.user_roles.role ``` Latest version of Directus (v10.8.3 and above) handles the above validation rule correctly. ### Impact Permissions fail to open for setups relying on this filter and can lead to users getting access to things they're not supposed to.

CVE-2024-39701 Affected Directus Versions

1 component(s)
Fixed Versions:
10.6.0
Product / Package Ecosystem Affected Versions Fixed Version
directus
npm
≥ 9.23.0
< 10.6.0
10.6.0

References

Frequently Asked Questions

What is CVE-2024-39701?
CVE-2024-39701 is a security vulnerability in Directus involving Directus incorrectly handles `_in` filter under CWE-284: Improper Access Control.
Which Directus versions are affected?
Affected versions include releases prior to 10.6.0 across affected packages: directus.
What version fixes CVE-2024-39701?
Upgrading to 10.6.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is directus affected?
Yes, directus is affected in releases prior to 10.6.0. Upgrade your dependency to 10.6.0 or later.
What is the CVSS score of CVE-2024-39701?
CVE-2024-39701 has a CVSS v3.1 base score of 6.3 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:N/A:N.
What CWE is associated with CVE-2024-39701?
CVE-2024-39701 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-39701?
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-hxgm-ghmv-xjjm",
  "modified" : "2025-09-04T15:32:20Z",
  "published" : "2024-07-08T18:37:54Z",
  "aliases" : [ "CVE-2024-39701" ],
  "summary" : "Directus incorrectly handles `_in` filter",
  "details" : "### Summary\nDirectus >=9.23.0, <=v10.5.3 improperly handles _in, _nin operators.\nIt evaluates empty arrays as valid so expressions like {\"role\": {\"_in\": $CURRENT_USER.some_field}} would evaluate to true allowing the request to pass.\n\n### Details\nThis results in Broken Access Control because the rule fails to do what it was intended to do: Pass rule if **field** matches any of the **values**. ref: https://docs.directus.io/reference/filter-rules.html#filter-operators\nIn my example this would translate to \"Pass rule if **<collection>.role** matches any of **[]**\". Which should fail. This instead passes in Directus <= v10.5.3, >=v9.23.0\n\n### PoC\n{\"role\": {\"_in\": $CURRENT_USER.some_field}} field validation would pass if $CURRENT_USER.some_field is null.\n\nReal scenario: Using https://github.com/u12206050/directus-extension-role-chooser with the specified versions of Directus (I tested on 10.0.0) allows users with access to this feature set their role to whatever role if they don't have any roles assigned (user_roles.role is left with the default value, null) despite the validation rule being \n```yaml\nvalidation:\n    role:\n      _in: $CURRENT_USER.user_roles.role\n```\nLatest version of Directus (v10.8.3 and above) handles the above validation rule correctly.\n\n### Impact\nPermissions fail to open for setups relying on this filter and can lead to users getting access to things they're not supposed to.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:N/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:H/AT:N/PR:L/UI:N/VC:H/VI:N/VA:N/SC:H/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "directus"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "9.23.0"
      }, {
        "fixed" : "10.6.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 10.5.3"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/directus/directus/security/advisories/GHSA-hxgm-ghmv-xjjm"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-39701"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/directus/directus"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-284" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-07-08T18:37:54Z",
    "nvd_published_at" : "2024-07-08T17:15:11Z"
  }
}