Summary
CI4MS versions prior to 0.28.5.0 allow an authenticated user with file editor permissions to create and save arbitrary PHP files on the server.
By abusing the file creation and save endpoints, an attacker can upload and execute PHP code, resulting in full remote code execution under the web server's privileges.
Affected context
The vulnerability appears in CI4MS deployments that expose the built-in file editor feature to authenticated users.
Specifically, instances where users with file editor or similar elevated permissions can:
- Create new files via HTTP endpoints
- Save arbitrary content to those files within web-accessible directories
- Reach those files via the web server to trigger execution
The issue is relevant wherever the CMS runs with PHP execution enabled in directories that are writable by the application and accessible over HTTP.
Exploit preconditions
- Attack surface: Web-based administrative file editor endpoints in the CI4MS backend
- Required access: Authenticated account with file editor permissions or equivalent ability to write files via the CMS
- Trigger point: Creation and saving of a file containing attacker-controlled PHP code in a directory that the web server executes and serves
- Why exploitation is possible: The file editor functionality does not sufficiently restrict file types, content, or write locations, allowing server-executable PHP code to be written into web-accessible paths (CWE-94 and CWE-434).
Why this happens
The core issue is that the application's file editor functionality trusts authenticated users with editor permissions to write arbitrary content to the filesystem without proper constraints.
From a vulnerability-class perspective, this combines:
- CWE-94: Improper Control of Generation of Code ('Code Injection') — user-controlled input is allowed to become executable PHP code on the server.
- CWE-434: Unrestricted Upload of File with Dangerous Type — the system permits the creation of files of dangerous types (e.g.,
.php) in locations where they will be executed by the web server.
The abstract insecure pattern is: a web-accessible, server-executable directory is writable by an application feature that accepts untrusted input, and no robust policy enforces safe file types, content, or separation between editable resources and executable code.
Potential impact
- Execution of arbitrary PHP code on the server with the web server's permissions
- Full compromise of the CMS, including reading and modifying content and configuration
- Credential theft, session hijacking, or installation of web shells and backdoors
- Lateral movement to adjacent systems or databases accessible from the compromised server
- Data exfiltration or tampering, including defacement and content manipulation
General mitigation guidance
Effective mitigation focuses on separating content editing from executable code, tightening file operations, and minimizing privileges:
- Restrict the file editor to non-executable directories (e.g., templates or static assets that are not interpreted as PHP).
- Enforce strict allowlists for file extensions and paths, disallowing creation or modification of
.phpand other server-executable types through the editor. - Apply content validation and filtering where appropriate, avoiding acceptance of direct code constructs in locations that may be interpreted by the server.
- Run the web application and web server under least-privilege accounts, and avoid granting them write access to directories where executable code is served.
- Consider disabling the file editor in production or limiting it to highly trusted administrative workflows with additional approvals or out-of-band deployment processes.
- Use defense-in-depth controls such as segregating writable directories from the web root and configuring the web server to treat those directories as non-executable.
How teams detect issues like this
Organizations can look for this class of issue through both code-centric and operational lenses:
- Static analysis and code review:
- Flag endpoints that write to the filesystem based on user-supplied parameters (file name, path, content).
- Identify any controller or service that allows creation or editing of files under the web root or other executable directories.
- Review permission checks around file-editing features to ensure they are narrow and role-appropriate.
- Configuration and policy checks:
- Enforce policies that writable directories must not be configured as executable in the web server.
- Periodically scan the web root for unexpected executable files (e.g., new
.phpfiles) created at runtime. - Runtime monitoring:
- Log and monitor use of file editor endpoints, including file paths and extensions being created or updated.
- Alert on suspicious patterns such as sudden creation of PHP files in unusual locations or spikes in file-editor activity.
- Automated security testing and code review tools may assist by flagging risky file-write patterns and unsafe upload/editor logic during CI.

