Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: GSA_kwCzR0hTQS1oeGdtLWdobXYteGpqbc4AA9oe

Directus incorrectly handles `_in` filter

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 .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.

Permalink: https://github.com/advisories/GHSA-hxgm-ghmv-xjjm
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1oeGdtLWdobXYteGpqbc4AA9oe
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Moderate
Classification: General
Published: 6 days ago
Updated: 6 days ago


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

Identifiers: GHSA-hxgm-ghmv-xjjm, CVE-2024-39701
References: Repository: https://github.com/directus/directus
Blast Radius: 13.0

Affected Packages

npm:directus
Dependent packages: 16
Dependent repositories: 115
Downloads: 50,920 last month
Affected Version Ranges: >= 9.23.0, <= 10.5.3
Fixed in: 10.6.0
All affected versions: 9.23.1, 9.23.3, 9.23.4, 9.24.0, 9.25.0, 9.25.1, 9.25.2, 9.26.0, 10.0.0, 10.1.0, 10.1.1, 10.2.0, 10.2.1, 10.3.0, 10.3.1, 10.4.1, 10.4.2, 10.4.3, 10.5.0, 10.5.1, 10.5.2, 10.5.3
All unaffected versions: 9.0.0, 9.0.1, 9.1.0, 9.1.1, 9.1.2, 9.2.0, 9.2.1, 9.2.2, 9.3.0, 9.4.0, 9.4.1, 9.4.2, 9.4.3, 9.5.0, 9.5.1, 9.5.2, 9.6.0, 9.7.0, 9.7.1, 9.8.0, 9.9.0, 9.9.1, 9.10.0, 9.11.0, 9.11.1, 9.12.0, 9.12.1, 9.12.2, 9.13.0, 9.14.0, 9.14.1, 9.14.2, 9.14.3, 9.14.5, 9.15.0, 9.15.1, 9.16.0, 9.16.1, 9.17.0, 9.17.1, 9.17.2, 9.17.3, 9.17.4, 9.18.0, 9.18.1, 9.19.0, 9.19.1, 9.19.2, 9.20.0, 9.20.1, 9.20.2, 9.20.3, 9.20.4, 9.21.0, 9.21.2, 9.22.0, 9.22.1, 9.22.3, 9.22.4, 10.6.0, 10.6.1, 10.6.2, 10.6.3, 10.6.4, 10.7.0, 10.7.1, 10.7.2, 10.8.0, 10.8.1, 10.8.2, 10.8.3, 10.9.0, 10.9.1, 10.9.2, 10.9.3, 10.10.0, 10.10.1, 10.10.2, 10.10.3, 10.10.4, 10.10.5, 10.10.6, 10.10.7, 10.11.0, 10.11.1, 10.11.2, 10.12.0, 10.12.1, 10.13.0, 10.13.1