/

CVE-2026-22249

Severity:

HIGH RISK

(7.1)

Path Traversal / ZipSlip in Docmost Zip Import Feature

CVE-2026-22249

Analyzed

Vulnerability type

Category:

Path Traversal / ZipSlip

CWE:

CWE-22

Impact:

Arbitrary File Write

Severity:

HIGH RISK

(7.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Docmost's zip import feature in versions 0.21.0 through 0.23.x contains a path traversal flaw that allows files from a user-supplied ZIP archive to be written outside the intended import directory.

When exploited, an attacker-controlled ZIP can overwrite arbitrary files on the server's filesystem within the privileges of the Docmost process, potentially leading to data loss or further compromise.

Affected context

The vulnerability occurs in Docmost's server-side ZIP import logic located in apps/server/src/integrations/import/utils/file.utils.ts for versions 0.21.0 to before 0.24.0.

It arises when the application extracts user-provided ZIP archives without validating or sanitizing the embedded filenames or paths.

Any deployment that allows authenticated or unauthenticated users to upload/import ZIP files, and processes them using this utility, may be exposed depending on access controls and deployment configuration.

Exploit preconditions

  • Attack surface: Server-side ZIP import endpoint or feature that processes user-supplied archives.
  • Required access: Ability to upload or submit a ZIP file to the Docmost instance (typically via an import UI or API).
  • Trigger point: Invoking the import functionality that unpacks ZIP entries using attacker-controlled filenames.
  • Why exploitation is possible: The code uses entry names from the ZIP archive directly when writing files to disk, without normalizing or checking for path traversal sequences (e.g., ../) or absolute paths. This allows files to be created or overwritten outside the intended import directory.

Why this happens

The core issue is a missing validation and normalization step for filenames extracted from ZIP archives, which maps directly to CWE-22: Path Traversal and the well-known ZipSlip pattern.

Instead of constraining extracted paths to a designated base directory, the implementation trusts the archive's internal paths, allowing special sequences and absolute paths to influence where files are written.

This insecure pattern lets attackers escape the intended extraction directory and write to arbitrary filesystem locations reachable by the Docmost server process.

Potential impact

  • Overwriting application or configuration files that the Docmost process can write to.
  • Placing malicious files (e.g., scripts, assets) in web-accessible directories, potentially enabling code execution depending on the stack and configuration.
  • Corrupting or deleting documentation content and related data by overwriting important files.
  • Tampering with logs, temporary files, or other resources to conceal malicious activity or degrade system reliability.

General mitigation guidance

Effective mitigation focuses on enforcing strict path controls and treating archive contents as untrusted input:

  • Normalize and resolve each ZIP entry path against a predefined, application-controlled base directory before writing.
  • Reject entries that attempt path traversal (e.g., contain .., drive letters, or absolute paths) or resolve outside the intended import directory.
  • Use filesystem APIs or helper functions that safely join and canonicalize paths, then verify that the canonical path remains within the allowed root.
  • Limit the Docmost process to least-privilege filesystem rights so that even if an issue occurs, reachable files are minimized.
  • Consider enforcing size and file type constraints on imported content to reduce the attack surface and resource abuse.

How teams detect issues like this

Detection efforts can combine code-level analysis with runtime monitoring:

  • Static analysis: Search for ZIP extraction code or filesystem writes that use archive entry names directly without normalization or boundary checks. Rules can flag any use of raw filenames derived from user-controlled ZIPs.
  • Code review: During review of import or backup/restore features, look for missing validation of file paths, absence of checks for .. segments, and lack of canonical path verification against a base directory.
  • Policy enforcement: Introduce secure coding guidelines for archive processing and path handling, and enforce them via CI checks or pre-merge security gates.
  • Runtime monitoring: Monitor logs and filesystem events for suspicious write patterns, such as unexpected file creation outside import directories during ZIP processing.

Sources

SourceLink
github.comgithub.com/docmost/docmost/commit/c3b350d943108552e20654580005cd6f6c78ab05
github.comgithub.com/docmost/docmost/pull/1753
github.comgithub.com/docmost/docmost/releases/tag/v0.24.0
github.comgithub.com/docmost/docmost/security/advisories/GHSA-54pm-hqxm-54wg

Frequently asked

questions

Exploitability depends on who can access the ZIP import feature. If normal users or external parties can upload ZIP files, the risk is higher; if access is limited to trusted administrators, the practical exposure is reduced but still significant.

An attacker generally needs the ability to submit or upload a ZIP archive to the Docmost instance via the import functionality. No direct shell access is required, but any authentication or role requirements for using the import feature will constrain who can exploit it.

The safest approach is to treat all ZIP entry names as untrusted: normalize paths, ensure they remain within a specific import directory, and reject any entry that resolves outside that directory or contains disallowed patterns. Combining this with least-privilege filesystem permissions further reduces risk.

Adopt a standard pattern for archive extraction and path handling across the codebase: centralize safe extraction logic, enforce canonical path checks, document security requirements for file operations, and incorporate static analysis or security review steps focusing on file I/O and import/export features.

Find out what's already
exploitable in your codebase.