CVE-2026-113664: @apostrophecms/import export ApostropheCMS Import-export Tar Guard Misses Vulnerability

MODERATE
Advisory Identifier: GHSA-97wv-p4xx-c7mg
CWE-22
Published
Advisory Summary

CVE-2026-113664 is a MODERATE apostrophecms import-export tar guard misses vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting @apostrophecms/import export libraries in the npm ecosystem. The issue involves apostrophecms import-export tar guard misses './..' because it is a literal '../' substring test. Remediation is available by upgrading affected packages to version 3.7.0.

CVE-2026-113664 at a Glance

CVE Identifier CVE-2026-113664
GHSA Identifier GHSA-97wv-p4xx-c7mg
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product @apostrophecms/import export
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2026-113664

To remediate this vulnerability, upgrade all affected @apostrophecms/import export dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

@apostrophecms/import-export fixed: 3.7.0
npm install @apostrophecms/import-export@3.7.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls @apostrophecms/import-export

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-113664, inspect your project dependencies using npm:

npm ls @apostrophecms/import-export

Analyze the terminal output to locate any version of @apostrophecms/import export in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.7.0), your application is affected.

Note: The npm ls @apostrophecms/import-export command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In @apostrophecms/import export, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary The tar-extraction guard added to `@apostrophecms/import-export` for GHSA-mwxc-m426-3f78 is a literal substring test for `../`, and `./..` does not contain that substring. An entry named `./..` therefore passes the guard, `path.join` normalizes it to the parent of the export directory, and the resulting `fs.WriteStream` opens a directory and emits `EISDIR` with no `error` listener attached, which terminates the Node process. Confirmed on default-branch HEAD `1bd5d0a7a6fe880836fa75adad6964f1c577d640`, package version `3.6.2`. ### Details `packages/import-export/lib/formats/gzip.js`, in the tar-stream `entry` handler inside `extract(filepath, exportPath)`: ```js const name = header.name.replace(/\\/g, '/'); if (name.includes('../')) { // skipped } ... stream.pipe(fs.WriteStream(path.join(exportPath, name))); ``` Two separate problems sit in those four lines. The guard tests the raw entry name for a substring instead of resolving the joined path and requiring containment, and the write stream has no `error` handler, so any stream error becomes an unhandled `'error'` event. Reaching it needs an account that can import, nothing more. `packages/import-export/modules/@apostrophecms/import-export-page/index.js` exposes `post.importExportImport`, which calls into `lib/methods/import.js`; that handler requires `req.user` and then calls `format.input(exportPath)`, which for a `.gz` upload is `gzip.js` calling `extract()` on the uploaded archive. ### PoC This is not an end-to-end exploit. What follows is each of the three primitives the crash depends on, executed individually, plus a source-level trace of the route. The chain from `post.importExportImport` to `extract()` was read, not observed. The guard misses the payload: ```bash node -e "console.log('./..'.includes('../')); console.log('..'.includes('../')); console.log('a/./..'.includes('../'));" ``` ```text false false false ``` `path.join` then resolves it out of the export directory: ```bash node -e "const path=require('path'); const exportPath='/tmp/exportRoot'; console.log(path.join(exportPath,'./..'));" ``` ```text /tmp ``` And a write stream opened on a directory, with no `error` listener, kills the process rather than failing the request: ```bash node -e "const fs=require('fs'); const s=fs.createWriteStream('/tmp'); s.write('x'); s.end(); setTimeout(()=>console.log('still alive'),500);" ``` ```text events.js:291 throw er; // Unhandled 'error' event ^ Error: EISDIR: illegal operation on a directory, open '/tmp' Emitted 'error' event on WriteStream instance at: at internal/fs/streams.js:361:12 at FSReqCallback.oncomplete (fs.js:156:23) { errno: -21, code: 'EISDIR', syscall: 'open', path: '/tmp' } ``` The `events.js:291` frame shows that transcript came off the Node 14 line my audit box had. The unhandled-`error`-event behavior is not version specific, but the exact message on your supported Node versions is worth a re-run. Source-side confirmation without running anything: ```bash grep -n "includes('../')" packages/import-export/lib/formats/gzip.js grep -n "WriteStream" packages/import-export/lib/formats/gzip.js ``` ### Impact An authenticated user who can reach the import UI uploads one crafted archive and takes down the Node process handling it. Every worker that picks up such an archive dies the same way. ### Suggested fix Resolve the target and require containment, and attach an error handler: ```js const base = path.resolve(exportPath); const target = path.resolve(path.join(exportPath, name)); if (target !== base && !target.startsWith(base + path.sep)) { stream.on('end', next); stream.resume(); return; } if (header.type === 'directory') { fsp.mkdir(target).then(next).catch(reject); } else { const out = fs.WriteStream(target); out.on('error', reject); stream.pipe(out); stream.on('end', next); } ``` The error handler earns its place independently. Any tar entry that lands on an existing directory name has the same effect whether or not traversal is involved. ### Why this is not GHSA-mwxc-m426-3f78 The `name.includes('../')` check is the mitigation shipped for GHSA-mwxc-m426-3f78 / CVE-2026-32731. It stops names carrying the literal `../` sequence. It does not canonicalize the joined path, so `./..` and a bare `..` still get through, and it did not touch the missing `error` listener. This report is about what the substring test leaves behind. AI assistance was used for the code audit and drafting. The exact guard and `WriteStream` lines in `packages/import-export/lib/formats/gzip.js` at the stated HEAD were manually verified, the import route from the page module through `lib/methods/import.js` into the entry handler were manually traced, and the three Node one-liners were manually ran and copied verbatim.

