# GHSA-6QM5-R3G8-QGQH: Query operator allow-list bypass in @feathersjs/adapter-commons allows $where code execution on @feathersjs/memory

- Database: GitHub
- Severity: CVSS 9.8 (Critical)
- Published: 2026-08-14
- Modified: 2026-08-14

## Affected versions

- @feathersjs/adapter-commons (npm): from 5.0.0, through 5.0.48
- @feathersjs/mongodb (npm): from 5.0.0, through 5.0.48
- @feathersjs/schema (npm): from 5.0.0, through 5.0.48
- @feathersjs/typebox (npm): from 5.0.0, through 5.0.48

## Description

### Impact

`validateQueryProperty()` in `@feathersjs/adapter-commons` did not recurse into array values. `_.isObject()` in `@feathersjs/commons` excludes arrays, so `isPlainObject()` returned false and the value was returned unvalidated.

An extra array level around a sub-query bypassed the operator allow-list:

- `$or: [{ $where: '1==1' }]` was correctly rejected
- `$or: [[{ $where: '1==1' }]]` was accepted

The same allow-list also skipped filter values:

- `$or` / `$and` as a non-array object (`{ $or: { $where: '1==1' } }`)
- Object `$select` (`{ $select: { x: { $function: … } } }`), which `@feathersjs/mongodb` spreads into `find().project()` / `$project`
- Object `$sort` values containing `$` operators

On an application using `@feathersjs/memory`, an unvalidated `$where` operator reaches sift, which compiles the supplied string with `new Function()`. That is remote code execution in the Node.js process from a single unauthenticated query. Express's default `extended` query parser is enough to produce the nested array; no custom endpoints, operators, or body parsers are required.

Separately, `ObjectIdSchema()` in `@feathersjs/schema` and `@feathersjs/typebox` accepted any object (`additionalProperties: true`) so that `ObjectId` instances would validate. Operator documents such as `{ $where }` and `{ $regex }` were therefore treated as valid ids. Generated MongoDB apps put `ObjectIdSchema` on `_id` / `userId` in `querySyntax`; default `validateQuery` then marks the query validated and skips the adapter allow-list.

This is a Feathers 5 regression for the array case. The v4 `cleanQuery` implementation mapped over arrays. All v5 releases through 5.0.48 are affected. v4 is not affected.

`filterQuery()` is called from `AdapterBase.sanitizeQuery()`, so unvalidated operators also reach every adapter built on that base class, including `@feathersjs/mongodb` and `@feathersjs/knex`. Remote code execution was only verified on `@feathersjs/memory`.

### Patches

Fixed in 5.0.49 via https://github.com/feathersjs/feathers/pull/3700:

- `validateQueryProperty` recurses into arrays
- `$select`, `$or`, `$and`, and `$sort` filter values are validated
- The `objectid` keyword accepts ObjectId instances and rejects other objects; `ObjectIdSchema` uses that for its object branch

Upgrade to **5.0.49** or later.

### Workarounds

Until you can upgrade:

- Use [`validateQuery`](https://feathersjs.com/api/schema/validators.html#validatequery) with a closed query schema (`additionalProperties: false`), as generated apps already do. This blocks the extra-array wrap, but does **not** block operator objects assigned to `ObjectIdSchema` fields unless you also upgrade or tighten that schema.
- Or set Express to the simple query parser (`app.set('query parser', 'simple')`) so nested array query keys are not produced.
- Avoid exposing `@feathersjs/memory` `find` to untrusted clients.

### Credit

Reported responsibly by Khiêm Trần ([@komega2409](https://github.com/komega2409)) and Chien Huynh ([@chienhm](https://github.com/chienhm)).

### References

- https://github.com/feathersjs/feathers/pull/3700
- https://github.com/feathersjs/feathers/commit/304a1aac
- https://github.com/feathersjs/feathers/releases/tag/v5.0.49
- https://www.npmjs.com/package/@feathersjs/adapter-commons/v/5.0.49

## References

- https://github.com/feathersjs/feathers/security/advisories/GHSA-6qm5-r3g8-qgqh

Page: https://cve.now/GHSA-6QM5-R3G8-QGQH

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
