GHSA-J5RQ-XFVR-P969
Vulnerability from github – Published: 2026-10-20 18:03 – Updated: 2026-10-20 18:03Summary
@apostrophecms/db-connect ships an in-memory MongoDB emulation used by its SQLite, PostgreSQL, and multipostgres adapters. Its unsetNestedField helper walks an attacker-controlled dotted field path with no segment validation and calls delete on the resolved property. A low-privileged authenticated user (any role holding view-draft, which every editor and contributor has; reduced to any logged-in user when guestApiAccess is enabled) can send a piece-type REST GET request whose project query builder contains an exclusion key such as constructor.prototype.hasOwnProperty. On a SQLite or PostgreSQL adapter this key reaches unsetNestedField, which resolves Object.prototype and deletes a shared runtime method. Because that method is shared across the whole Node process, the deletion breaks request handling for every tenant and user until the process is restarted, giving a single request a persistent denial of service.
Root Cause
The projection query builder laundens only projection values, never projection keys, so an arbitrary dotted key survives to the database layer. On the SQLite and PostgreSQL adapters an exclusion projection is applied in JavaScript by applyProjection, which for each excluded field calls unsetNestedField(result, field). unsetNestedField splits the field on . and walks the resulting segments with no guard: unlike its sibling setNestedField, it does not even block a literal __proto__, and neither helper blocks constructor or prototype. Because the working object is a plain object produced by JSON.parse(JSON.stringify(doc)), its constructor resolves to the global Object, so a path of constructor.prototype.<member> reaches the shared Object.prototype and deletes a core, configurable method. The violated invariant is that untrusted input must never be able to traverse into and mutate shared prototype objects.
Affected functions (repository-relative paths):
- unsetNestedField packages/db-connect/lib/shared.js:119-129 (no segment guard; delete on resolved property)
- applyProjection packages/db-connect/lib/shared.js:164-216 (exclusion branch calls unsetNestedField per excluded key)
Reachability driver (consumer on a SQL adapter):
- project.launder / project.finalize packages/apostrophe/modules/@apostrophecms/doc-type/index.js:2003-2103
- getRestQuery packages/apostrophe/modules/@apostrophecms/piece-type/index.js:1139-1157
- SQLite adapter applyProjection call packages/db-connect/adapters/sqlite.js:906,980
Impact
Prerequisites: an authenticated account holding view-draft (every editing role; any logged-in user when guestApiAccess: true), and a consumer configured to use a SQLite, PostgreSQL, or multipostgres adapter. The default mongodb adapter hands the projection to the real MongoDB driver and is not affected. With those conditions, a single crafted GET request deletes an attacker-chosen shared prototype method (for example Object.prototype.hasOwnProperty, toString, or an Array.prototype member). The demonstrated capability is a persistent, process-wide denial of service: after the deletion, ordinary calls such as obj.hasOwnProperty(...) throw across Apostrophe, its dependencies, and the database driver, so the affected Node process cannot service requests for any user until it is restarted. The attacker chooses which member to remove, and the corruption of shared runtime state persists for the life of the process.
Proof of Concept
The finding was reproduced by executing the shipped helper directly against the published db-connect source; a live consumer requires a SQLite or PostgreSQL adapter, an authenticated view-draft session, and at least one matching document.
- Authenticate as any user with
view-drafton a site whose database adapter issqlite,postgres, ormultipostgres. - Issue a piece-type REST read with an exclusion projection whose key targets a shared prototype method.
- Observe that subsequent requests fail process-wide because the shared method was deleted.
GET /api/v1/@apostrophecms/article?project[constructor.prototype.hasOwnProperty]=0
Cookie: <authenticated view-draft session>
safe benign exclusion {title:0} leaves Object.prototype.hasOwnProperty intact
VULNERABLE exclusion projection deleted Object.prototype.hasOwnProperty (callableBefore=true, brokeEveryObject=true)
VULNERABLE exclusion projection deleted an arbitrary Object.prototype method (__pocMarker)
Attack Chain
- Exposure: An authenticated
view-draftuser calls the piece-type REST GET endpointGET /api/v1/@apostrophecms/<piece-type>, which is reachable by any editing role. - Control: The query string
project[constructor.prototype.hasOwnProperty]=0is parsed byqs(withallowDotsoff) into a single own key with literal dots,{ 'constructor.prototype.hasOwnProperty': '0' }. - Path:
getRestQueryapplies the query builders first;project.laundercopies the key verbatim and coerces only the value tofalse;project.finalizeskips the falsy value withif (!val) continueand preserves the key; the cursor stores it as the projection. - Guard: The
publicApiProjectionoverride that would discard the attacker projection runs only whencanAccessApi(req)is false, so it is skipped for the authenticated caller; no key allowlist, segment check, or prototype guard exists anywhere on the path. - Primitive: On the SQLite or PostgreSQL adapter,
applyProjectiontakes the exclusion branch and callsunsetNestedField(result, 'constructor.prototype.hasOwnProperty'), which resolvesObject.prototypeand executesdelete Object.prototype.hasOwnProperty. - Result: A shared prototype method is removed for the entire Node process, so request handling throws for all users and tenants until restart.
Bypass Evidence
The relevant protections were examined individually and none blocks this path. The projection launder (packages/apostrophe/modules/@apostrophecms/doc-type/index.js:2003-2011) laundens values only and retains arbitrary keys. The publicApiProjection permission override (packages/apostrophe/modules/@apostrophecms/piece-type/index.js:1142-1156) is gated on !canAccessApi(req) and is therefore not taken for an authenticated view-draft caller. The finalize per-key loop (doc-type/index.js:2062-2069) short-circuits on the falsy exclusion value before it ever inspects the key. Most importantly, unsetNestedField (packages/db-connect/lib/shared.js:119-129) has no segment guard at all: its sibling setNestedField blocks a literal __proto__ but neither helper blocks constructor or prototype, and the constructor.prototype.<member> path bypasses even that partial __proto__ check. Attempts to disprove the finding all failed: routing the value to the inclusion branch (which uses setNestedField) does not occur because the value is falsy; the working object is a plain object from JSON.parse(JSON.stringify(doc)) so its constructor is the global Object; and Object.prototype.hasOwnProperty is configurable, so the delete succeeds. The seed prototype-pollution fix added a {__proto__, constructor, prototype} segment guard, but only in apos.util.set/get in the separate apostrophe package; the db-connect helpers were never hardened.
Affected Versions
Ecosystem: npmPackage: @apostrophecms/db-connectConfirmed affected range: >= 1.0.0, <= 1.0.2Latest release checked: 1.0.2 (npm registry)Fix status: not fixed
The unguarded unsetNestedField and the exclusion-branch applyProjection call are byte-identical across the published stable releases 1.0.0, 1.0.1, and 1.0.2, and the SQLite and PostgreSQL adapters invoke applyProjection per returned document in all of them. No published release fixes the issue. The prerelease line (1.0.0-alpha.1, 1.0.0-alpha.2, 1.0.2-alpha.0) ships the same code but is outside the supported stable channel. Reachability requires a consumer on a SQLite, PostgreSQL, or multipostgres adapter; the default mongodb adapter delegates the projection to the real MongoDB driver and is not affected. The apostrophe package, which drives reachability, declares @apostrophecms/db-connect@^1.0.1, resolving to the affected 1.0.2.
Suggested Fix
Enforce that untrusted field paths can never traverse into shared prototype objects. Both unsetNestedField and setNestedField in packages/db-connect/lib/shared.js should reject any path whose segments include __proto__, constructor, or prototype, mirroring the unsafePathSegments guard already used in the apostrophe package's apos.util.set/get; equivalently, the helpers can traverse own-properties only (for example using Object.prototype.hasOwnProperty checks captured before use, or Map-based access) so that resolution cannot reach prototype objects. Because applyProjection is the reachable gate, adding the guard at the helper level protects every adapter path at once. As an interim mitigation without a code change, deployments can run on the default mongodb adapter (which is not affected) or restrict authenticated API access so that only fully trusted roles can reach the piece-type REST endpoints.
Reported by zx (GitHub: @manus-pi).
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "@apostrophecms/db-connect"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "1.1.0"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "npm",
"name": "apostrophe"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "4.33.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-113666"
],
"database_specific": {
"cwe_ids": [
"CWE-1321",
"CWE-400"
],
"github_reviewed": true,
"github_reviewed_at": "2026-10-20T18:03:50Z",
"nvd_published_at": null,
"severity": "HIGH"
},
"details": "## Summary\n\n`@apostrophecms/db-connect` ships an in-memory MongoDB emulation used by its SQLite, PostgreSQL, and multipostgres adapters. Its `unsetNestedField` helper walks an attacker-controlled dotted field path with no segment validation and calls `delete` on the resolved property. A low-privileged authenticated user (any role holding `view-draft`, which every editor and contributor has; reduced to any logged-in user when `guestApiAccess` is enabled) can send a piece-type REST GET request whose `project` query builder contains an exclusion key such as `constructor.prototype.hasOwnProperty`. On a SQLite or PostgreSQL adapter this key reaches `unsetNestedField`, which resolves `Object.prototype` and deletes a shared runtime method. Because that method is shared across the whole Node process, the deletion breaks request handling for every tenant and user until the process is restarted, giving a single request a persistent denial of service.\n\n## Root Cause\n\nThe projection query builder laundens only projection values, never projection keys, so an arbitrary dotted key survives to the database layer. On the SQLite and PostgreSQL adapters an exclusion projection is applied in JavaScript by `applyProjection`, which for each excluded field calls `unsetNestedField(result, field)`. `unsetNestedField` splits the field on `.` and walks the resulting segments with no guard: unlike its sibling `setNestedField`, it does not even block a literal `__proto__`, and neither helper blocks `constructor` or `prototype`. Because the working object is a plain object produced by `JSON.parse(JSON.stringify(doc))`, its `constructor` resolves to the global `Object`, so a path of `constructor.prototype.\u003cmember\u003e` reaches the shared `Object.prototype` and deletes a core, configurable method. The violated invariant is that untrusted input must never be able to traverse into and mutate shared prototype objects.\n\n```text\nAffected functions (repository-relative paths):\n- unsetNestedField packages/db-connect/lib/shared.js:119-129 (no segment guard; delete on resolved property)\n- applyProjection packages/db-connect/lib/shared.js:164-216 (exclusion branch calls unsetNestedField per excluded key)\nReachability driver (consumer on a SQL adapter):\n- project.launder / project.finalize packages/apostrophe/modules/@apostrophecms/doc-type/index.js:2003-2103\n- getRestQuery packages/apostrophe/modules/@apostrophecms/piece-type/index.js:1139-1157\n- SQLite adapter applyProjection call packages/db-connect/adapters/sqlite.js:906,980\n```\n\n## Impact\n\nPrerequisites: an authenticated account holding `view-draft` (every editing role; any logged-in user when `guestApiAccess: true`), and a consumer configured to use a SQLite, PostgreSQL, or multipostgres adapter. The default `mongodb` adapter hands the projection to the real MongoDB driver and is not affected. With those conditions, a single crafted GET request deletes an attacker-chosen shared prototype method (for example `Object.prototype.hasOwnProperty`, `toString`, or an `Array.prototype` member). The demonstrated capability is a persistent, process-wide denial of service: after the deletion, ordinary calls such as `obj.hasOwnProperty(...)` throw across Apostrophe, its dependencies, and the database driver, so the affected Node process cannot service requests for any user until it is restarted. The attacker chooses which member to remove, and the corruption of shared runtime state persists for the life of the process.\n\n## Proof of Concept\n\n`The finding was reproduced by executing the shipped helper directly against the published db-connect source; a live consumer requires a SQLite or PostgreSQL adapter, an authenticated view-draft session, and at least one matching document.`\n\n1. Authenticate as any user with `view-draft` on a site whose database adapter is `sqlite`, `postgres`, or `multipostgres`.\n2. Issue a piece-type REST read with an exclusion projection whose key targets a shared prototype method.\n3. Observe that subsequent requests fail process-wide because the shared method was deleted.\n\n```text\nGET /api/v1/@apostrophecms/article?project[constructor.prototype.hasOwnProperty]=0\nCookie: \u003cauthenticated view-draft session\u003e\n```\n\n```text\nsafe benign exclusion {title:0} leaves Object.prototype.hasOwnProperty intact\nVULNERABLE exclusion projection deleted Object.prototype.hasOwnProperty (callableBefore=true, brokeEveryObject=true)\nVULNERABLE exclusion projection deleted an arbitrary Object.prototype method (__pocMarker)\n```\n\n## Attack Chain\n\n1. **Exposure:** An authenticated `view-draft` user calls the piece-type REST GET endpoint `GET /api/v1/@apostrophecms/\u003cpiece-type\u003e`, which is reachable by any editing role.\n2. **Control:** The query string `project[constructor.prototype.hasOwnProperty]=0` is parsed by `qs` (with `allowDots` off) into a single own key with literal dots, `{ \u0027constructor.prototype.hasOwnProperty\u0027: \u00270\u0027 }`.\n3. **Path:** `getRestQuery` applies the query builders first; `project.launder` copies the key verbatim and coerces only the value to `false`; `project.finalize` skips the falsy value with `if (!val) continue` and preserves the key; the cursor stores it as the projection.\n4. **Guard:** The `publicApiProjection` override that would discard the attacker projection runs only when `canAccessApi(req)` is false, so it is skipped for the authenticated caller; no key allowlist, segment check, or prototype guard exists anywhere on the path.\n5. **Primitive:** On the SQLite or PostgreSQL adapter, `applyProjection` takes the exclusion branch and calls `unsetNestedField(result, \u0027constructor.prototype.hasOwnProperty\u0027)`, which resolves `Object.prototype` and executes `delete Object.prototype.hasOwnProperty`.\n6. **Result:** A shared prototype method is removed for the entire Node process, so request handling throws for all users and tenants until restart.\n\n## Bypass Evidence\n\nThe relevant protections were examined individually and none blocks this path. The projection `launder` (packages/apostrophe/modules/@apostrophecms/doc-type/index.js:2003-2011) laundens values only and retains arbitrary keys. The `publicApiProjection` permission override (packages/apostrophe/modules/@apostrophecms/piece-type/index.js:1142-1156) is gated on `!canAccessApi(req)` and is therefore not taken for an authenticated `view-draft` caller. The `finalize` per-key loop (doc-type/index.js:2062-2069) short-circuits on the falsy exclusion value before it ever inspects the key. Most importantly, `unsetNestedField` (packages/db-connect/lib/shared.js:119-129) has no segment guard at all: its sibling `setNestedField` blocks a literal `__proto__` but neither helper blocks `constructor` or `prototype`, and the `constructor.prototype.\u003cmember\u003e` path bypasses even that partial `__proto__` check. Attempts to disprove the finding all failed: routing the value to the inclusion branch (which uses `setNestedField`) does not occur because the value is falsy; the working object is a plain object from `JSON.parse(JSON.stringify(doc))` so its `constructor` is the global `Object`; and `Object.prototype.hasOwnProperty` is configurable, so the delete succeeds. The seed prototype-pollution fix added a `{__proto__, constructor, prototype}` segment guard, but only in `apos.util.set`/`get` in the separate `apostrophe` package; the db-connect helpers were never hardened.\n\n## Affected Versions\n\n- `Ecosystem: npm`\n- `Package: @apostrophecms/db-connect`\n- `Confirmed affected range: \u003e= 1.0.0, \u003c= 1.0.2`\n- `Latest release checked: 1.0.2 (npm registry)`\n- `Fix status: not fixed`\n\nThe unguarded `unsetNestedField` and the exclusion-branch `applyProjection` call are byte-identical across the published stable releases 1.0.0, 1.0.1, and 1.0.2, and the SQLite and PostgreSQL adapters invoke `applyProjection` per returned document in all of them. No published release fixes the issue. The prerelease line (1.0.0-alpha.1, 1.0.0-alpha.2, 1.0.2-alpha.0) ships the same code but is outside the supported stable channel. Reachability requires a consumer on a SQLite, PostgreSQL, or multipostgres adapter; the default `mongodb` adapter delegates the projection to the real MongoDB driver and is not affected. The `apostrophe` package, which drives reachability, declares `@apostrophecms/db-connect@^1.0.1`, resolving to the affected 1.0.2.\n\n## Suggested Fix\n\nEnforce that untrusted field paths can never traverse into shared prototype objects. Both `unsetNestedField` and `setNestedField` in `packages/db-connect/lib/shared.js` should reject any path whose segments include `__proto__`, `constructor`, or `prototype`, mirroring the `unsafePathSegments` guard already used in the `apostrophe` package\u0027s `apos.util.set`/`get`; equivalently, the helpers can traverse own-properties only (for example using `Object.prototype.hasOwnProperty` checks captured before use, or `Map`-based access) so that resolution cannot reach prototype objects. Because `applyProjection` is the reachable gate, adding the guard at the helper level protects every adapter path at once. As an interim mitigation without a code change, deployments can run on the default `mongodb` adapter (which is not affected) or restrict authenticated API access so that only fully trusted roles can reach the piece-type REST endpoints.\n\nReported by zx (GitHub: @manus-pi).",
"id": "GHSA-j5rq-xfvr-p969",
"modified": "2026-10-20T18:03:50Z",
"published": "2026-10-20T18:03:50Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/apostrophecms/apostrophe/security/advisories/GHSA-j5rq-xfvr-p969"
},
{
"type": "WEB",
"url": "https://github.com/apostrophecms/apostrophe/commit/9500b8b0e1d630d5e07fbb5fd2c25ed0943845ce"
},
{
"type": "WEB",
"url": "https://github.com/apostrophecms/apostrophe/commit/f84fd41cbf6c22eb8d0008fc9c25df1f7130b350"
},
{
"type": "PACKAGE",
"url": "https://github.com/apostrophecms/apostrophe"
},
{
"type": "WEB",
"url": "https://github.com/apostrophecms/apostrophe/releases/tag/@apostrophecms/db-connect@1.1.0"
},
{
"type": "WEB",
"url": "https://github.com/apostrophecms/apostrophe/releases/tag/apostrophe@4.33.0"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:H",
"type": "CVSS_V3"
}
],
"summary": "ApostropheCMS: Authenticated projection-exclusion prototype-member deletion in @apostrophecms/db-connect causes process-wide denial of service"
}
Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline
Sightings and recorded dates, grouped by day · UTC
Loading timeline…
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
Browse all ATT&CK techniques and the vulnerabilities related to each.
Related by attack behaviour
Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.