Summary
Strapi's Content API query engine did not sufficiently sanitize where query parameters when filtering through relational fields such as updatedBy.
An unauthenticated attacker could craft boolean-oracle filters against public content types to infer sensitive data from the admin_users table, including password reset tokens, enabling full admin account takeover without prior access.
Affected context
This vulnerability appears in Strapi deployments that:
- Run versions from 4.0.0 up to (but not including) the fixed release.
- Expose at least one publicly-accessible Content API endpoint (e.g., unauthenticated GET on a collection type).
- Have that content type related to
admin_users(for example viaupdatedBy,createdBy, or other admin relations). - Allow clients to use
wherequery parameters for filtering.
In these conditions, the query layer allows client-specified filters to traverse into relational admin fields that should otherwise be hidden, leaking information via response characteristics rather than direct field exposure.
Exploit preconditions
- Attack surface: Public Content API endpoints that support query filters (e.g.,
?where[...]). - Required access: No authentication required; any external caller can send crafted HTTP requests.
- Data model requirement: At least one public content type must have a relation to
admin_users(such asupdatedBy), or another administrative relation. - Trigger point: Use of relational filter chains in query parameters, e.g.
where[updatedBy][resetPasswordToken][$startsWith]=.... - Why exploitation is possible: The query parameter sanitization layer validates the syntactic correctness of filters but does not enforce authorization boundaries on relational traversal. As a result, it allows parameter chains that join into tables and columns the caller has no read rights on. The resulting
LEFT JOINandWHEREclause cause observable changes (e.g., result counts), which become a one-bit oracle over the contents of fields likeresetPasswordToken.
Why this happens
The core issue is improper query parameter sanitization and authorization enforcement in the query-building pipeline.
When a client supplies filters via the where parameter, Strapi constructs SQL (or ORM-level) queries that may traverse relationships, such as from a public content type to the admin_users table through updatedBy.
The sanitization layer primarily checks that filters are syntactically valid and align with allowed operators, but it fails to restrict which relational paths can be queried based on the caller's permissions.
This leads to a condition described by CWE-943: Improper Neutralization of Special Elements in Data Query Logic combined with CWE-200: Exposure of Sensitive Information to an Unauthorized Actor.
Rather than a classic SQL injection, the bug is a logical injection into the query semantics: untrusted query structure is accepted and used to generate joins and conditions referencing sensitive fields, effectively exposing them through a boolean-oracle side channel.
Potential impact
- An attacker may extract administrator
resetPasswordTokenvalues bit by bit using crafted boolean-oracle filters. - An attacker could perform full administrative account takeover by leveraging stolen reset tokens in the legitimate password reset flow.
- Sensitive administrative metadata (e.g., whether certain admin fields match a predicate) could be inferred without direct read permissions.
- The compromise of an admin account may enable further configuration changes, data exfiltration, or injection of malicious content across the CMS.
General mitigation guidance
Effective mitigation focuses on tightening query-parameter handling, enforcing authorization on relational traversal, and reducing what is exposed on public endpoints:
- Constrain relational traversal in filters: Implement strict validation that disallows filter chains crossing into schemas or relationships the caller is not authorized to read, even if the base content type is public.
- Layer authorization at the query boundary: Apply permission checks not just at the route or model level, but also at the query-construction stage so relational joins and field references are subject to the same access control rules.
- Use explicit allow-lists for filterable fields: Define a restricted list of fields (and relations) that can be referenced from
whereparameters on public endpoints; drop or reject all others. - Normalize and sanitize operators: Restrict supported operators and chains (
$startsWith,$gt, etc.) to those that are safe and expected, and validate their targets against policy. - Minimize sensitive relations on public types: Avoid binding administrative entities like
admin_usersdirectly to publicly readable content types, or decouple those relations from public query interfaces where possible. - Harden authentication recovery flows: Treat reset tokens and similar secrets as highly sensitive and ensure additional safeguards (short expiration, one-time use, secondary confirmation) so that token leakage has reduced blast radius.
How teams detect issues like this
Detection can leverage both code-level analysis and runtime monitoring:
- Static analysis and code review:
- Search for controller or service logic that forwards raw
whereor filter parameters directly into query builders without permission-aware sanitization. - Review relationship mappings from public content types to administrative entities (such as
admin_users) and verify that query filters cannot traverse those relations. - Look for generic query-building helpers that accept arbitrary nested filter objects and ensure they enforce field- and relation-level authorization.
- Automated policy enforcement:
- Add linting or schema-validation rules that flag public routes whose filters reference admin relations or sensitive fields by name.
- Use automated API contract testing to verify that attempts to filter on restricted relational fields are rejected with clear errors rather than producing valid responses.
- Runtime and log monitoring:
- Monitor for patterns of highly repetitive filter requests with systematically varying predicates (e.g.,
$startsWithiterating over character sets) which indicate oracle-style probing. - Instrument query logs to detect unexpected joins from public content tables into
admin_usersor other privileged tables initiated by anonymous requests.

