llamaCVEVulnerability Intelligence
/
Advisory · GitHub · npm · apostrophe

GHSA-XMPP-F9V3-R7QH

Incomplete fix for CVE-2026-39857 — publicApiProjection choices/counts guard bypassable via relationship slug-builder aliases

Parche disponible
Descargar PNG JSON
CVSS 3.1
5.3
Media
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versión>=4.32.0
Exposición98 dDesde la divulgación, 12 ago 2026, 12:34 p. m.
Detección98 dDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Monitoreo
Detectada +1
12 ago 26
18 nov 26
19 nov 26
12 ago 26
6 sept 26
1 oct 26
25 oct 26
19 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-XMPP-F9V3-R7QH divulgada · CVSS 5.3 (GitHub)
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés

### Summary
The fix for CVE-2026-39857 added `choicesFieldAllowedByProjection()` in `@apostrophecms/doc-type` to stop the `?choices=` / `?counts=` query parameters from leaking distinct values of fields excluded from `publicApiProjection`. The guard resolves the schema field via an EXACT-NAME match (`self.schema.find(f => f.name === filter)`) and, when no field matches, returns `true` (allowed). Query builders whose registered name differs from the schema field name — specifically the relationship "slug" alias builders (`author` / `authorAnd` for a relationship field named `_author`) — are therefore not gated. An unauthenticated user can still extract distinct relationship choices for a relationship field that was deliberately excluded from `publicApiProjection`. The advisory for CVE-2026-39857 explicitly lists "relationship" among the field types meant to be protected, so this is a residual of the same issue.

### Details
For a relationship field `_author`, Apostrophe registers (schema/lib/addFieldTypes.js → schema/index.js `addRelationshipSlugQueryBuilder`, line ~1509) extra builders named without the leading underscore: `author` and `authorAnd`. Each has a `launder` method and a `choices` function (`relationshipQueryBuilderChoices`).

In the choices `after` handler (doc-type/index.js ~2769-2794) a requested filter is honored if:
1. `_.has(query.builders, filter)` — true for `author`
2. `query.builders[filter].launder` — true for `author`
3. `choicesFieldAllowedByProjection(filter, publicApiProjection)` — the guard

The guard (doc-type/index.js 1634-1656):

choicesFieldAllowedByProjection(filter, projection) {
  if (!projection || !Object.keys(projection).length) return true;
  const field = self.schema.find(f => f.name === filter); // exact name
  if (!field) return true;                                 // <-- fails open
  const topLevel = filter.split('.')[0];
  ...
}

Because the schema field is named `_author` but the builder/filter is `author`, `schema.find` returns `undefined` and the guard returns `true`, so `toChoices('author')` runs. `relationshipQueryBuilderChoices` executes `query.toDistinct(field.idsStorage)` on the host collection (MongoDB `distinct` ignores projections — the same root cause as the parent CVE) to obtain referenced related-doc ids, then queries the related type. `?counts=author` is equivalent (the `counts` builder delegates to `choices`). Page REST API shares the same code path.

Scope/limitation (honest): the related-type lookup uses the anonymous request, so only PUBLICLY-VISIBLE related docs are returned (title/slug). The residual leak is therefore the relationship linkage — which public related docs are referenced by the host pieces — that the operator removed from `publicApiProjection`. It does not expose non-public related docs or arbitrary excluded scalar host fields.

### PoC
Prereqs: Apostrophe >= 4.29.0; a piece type (e.g. `article`) with:
- `publicApiProjection: { title: 1, slug: 1, _url: 1 }`
- a relationship field `_author` (related type publicly viewable) NOT in the projection

# Baseline: relationship is not exposed
curl -s 'http://localhost:3000/api/v1/article' | python3 -m json.tool
# results contain only title, slug, _url

# Bypass via the relationship slug-builder alias (note: "author", not "_author")
curl -s 'http://localhost:3000/api/v1/article?choices=author' | python3 -m json.tool
# -> "choices": { "author": [ { "label": "<author title>", "value": "<author slug>" }, ... ] }

# counts variant additionally reveals reference counts
curl -s 'http://localhost:3000/api/v1/article?counts=author'

By contrast `?choices=_author` and `?choices=<excluded-scalar>` are correctly blocked by the fix — only the alias name leaks. (Verified: the exact guard executed in isolation returns false for `secret`/`_author` and true for `author`/`authorAnd`; a faithful simulation of the `after` handler shows `author`/`authorAnd` reach `toChoices()` while `secret`/`_author` are blocked.)

### Impact
Unauthenticated information disclosure of relationship linkage (set of referenced, publicly-visible related docs by title/slug, plus per-value counts via `?counts=`) for relationship fields that an operator intentionally excluded from `publicApiProjection`. This is the relationship-field portion of CVE-2026-39857's intended protection, left unguarded by the exact-name match. Lower severity than the parent CVE (no arbitrary scalar field values, no non-public docs).

### Suggested fix
Resolve the schema field by the builder's underlying field, not the literal filter string. Either map the alias back to the relationship field before the projection check, or gate on the field actually queried. Concretely, in `choicesFieldAllowedByProjection`, also match relationship alias/`idsStorage` builders, e.g. resolve `filter` (and its `And` suffix) to the relationship field whose `name.replace(/^_/, '')` equals the filter, and apply the projection check against that relationship field (and its `idsStorage`). Equivalently, compute the field the builder distinct-queries and require that property to be permitted by `publicApiProjection`.

Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.

Vector CVSS 3.1

Desglose de métricas

Opción resaltada = valor del vector · izquierda = peor caso · GitHub
Vector de ataqueAV:N
RedAdyacenteLocalFísica
ComplejidadAC:L
BajaAlta
PrivilegiosPR:N
NingunoBajosAltos
InteracciónUI:N
NingunaRequerida
AlcanceS:U
CambiadoSin cambio
ConfidencialidadC:L
AltoBajoNinguno
IntegridadI:N
AltoBajoNinguno
DisponibilidadA:N
AltoBajoNinguno
Versiones

Rangos afectados

Afectada Corregida
apostrophe≥ 4.29.0 < >=4.32.0
>=4.32.0
4.29.0
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
npmapostrophe
Corregida >=4.32.0 — —
Versiones corregidas>=4.32.0
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://github.com/apostrophecms/apostrophe/security/advisories/GHSA-xmpp-f9v3-r7qh

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.