llamaCVEVulnerability Intelligence
/
Advisory · GitHub · npm · @apostrophecms/import-export

GHSA-44GW-RRQ5-FM92

Import-export duplicate override writes to an unconfirmed document

Parche disponible
Descargar PNG JSON
CVSS 3.1
2.6
Baja
CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:N/I:L/A:N Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versiónPrimer parche el mismo día de la divulgación
Exposición9 dDesde la divulgación, 11 nov 2026, 3:28 p. m.
Detección6 dDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Parche 3.7.2
Monitoreo
Detectada +1
11 nov 26
18 nov 26
21 nov 26
11 nov 26
14 nov 26
16 nov 26
18 nov 26
21 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-44GW-RRQ5-FM92 divulgada · CVSS 2.6 (GitHub)
Remediación Parche 3.7.2 @apostrophecms/import-export · 0 d desde divulgación
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 import-export module's duplicate-override step added an identity check (`checkDocMode`) that ties
the document shown to the importer to the document actually written, but that check only applies to
localized (draft/published) types and is a no-op for any type declared `localized: false`. For those
types, an archive entry's `aposDocId` (used to find/display the "duplicate") and its `_id` (used to find
the document that actually gets overwritten) are never cross-checked, so an importer who confirms
overriding one named duplicate silently overwrites a completely different, unrelated document of the
same type instead.

Details

### Component
`@apostrophecms/import-export`, `lib/methods/import.js` (`checkDocMode`, `checkUpdateTarget`,
`insertOrUpdateDoc`, `overrideDuplicates`, `replaceDocId`).

### Threat model
Attacker/importer: any authenticated user who can import a given piece type (gated by
`canImportOrExport()`'s `view` permission check on that type — in practice an editor/contributor role for
a type such as the shipped `@apostrophecms/redirect` module, or an admin for `@apostrophecms/user`).
Victim: the integrity of any OTHER existing document of that same type on the site, including ones the
importer does not individually own or have been granted document-level access to edit. No interaction
from anyone else is required: the same session that uploads the archive can also confirm the override,
so the "importer" and "attacker" can be the same low-privileged account acting entirely within its own
import workflow.

### Root cause
`insertOrUpdateDoc()` only overwrites the archive's `doc._id` with a database-verified value
(`replaceDocId()`) when `existingAposDocId` is truthy, which is only the case for the singleton/parked-page
dedup path. For an ordinary duplicate (the common case — re-importing content whose `aposDocId` already
exists on the site), `existingAposDocId` is `null`, so `doc._id` passes through to the database query
exactly as the archive author wrote it.

The identity check that was added specifically to prevent exactly this decoupling,
`checkDocMode()`, exits immediately when `!manager.isLocalized()`:

