/

CVE-2025-50857

Severity:

CRITICAL RISK

(9.8)

Directory Traversal in ZenTaoPMS AI Module File Handling

CVE-2025-50857

Awaiting Analysis

Vulnerability type

Category:

Directory Traversal

CWE:

CWE-22

Impact:

Arbitrary Code Execution on Server

Severity:

CRITICAL RISK

(9.8)

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

A directory traversal flaw in ZenTaoPMS v18.11 through v21.6.beta within /module/ai/control.php allows crafted file uploads to write files outside the intended directory.

Under certain configurations, this can be abused to place executable code in web-accessible or interpreted locations, enabling arbitrary code execution on the server.

Affected context

The vulnerability exists in ZenTaoPMS deployments running versions v18.11 through v21.6.beta that expose the AI module functionality (/module/ai/control.php) and accept file uploads.

It is most relevant where:

  • Uploaded files are written to the filesystem using paths influenced by user input, and
  • The web server or associated runtime can execute or interpret files from directories reachable via traversal (e.g., web roots, script directories, or include paths).

Exploit preconditions

  • Attack surface: HTTP(S) interface of the ZenTaoPMS application, specifically the AI module handling uploads.
  • Required access: Ability to reach the affected endpoint and submit file uploads (may be authenticated or unauthenticated depending on deployment configuration and access controls).
  • Trigger point: Submission of a crafted upload request containing path traversal sequences (such as ../) or similarly malformed path components that control where the file is stored.
  • Why exploitation is possible: The server-side path construction in control.php concatenates or otherwise incorporates user-controlled filename or path elements without normalizing or restricting them to a fixed, safe directory, allowing writes outside the intended upload location.

Why this happens

The underlying issue is improper restriction of filesystem paths derived from user input, matching CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

In this pattern, the application constructs file system paths based on values supplied by the client (filenames, target paths, or derived parameters) without robust normalization and enforcement that the final resolved path remains within a designated directory.

When combined with file upload handling, this allows an attacker to store files in arbitrary locations, which can escalate to code execution if those locations are interpreted as executable scripts or are later included by the application.

Potential impact

  • Placement of arbitrary files on the server filesystem in attacker-chosen locations
  • Execution of attacker-controlled code if files are stored in executable or interpreted directories
  • Overwriting of existing files that the web server user can access (e.g., configuration files, templates, or scripts)
  • Escalation from web-layer compromise to full application takeover
  • Pivoting to broader server compromise depending on the privileges of the ZenTaoPMS process

General mitigation guidance

Effective mitigation focuses on removing direct user control over filesystem paths and constraining uploads to safe, non-executable locations.

Recommended defensive patterns include:

  • Path canonicalization and enforcement: Resolve, normalize, and canonicalize any path derived from user input, and strictly verify that the resulting path remains inside a pre-defined, application-controlled upload directory before writing.
  • Use of fixed upload directories: Map user uploads to server-generated filenames and fixed directories, avoiding any use of client-provided directories, path fragments, or extensions for path construction.
  • Non-executable storage: Store uploaded files outside web-executable roots or script-interpretation paths, and configure the web server to treat upload directories as data-only.
  • Filename and extension controls: Remove or strictly filter dangerous extensions and characters, rejecting any input containing traversal tokens or ambiguous encodings.
  • Least privilege execution: Run the application and web server with minimal filesystem permissions so that even if traversal is attempted, sensitive or critical system locations are not writable.

How teams detect issues like this

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

  • Static analysis: Scan for filesystem operations (e.g., file write APIs) where the destination path includes user-controlled input, especially in upload handlers or modules like /module/ai/control.php. Flag any use of ../-prone concatenation patterns without canonicalization and directory checks.
  • Code review cues: During manual reviews, focus on upload controllers and AI-related modules, verifying that paths are derived from server-side constants, not client parameters, and that directory boundaries are enforced.
  • Policy-based checks: Implement secure coding standards that prohibit using raw request parameters directly in path construction, and enforce these rules through automated linting or CI checks.
  • Runtime monitoring and logs: Inspect server logs for suspicious upload requests containing traversal sequences or unusual file destinations, and use WAF or reverse proxy rules to flag or block such patterns where possible.

Sources

SourceLink
gist.github.comgist.github.com/sorzs/c67a3dcaa9adb49266d5ff52a04d904b
github.comgithub.com/sorzs/test/blob/main/read_and_delete

Frequently asked

questions

Yes. An attacker who can reach the vulnerable upload functionality can attempt exploitation remotely via crafted HTTP(S) requests, subject to any authentication or access controls in place.

That depends on how ZenTaoPMS and the AI module are deployed. If the upload endpoint requires authentication, the attacker would need access to a user account or another way to reach that endpoint. If exposed without authentication, exploitation could be attempted anonymously.

The most robust fix is to decouple user input from filesystem paths: store uploads only in fixed, server-controlled directories using generated filenames, apply strict path normalization and directory boundary checks, and ensure upload directories are configured as non-executable data storage locations.

Establish and enforce a design rule that no user input is ever used directly to construct filesystem paths. Combine this with secure upload handling patterns, least-privilege filesystem permissions, and automated checks in development pipelines to catch path traversal and unsafe file handling before deployment.

Find out what's already
exploitable in your codebase.