GHSA-vcx7-pfrh-mcfg: storyblok-backup: Stored path traversal via unsanitized Storyblok component names in backup output
- Source:
- OSV.dev
- Published:
- Fetched:
- Updated:
- Affects:
- storyblok-backup
https://osv.dev/vulnerability/GHSA-vcx7-pfrh-mcfg ↗
storyblok-backup: Stored path traversal via unsanitized Storyblok component names in backup output ### Summary storyblok-backup writes files using unsanitized names for Storyblok components, which are content type or schema definitions. This allows a component name containing path traversal sequences to cause backup files to be written outside the intended backup directory. Anyone with component management access in the source Storyblok space, not server access, can plant a malicious component name that causes arbitrary file writes on the machine of anyone who later runs a backup against that space. ### Details The writeJson function, which takes a folder, a file name, and content, builds the output file path by directly concatenating the backup directory, the folder, and the file name as strings, with no path sanitization or containment check. For the components resource type specifically, the file name used is the component's own name field, which is free text and editable by anyone with component management access in the Storyblok CMS. Other resource types are not affected by this same issue. Stories and datasources use their numeric IDs as filenames, and assets have their filename derived by splitting on the slash character and taking the last segment, which strips path separators. This issue is scoped specifically to components. Since the component name is stored in Storyblok and only read back later when the backup tool runs, this is a stored, second order vulnerability. The malicious value is planted once, then triggers on every subsequent backup run performed by anyone using this tool against that Storyblok space. ### PoC **Step 1 — plant the malicious component name via Storyblok's Management API:** curl -X POST "https://mapi.storyblok.com/v1/spaces/ /components/" \ -H "Authorization: " \ -H "Content-Type: application/json" \ -d '{ "component": { "name": "../../../../tmp/evil-storyblok-backup", "schema": {} } }' Any Storyblok user with component-management permission in the space (not server access to wherever backups run) can do this through the Storyblok UI just as easily, by naming a new component with this value in the component name field. **Step 2 — run storyblok-backup against this space, exactly as a normal user would:** npx storyblok-backup \ --space \ --token \ --path ./backup \ --types "components" **Step 3 — observe the actual file write location:** With the malicious component name above, the tool's writeJson() function builds the output path as: backupDir + "/components" + "/../../../../tmp/evil-storyblok-backup" + ".json" which resolves outside ./backup entirely. Confirm with: ls -la /tmp/evil-storyblok-backup.json The file exists there, outside the --path ./backup directory that was configured, containing the full JSON definition of the malicious component. **Step 4 — for comparison, confirm assets and stories are NOT affected:** The same defaultFetch() pattern is used for stories and datasources ( Affected: npm:storyblok-backup Fixed in: 0.7.1 References: https://github.com/webflorist/storyblok-backup/security/advisories/GHSA-vcx7-pfrh-mcfg https://nvd.nist.gov/vuln/detail/CVE-2026-115565 https://github.com/webflorist/storyblok-backup/commit/f4e4bb1979832abd7e4eb1666e2b3cfc767f587a https://github.com/webflorist/storyblok-backup https://github.com/webflorist/storyblok-backup/releases/tag/v0.7.1