checkDocMode(req, doc, manager) {
  if (!manager.isLocalized()) {
    return;
  }
  ...
  ((_id === undefined) || (
    ... &&
    (_id === `${doc.aposDocId}:${aposLocale}`)
  ));

For a `localized: false` type this means `doc._id` is never required to correspond to `doc.aposDocId` at
all. `checkUpdateTarget()`, the other check added in the same fix, only verifies that the *type* of the
document actually found by `_id` matches the type declared in the archive and that the importer can
import that type — it does not verify that the found document is the one the duplicate-resolution UI
showed the importer. An archive entry can therefore declare `aposDocId: "<decoy's real id>"` (so
`checkDuplicates()` flags it as a duplicate of a document the importer recognizes and agrees to replace)
while declaring `_id: "<a different, real document's id>"` of the same type. When the importer confirms
the override, `update()`'s `self.apos.doc.db.findOne({ _id: doc._id })` resolves to the second document,
`checkUpdateTarget()` passes because its type matches, and `manager.update()` overwrites it with the
archive's attacker-controlled fields — while the document the importer actually saw and agreed to
replace is left untouched.

### Relation to existing advisories
This is a gap in the fix for GHSA-jf5h-36mg-rp6x / GHSA-5m22-7pfq-vp65 ("Archive duplicate continuation
lets contributors overwrite published content" / "Import API bypasses publication roles for protected
content"), which added exactly `checkDocMode()` and `checkUpdateTarget()` to bind the duplicate shown to
the importer to the document actually written. Both GHSAs' published changelog entries for
`@apostrophecms/import-export` 3.7.1 explicitly scope the new `_id`/mode/locale consistency check to
localized types ("Types with `autopublish: true`, types without a draft/published distinction, ... are
unchanged"), i.e. the vendor's own release notes already name "types without a draft/published
distinction" (= `localized: false`) as outside that fix's coverage. This report shows that the excluded
category is not merely unaffected by the *publish-role* half of that fix, it is left with *no* identity
check at all, re-opening the original "duplicate shown ≠ document written" problem for every
`localized: false` type — including the shipped `@apostrophecms/user` and `@apostrophecms/redirect`
piece types, neither of which disables import/export.

### Suggested fix
Extend `checkDocMode()` (or add an equivalent, simpler check) so that for a `localized: false` type,
`doc._id` is required to equal `doc.aposDocId` whenever both are present and `existingAposDocId` is not
set, the same way it is already required to equal `${aposDocId}:${aposLocale}` for localized types.
Rejecting the mismatch keeps the contract `checkUpdateTarget()` already relies on — that the type and
identity of the import's own declared target are internally consistent — for every importable type, not
only localized ones.

### AI Use Disclosure
I used an AI coding assistant (Claude) to help review the `@apostrophecms/import-export` source, draft and
run the proof-of-concept test, and write this report. I verified the finding myself by running the
included test against a real, unmodified copy of `apostrophe`/`@apostrophecms/import-export` 3.7.1 and a
real MongoDB instance, and reviewed the relevant code paths and this report's claims against that output
before submitting.

Proof of concept

### Versions tested
`@apostrophecms/import-export@3.7.1` and `apostrophe@4.34.0` (both the current published npm versions),
checked out from `apostrophecms/apostrophe` git HEAD as of 2026-11-06 (commit `be60d5a95`), which contains
every commit for GHSA-jf5h-36mg-rp6x and GHSA-5m22-7pfq-vp65. Run against a real MongoDB 7 instance (not
mocked). Live-executed, not statically reviewed.

### Reproduction
Using the project's own test harness (`apostrophe/test-lib/util.js`, `getAppConfig()` from
`packages/import-export/test/util/index.js`, which already defines a `nonLocalized` piece type —
`extend: '@apostrophecms/piece-type', options: { localized: false }` — for exactly this category of
type), against a real `apos` instance and MongoDB:

  1. Two real, unrelated `nonLocalized` documents exist: `decoy1` ("Decoy Press Release") and `target1`
  2. An attacker builds a real `.tar.gz` import archive (via the module's own `tar-stream`/`zlib`/EJSON
  3. The importer calls the real `import()` method with this archive. The returned `duplicatedDocs` —
  4. The importer confirms `docIds: ["decoy1"]` and calls the real `overrideDuplicates()`.
  5. Result: `decoy1` (the document the importer saw and agreed to replace) is unchanged. `target1`
decoy1 after override: Decoy Press Release decoy-press-release
target1 after override: HACKED BY ATTACKER hacked-by-attacker

Controls (prove the mechanism, not just the bug):
- Same flow, but with `_id`/`aposDocId` in agreement (the only way a non-malicious archive ever behaves):
the single document named is the only one touched (`normal1` → `Normal Doc UPDATED`). This isolates the
cause to the `_id`/`aposDocId` mismatch specifically, not to `overrideDuplicates()` in general.
- `manager.options.localized === false` is asserted on the fixture before the attack runs, confirming the
test exercises the same `!manager.isLocalized()` branch that gates `checkDocMode()`'s no-op.

Full runnable test (`packages/import-export/test/nosql-idswap-poc.js`, 230 lines) and the harness commands
used are available on request.

### Stack / environment reach
Measured: real `apostrophe` + `@apostrophecms/import-export` code, real MongoDB 7 (Docker), the module's
own public `import()`/`overrideDuplicates()` methods (the same methods the `POST
/api/v1/@apostrophecms/import-export/override-duplicates` REST route calls directly after only checking
`req.user` is truthy — see `lib/apiRoutes.js`). Not tested: an actual HTTP round-trip through that route,
and the shipped `@apostrophecms/user`/`@apostrophecms/redirect` modules specifically (both confirmed by
source review to be `localized: false` and to leave import/export enabled by default, so the same
`!manager.isLocalized()` branch applies to them, but this was not separately live-exercised against those
two modules in this report).

### Verification level
Reproduced end to end against real, unmodified vendor code and a real database, not an isolated/mocked
PoC. Isolated causation via the control test above. The real-world reach to `@apostrophecms/user` /
`@apostrophecms/redirect` specifically is established by source review (both ship with
`localized: false` and no `importExport: { import: false }` override), not by a separate live run against
those two modules.

Impact

An importer (contributor/editor-level access to a given, site-defined or shipped `localized: false` piece
type is enough) can overwrite any existing document of that type with attacker-chosen field content,
while the only document the import-export UI ever shows them as a "duplicate" to confirm is a decoy of
their own choosing. No action from anyone else is required — the importer can be the attacker, acting
entirely within a single self-served import. Concretely, on a site using the shipped
`@apostrophecms/redirect` piece type (also `localized: false`, `editRole: 'editor'`), an editor-level user
could retarget a different redirect rule they do not control to an attacker-chosen (including external)
URL. The impact is overwrite of a document's content fields, not disclosure (no new data is revealed to
the attacker) and not denial of service.

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:H
BajaAlta
PrivilegiosPR:L
NingunoBajosAltos
InteracciónUI:R
NingunaRequerida
AlcanceS:U
CambiadoSin cambio
ConfidencialidadC:N
AltoBajoNinguno
IntegridadI:L
AltoBajoNinguno
DisponibilidadA:N
AltoBajoNinguno
Versiones

Rangos afectados

Afectada Corregida Última
@apostrophecms/import-export< 3.7.2
3.7.2
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
npm@apostrophecms/import-export
Corregida 3.7.2 0 d 3.7.2 no afectada
Versiones corregidas3.7.2
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-44gw-rrq5-fm92

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