/

CVE-2025-57231

Severity:

HIGH RISK

(7.5)

Path Traversal (CWE-22) in Docmost Avatar Attachments

CVE-2025-57231

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Unauthenticated Local File Disclosure

Severity:

HIGH RISK

(7.5)

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 v0.21.0 contains a path traversal vulnerability in avatar attachment handling that may allow unauthenticated attackers to read local files.

The issue becomes risky when a public avatar-related endpoint accepts attacker-controlled file paths without sufficiently restricting them to the intended attachment directory.

Affected context

The vulnerability occurs in Docmost v0.21.0 when avatar attachments are processed through a publicly accessible URL. If user-controlled path information is not constrained to the designated attachment storage location, a remote unauthenticated actor may cause the application to access files outside that directory.

Exploit preconditions

  • Attack surface: Public avatar attachment functionality and its associated POST request
  • Required access: No authentication may be required when the public URL is reachable
  • Trigger point: Processing an attacker-influenced attachment path or filename
  • Why exploitation is possible: Insufficient path normalization and directory confinement may allow references to resolve outside the intended storage directory

Why this happens

The underlying bug is improper restriction of user-controlled filesystem paths. When an application combines or resolves an input path without canonicalizing it and verifying that the resulting location remains within an approved directory, traversal sequences or equivalent path representations may escape the expected boundary.

This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, commonly known as path traversal.

Potential impact

  • An unauthenticated attacker may disclose sensitive local files
  • Application configuration or credential material could be exposed
  • Internal source code or operational data may be retrieved
  • Disclosed information could support follow-on attacks against the application or host

General mitigation guidance

Mitigation generally focuses on removing filesystem path trust from public request parameters and enforcing strong directory boundaries.

Common defensive patterns include:

  • Resolve requested paths to canonical form before access
  • Verify that resolved paths remain within an approved attachment directory
  • Prefer opaque server-generated file identifiers over client-supplied paths
  • Apply strict allowlists for attachment names and supported file types
  • Keep sensitive files outside web-accessible and attachment directories
  • Run the application with the minimum filesystem permissions required
  • Return uniform errors that do not reveal filesystem structure

How teams detect issues like this

Organizations can identify path traversal risks through:

  • Static analysis rules for filesystem APIs receiving request-derived values
  • Code review checks for path joining without canonicalization and containment validation
  • Tests covering encoded, normalized, and alternate path representations
  • Web application firewall or gateway policies that flag traversal indicators
  • Access-log monitoring for unusual requests to public attachment endpoints
  • Automated security review tools that correlate user input with file access operations

Sources

SourceLink
github.comgithub.com/docmost/docmost/blob/0bd7ecb9b03a74e9a5e3f97b6457b82371c5ceb2/apps/server/src/core/attachment/attachment.controller.ts#L345
artresilia.comartresilia.com/docmost-v0-21-0-cve-2025-57231-unauthenticated-file-path-traversal/

Frequently asked

questions

Yes. The description indicates that the affected avatar attachment functionality is exposed through a public URL, so exploitation may be possible over the network without local access.

Not necessarily. The reported issue describes an unauthenticated attack path, although deployment-specific access controls may affect exposure.

Avoid accepting client-controlled filesystem paths. Use server-managed identifiers, canonicalize any derived paths, and verify that every resolved path remains within the intended attachment directory.

Apply least-privilege filesystem permissions, keep sensitive files outside upload and attachment locations, validate inputs with allowlists, and include traversal-focused tests and static analysis in the development process.

Find out what's already
exploitable in your codebase.