Skip to content

GHSA-hxgm-ghmv-xjjm CVE-2024-39701

Directus incorrectly handles `_in` filter

High npm
Severity
0.0 / 10
High · CVSS 4.0
Exploit chance (EPSS)
0.42%
Chance of exploitation in the next 30 days. Higher than 36.68% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-284 Improper Access Control
Fix
10.6.0
Upgrade directus to this version or later

Description

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

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.

Affected versions

npm

PackageVulnerableFixed in
directus
>= 9.23.0, < 10.6.0
10.6.0

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

directus npm → 10.6.0

npm
npm install directus@10.6.0
yarn
yarn add directus@10.6.0
pnpm
pnpm add directus@10.6.0

Severity breakdown

CVSS 4.0 0.0

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

Attack vector
Network
Attack complexity
High
Attack requirements
None
Privileges required
Low
User interaction
None
Confidentiality (vulnerable system)
High
Integrity (vulnerable system)
None
Availability (vulnerable system)
None
Confidentiality (subsequent systems)
High
Integrity (subsequent systems)
None
Availability (subsequent systems)
None

CVSS 3.1 6.3

CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:N/A:N

Attack vector
Network
Attack complexity
High
Privileges required
Low
User interaction
None
Scope
Changed
Confidentiality
High
Integrity
None
Availability
None

Weakness

CWE-284: Improper Access Control

The product does not restrict or incorrectly restricts access to a resource from an unauthorized actor.

How to prevent it
  • Architecture and Design, Operation: Very carefully manage the setting, management, and handling of privileges. Explicitly manage trust zones in the software.
  • Architecture and Design: Compartmentalize the system to have "safe" areas where trust boundaries can be unambiguously drawn. Do not allow sensitive data to go outside of the trust boundary and always be careful when interfacing with a compartment outside of the safe area. Ensure that appropriate compartmentalization is built into the system design, and the compartmentalization allows for and reinforces privilege separation functionality. Architects and designers should rely on the principle of least privilege to decide the appropriate time to use privileges and the time to drop privileges.

References

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-c6w9-5g5j-jh2p
Directus: Authorization-dependent response served from unsegmented cache key
High Also affects directus
GHSA-j5h6-vqc3-phqh
Directus: SSRF Protection Bypass via 0.0.0.0 in File Import
High Also affects directus
GHSA-38hg-ww64-rrwc
Directus: Authenticated Users Can Extract Concealed Fields via Aggregate Queries
High Also affects directus
GHSA-6q22-g298-grjh
Directus: Unauthenticated Denial of Service via GraphQL Alias Amplification of Expensive Health Check Resolver
High Also affects directus
GHSA-ph52-67fq-75wj
Directus: GraphQL Alias Amplification Denial of Service Due to Missing Query Cost/Complexity Limits
Medium Also affects directus
GHSA-mvv8-v4jj-g47j
Directus: Sensitive fields exposed in revision history
Medium Also affects directus
GHSA-qqmv-5p3g-px89
Directus: TUS Upload Authorization Bypass Allows Arbitrary File Overwrite
High Also affects directus
GHSA-wv3h-5fx7-966h
Directus: SSRF Protection Bypass via IPv4-Mapped IPv6 Addresses in File Import
High Also affects directus
Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor