Summary
Directus exposed raw values of concealed fields when aggregate functions such as min and max were used, returning sensitive data instead of the expected masked placeholders.
When combined with groupBy, any authenticated user with read access to an affected collection could derive hidden secrets like static API tokens and two-factor authentication seeds from directus_users.
Affected context
The issue appears in Directus instances where:
- The conceal special type is used to mask sensitive columns (e.g., API tokens, 2FA secrets).
- Users can query collections through the Directus API or app with read permissions.
- Aggregate functions (
min,max) and optionalgroupByoperations are available on concealed fields.
In these conditions, the aggregation pipeline may bypass the masking layer and leak database-native values instead of placeholders, even though the UI suggests the data is protected.
Exploit preconditions
- Attack surface: Directus HTTP API and application query interface (REST/GraphQL or app-generated API calls).
- Required access:
- Valid authenticated Directus account.
- Read permission on a collection that contains concealed fields (e.g.,
directus_users). - Trigger point:
- Issuing a query that applies
minormax(and potentiallygroupBy) to a concealed field. - Why exploitation is possible:
- The aggregation logic operates directly on the raw database columns.
- The conceal masking is applied at the presentation layer, but aggregate responses return computed raw values, bypassing the masking behavior and thereby disclosing secrets to users who should only see placeholders.
Why this happens
This vulnerability stems from a mismatch between authorization-aware data masking and the lower-level aggregation engine.
Concealed fields are designed to show masked placeholders instead of real values, but the aggregation pipeline (min, max, especially with groupBy) is computed on raw database values and returns those results directly.
As a result, masking is not consistently enforced across all query paths, creating an information exposure condition mapped to CWE-200: Exposure of Sensitive Information to an Unauthorized Actor.
Because users with only generalized read access can indirectly view high-sensitivity secrets they were never meant to see, it also touches CWE-863: Incorrect Authorization, where the system fails to correctly enforce access control over the true value of the concealed field.
Potential impact
- Attackers with basic read access may obtain static API tokens used for automation or integration.
- Compromise of two-factor authentication (2FA) secrets, enabling attackers to generate valid one-time codes and bypass MFA.
- Ability to reconstruct other concealed credentials or secret configuration values stored in Directus.
- Lateral movement within the environment by reusing exposed tokens against other services.
- Elevated privilege within Directus by abusing tokens or accounts whose secrets have been disclosed.
General mitigation guidance
Effective mitigation focuses on consistent enforcement of data masking and authorization across all query paths:
- Ensure that any aggregation or transformation layer (e.g.,
min,max,groupBy) operates on the same masked or filtered representation that is exposed in non-aggregated queries. - Treat concealed or sensitive fields as non-aggregatable by default, or restrict them to carefully audited query contexts.
- Introduce domain-level checks that enforce additional authorization requirements whenever queries involve special types such as concealed, secret, or credential fields.
- Reduce reliance on concealing alone: store high-value secrets (API tokens, 2FA seeds) in dedicated secret-management systems and only keep derived or minimally privileged tokens in Directus.
- Apply least-privilege access control, granting collections with sensitive concealed fields only to roles that strictly require them, and avoid broad read access.
How teams detect issues like this
Detection typically relies on reviewing how sensitive fields are processed through the query pipeline:
- Use static analysis or schema-aware checks to identify fields marked as concealed or highly sensitive and flag any use of generic aggregation functions (
min,max,avg, etc.) on them. - During code review, verify that all data-access layers (REST handlers, GraphQL resolvers, aggregation utilities) consistently reuse the same authorization and masking logic, rather than bypassing it.
- Implement automated tests that simulate low-privilege users querying concealed fields with aggregates and ensure only placeholders or blocked responses are returned.
- Monitor application logs and analytics for unusual aggregate queries against sensitive collections (e.g., aggregates over
directus_userssecret-related columns) as potential signs of probing.