CVE-2026-113664 Affected @apostrophecms/import export Versions

1 component(s)
Fixed Versions:
3.7.0
Product / Package Ecosystem Affected Versions Fixed Version
@apostrophecms/import-export
npm
< 3.7.0
3.7.0

References

Frequently Asked Questions

What is CVE-2026-113664?
CVE-2026-113664 is a security vulnerability in @apostrophecms/import export involving ApostropheCMS import-export tar guard misses './..' because it is a literal '../' substring test under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which @apostrophecms/import export versions are affected?
Affected versions include releases prior to 3.7.0 across affected packages: @apostrophecms/import-export.
What version fixes CVE-2026-113664?
Upgrading to 3.7.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @apostrophecms/import-export affected?
Yes, @apostrophecms/import-export is affected in releases prior to 3.7.0. Upgrade your dependency to 3.7.0 or later.
What CWE is associated with CVE-2026-113664?
CVE-2026-113664 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check npm dependencies for CVE-2026-113664?
Run the dependency tree command: 'npm ls @apostrophecms/import-export'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-97wv-p4xx-c7mg",
  "modified" : "2026-10-20T18:23:42Z",
  "published" : "2026-10-20T18:23:42Z",
  "aliases" : [ "CVE-2026-113664" ],
  "summary" : "ApostropheCMS import-export tar guard misses './..' because it is a literal '../' substring test",
  "details" : "### Summary\n\nThe tar-extraction guard added to `@apostrophecms/import-export` for GHSA-mwxc-m426-3f78 is a literal substring test for `../`, and `./..` does not contain that substring. An entry named `./..` therefore passes the guard, `path.join` normalizes it to the parent of the export directory, and the resulting `fs.WriteStream` opens a directory and emits `EISDIR` with no `error` listener attached, which terminates the Node process.\n\nConfirmed on default-branch HEAD `1bd5d0a7a6fe880836fa75adad6964f1c577d640`, package version `3.6.2`.\n\n### Details\n\n`packages/import-export/lib/formats/gzip.js`, in the tar-stream `entry` handler inside `extract(filepath, exportPath)`:\n\n```js\nconst name = header.name.replace(/\\\\/g, '/');\nif (name.includes('../')) {\n  // skipped\n}\n...\nstream.pipe(fs.WriteStream(path.join(exportPath, name)));\n```\n\nTwo separate problems sit in those four lines. The guard tests the raw entry name for a substring instead of resolving the joined path and requiring containment, and the write stream has no `error` handler, so any stream error becomes an unhandled `'error'` event.\n\nReaching it needs an account that can import, nothing more. `packages/import-export/modules/@apostrophecms/import-export-page/index.js` exposes `post.importExportImport`, which calls into `lib/methods/import.js`; that handler requires `req.user` and then calls `format.input(exportPath)`, which for a `.gz` upload is `gzip.js` calling `extract()` on the uploaded archive.\n\n### PoC\n\nThis is not an end-to-end exploit. What follows is each of the three primitives the crash depends on, executed individually, plus a source-level trace of the route. The chain from `post.importExportImport` to `extract()` was read, not observed.\n\nThe guard misses the payload:\n\n```bash\nnode -e \"console.log('./..'.includes('../')); console.log('..'.includes('../')); console.log('a/./..'.includes('../'));\"\n```\n\n```text\nfalse\nfalse\nfalse\n```\n\n`path.join` then resolves it out of the export directory:\n\n```bash\nnode -e \"const path=require('path'); const exportPath='/tmp/exportRoot'; console.log(path.join(exportPath,'./..'));\"\n```\n\n```text\n/tmp\n```\n\nAnd a write stream opened on a directory, with no `error` listener, kills the process rather than failing the request:\n\n```bash\nnode -e \"const fs=require('fs'); const s=fs.createWriteStream('/tmp'); s.write('x'); s.end(); setTimeout(()=>console.log('still alive'),500);\"\n```\n\n```text\nevents.js:291\n      throw er; // Unhandled 'error' event\n      ^\n\nError: EISDIR: illegal operation on a directory, open '/tmp'\nEmitted 'error' event on WriteStream instance at:\n    at internal/fs/streams.js:361:12\n    at FSReqCallback.oncomplete (fs.js:156:23) {\n  errno: -21,\n  code: 'EISDIR',\n  syscall: 'open',\n  path: '/tmp'\n}\n```\n\nThe `events.js:291` frame shows that transcript came off the Node 14 line my audit box had. The unhandled-`error`-event behavior is not version specific, but the exact message on your supported Node versions is worth a re-run.\n\nSource-side confirmation without running anything:\n\n```bash\ngrep -n \"includes('../')\" packages/import-export/lib/formats/gzip.js\ngrep -n \"WriteStream\" packages/import-export/lib/formats/gzip.js\n```\n\n### Impact\n\nAn authenticated user who can reach the import UI uploads one crafted archive and takes down the Node process handling it. Every worker that picks up such an archive dies the same way.\n\n### Suggested fix\n\nResolve the target and require containment, and attach an error handler:\n\n```js\nconst base = path.resolve(exportPath);\nconst target = path.resolve(path.join(exportPath, name));\n\nif (target !== base && !target.startsWith(base + path.sep)) {\n  stream.on('end', next);\n  stream.resume();\n  return;\n}\n\nif (header.type === 'directory') {\n  fsp.mkdir(target).then(next).catch(reject);\n} else {\n  const out = fs.WriteStream(target);\n  out.on('error', reject);\n  stream.pipe(out);\n  stream.on('end', next);\n}\n```\n\nThe error handler earns its place independently. Any tar entry that lands on an existing directory name has the same effect whether or not traversal is involved.\n\n### Why this is not GHSA-mwxc-m426-3f78\n\nThe `name.includes('../')` check is the mitigation shipped for GHSA-mwxc-m426-3f78 / CVE-2026-32731. It stops names carrying the literal `../` sequence. It does not canonicalize the joined path, so `./..` and a bare `..` still get through, and it did not touch the missing `error` listener. This report is about what the substring test leaves behind.\n\n\nAI assistance was used for the code audit and drafting. The exact guard and `WriteStream` lines in `packages/import-export/lib/formats/gzip.js` at the stated HEAD were manually verified, the import route from the page module through `lib/methods/import.js` into the entry handler were manually traced, and the three Node one-liners were manually ran and copied verbatim.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@apostrophecms/import-export"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.7.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/apostrophecms/apostrophe/security/advisories/GHSA-97wv-p4xx-c7mg"
  }, {
    "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/import-export@3.7.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-10-20T18:23:42Z",
    "nvd_published_at" : null
  }
}