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.phpconcatenates 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.

