Summary
Cockpit CMS 2.6.0 permits authenticated users to upload files with arbitrary extensions through the asset upload endpoint. Because uploaded files may be stored in a web-accessible directory, an attacker could upload a PHP webshell and execute operating-system commands on the server.
Affected context
The vulnerability occurs in Cockpit CMS asset upload functionality when the
allowed_uploads setting permits all file extensions, including server-side
script files. Risk is increased when uploaded assets are stored beneath a
web-accessible directory and the web server is configured to execute uploaded
scripts.
Exploit preconditions
- Attack surface: The authenticated asset upload endpoint
- Required access: Any authenticated Cockpit CMS account with upload capability
- Trigger point: Uploading a file through the asset management workflow
- Why exploitation is possible: Extension filtering permits executable
server-side scripts, and uploaded files may be directly reachable through the
web server
Why this happens
The underlying bug is unrestricted acceptance of user-controlled files without
enforcing a narrow, security-focused allowlist of permitted types. Treating a
wildcard upload policy as safe allows executable content to enter a web-accessible
location. This maps to CWE-434: Unrestricted Upload of File with Dangerous Type, where the application fails to sufficiently restrict the type or use of
uploaded files.
Potential impact
- An attacker may execute arbitrary operating-system commands
- The CMS application or hosting account could be compromised
- Sensitive files and application data may be accessed or modified
- Malicious content could be used for persistence or further compromise
- Other users or systems may be affected through server-side lateral movement
General mitigation guidance
Mitigation generally focuses on reducing trust in uploaded content and ensuring
that user-controlled files cannot become executable server resources.
Common defensive patterns include:
- Replacing wildcard extension policies with a narrow allowlist based on business needs
- Validating file type using independent content checks rather than filenames alone
- Storing uploads outside the web root or serving them through a non-executing download handler
- Applying server configuration that disables script execution in upload directories
- Generating controlled filenames and preventing path manipulation
- Restricting upload permissions and running the application with least privilege
- Enforcing size, content, and resource limits for uploaded files
How teams detect issues like this
Organizations can look for this weakness through:
- Static analysis rules that identify wildcard upload allowlists and direct file writes
- Code review checks for user-controlled filenames, extensions, and upload destinations
- Policy enforcement requiring uploads to use non-executable storage locations
- Runtime monitoring for script files or unexpected extensions appearing in asset directories
- Web server and application logs showing uploads followed by requests to newly created files
- Automated security review tools that flag unrestricted upload and executable-content risks

