# ORM filter relation traversal leak

User-controlled filters, projections or query keys reaching related records or hidden fields without a read check

_Area: Web access control and IDOR. Seen in 3 disclosed reports; latest 2026-12-04. Updated 2026-12-05._

## How it works

A query layer accepts user input for filtering, sorting, field selection or population, and sanitizes only the keys it knows about. Anything else is passed through — spread into the ORM query object, or left in a projection — and reaches the database as a real query clause. The broken assumption is that "sanitized" means "only documented keys survive." In practice the sanitizer destructures a fixed set (filters, sort, fields, populate) and silently drops the rest, while a downstream spread re-emits unknown keys into a privileged sink [E1](https://bugbountylibrary.com/r/blog%3Abishopfox-com-blog-cve-2026-27886-unauthenticated-boolean-oracle-exfiltration-of-administrator-secrets-in-strapi.md). The same gap appears when filters are allowed to traverse relations: an operator chain on `updatedBy`/`createdBy` emits a JOIN against `admin_users` even though the caller has no read permission on that schema [E3](https://bugbountylibrary.com/r/ghsa%3AGHSA-rjg2-95x7-8qmx.md). Projection sanitizers fail similarly: a string-only check misses other projection forms, so `select: false` fields come back [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-xfcm-rmv3-crmq.md).

## Where it shows up

- Sanitizers that destructure a fixed key list and ignore unknown top-level keys [E1](https://bugbountylibrary.com/r/blog%3Abishopfox-com-blog-cve-2026-27886-unauthenticated-boolean-oracle-exfiltration-of-administrator-secrets-in-strapi.md)
- A `{...rest, ...query}` spread feeding an ORM `findMany`/`where` [E1](https://bugbountylibrary.com/r/blog%3Abishopfox-com-blog-cve-2026-27886-unauthenticated-boolean-oracle-exfiltration-of-administrator-secrets-in-strapi.md)
- Filter operators that follow relations (`updatedBy`, `createdBy`, `publishedBy`) into schemas the caller cannot read [E3](https://bugbountylibrary.com/r/ghsa%3AGHSA-rjg2-95x7-8qmx.md)
- Projection/field-selection code that only handles string values or only blocks `+path` [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-xfcm-rmv3-crmq.md)
- List endpoints whose response counts or lengths vary with private column values [E3](https://bugbountylibrary.com/r/ghsa%3AGHSA-rjg2-95x7-8qmx.md)

## How to review

Trace every user-controlled query key from the request to the ORM call. The invariant: no key, operator or projection form the caller did not explicitly authorize may reach the query object, and no filter may traverse into a relation target the caller lacks read permission on. Check that the sanitizer is allowlist-based (reject unknown keys, don't ignore them) and that the sink receives only the sanitized object, not a spread of the original. For projections, enumerate every form the driver accepts and confirm each is blocked or stripped of `select: false` fields [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-xfcm-rmv3-crmq.md). For relations, confirm the generated query does not JOIN tables outside the caller's read scope [E3](https://bugbountylibrary.com/r/ghsa%3AGHSA-rjg2-95x7-8qmx.md).

## How finders spotted it

- Read the sanitizer pipeline, noticed it destructured only four documented keys and ignored the rest, then traced the spread into `findMany` and saw an attacker `where` survive to the SQL layer [E1](https://bugbountylibrary.com/r/blog%3Abishopfox-com-blog-cve-2026-27886-unauthenticated-boolean-oracle-exfiltration-of-administrator-secrets-in-strapi.md)
- Enumerated projection syntax variants (inclusion/exclusion mixing, `+path`, aggregation expressions, `$slice`/`$meta`/`$elemMatch`, nested sub-projections, positional `$`, `__proto__`, discriminators) and tested each against the sanitizer [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-xfcm-rmv3-crmq.md)
- Noticed operator chains reached relational schemas without read permission, and that the LEFT JOIN against `admin_users` made response counts leak private columns [E3](https://bugbountylibrary.com/r/ghsa%3AGHSA-rjg2-95x7-8qmx.md)

## Variants seen

- Unknown top-level key (`where`) passed through to the ORM [E1](https://bugbountylibrary.com/r/blog%3Abishopfox-com-blog-cve-2026-27886-unauthenticated-boolean-oracle-exfiltration-of-administrator-secrets-in-strapi.md)
- Relation-traversing filter operators joining an unreadable schema [E3](https://bugbountylibrary.com/r/ghsa%3AGHSA-rjg2-95x7-8qmx.md)
- Projection bypass via alternate MongoDB projection forms [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-xfcm-rmv3-crmq.md)

## Impact and severity

A boolean oracle over a private column (reset token) let unauthenticated attackers extract admin secrets; chained with legitimate forgot-password/reset-password endpoints it became full Super Admin takeover [E1](https://bugbountylibrary.com/r/blog%3Abishopfox-com-blog-cve-2026-27886-unauthenticated-boolean-oracle-exfiltration-of-administrator-secrets-in-strapi.md)[E3](https://bugbountylibrary.com/r/ghsa%3AGHSA-rjg2-95x7-8qmx.md). Projection bypass exposed password hashes and reset tokens [E2](https://bugbountylibrary.com/r/ghsa%3AGHSA-xfcm-rmv3-crmq.md). Severity rises with unauthenticated reach, relation traversal into privileged tables, and any side channel (response counts) that turns a blind filter into an oracle [E3](https://bugbountylibrary.com/r/ghsa%3AGHSA-rjg2-95x7-8qmx.md).

## Seen in real software
Open-source packages and projects, and products, where this pattern was found. If the target runs one, compare the version it runs with the fix.
- **mongoose (npm)** >= 8.5.0, < 8.24.10, fixed in 8.24.10: Mongoose: sanitizeProjection can be bypassed to include fields deselected with `select: false` (CVE-2026-142596). Report: https://bugbountylibrary.com/r/ghsa%3AGHSA-xfcm-rmv3-crmq.md. Fix: https://github.com/Automattic/mongoose/commit/c369da407ee8bea907bb5af7bb94ce5deeb3e0e4
- **Strapi** (Content API query sanitizer (validateQuery/sanitizeQuery/tra) 4.0.0 through 5.36.1, fixed in 5.37.0: CVE-2026-27886: Unauthenticated Boolean-Oracle Exfiltration of Administrator Secrets in Strapi (CVE-2026-27886). Report: https://bugbountylibrary.com/r/blog%3Abishopfox-com-blog-cve-2026-27886-unauthenticated-boolean-oracle-exfiltration-of-administrator-secrets-in-strapi.md
- **@strapi/strapi (npm)** >= 4.0.0, < 5.37.0, fixed in 5.37.0: Strapi may leak sensitive data via relational filtering due to lack of query sanitization (CVE-2026-27886). Report: https://bugbountylibrary.com/r/ghsa%3AGHSA-rjg2-95x7-8qmx.md

## Evidence
- E1: https://bugbountylibrary.com/r/blog%3Abishopfox-com-blog-cve-2026-27886-unauthenticated-boolean-oracle-exfiltration-of-administrator-secrets-in-strapi.md
- E2: https://bugbountylibrary.com/r/ghsa%3AGHSA-xfcm-rmv3-crmq.md
- E3: https://bugbountylibrary.com/r/ghsa%3AGHSA-rjg2-95x7-8qmx.md
