Summary
Malcolm's file-upload component accepts files without enforcing an effective extension allow-list, allowing an authenticated upload-capable user to submit PHP code. Because uploaded files are stored in a web-served directory and PHP requests are forwarded to php-fpm, the code may execute as the web-service account when requested.
Affected context
The vulnerability occurs in Malcolm deployments using the FilePond PHP upload backend with the associated nginx and php-fpm configuration. Risk is present when the upload allow-list is empty or otherwise ineffective, uploaded files retain executable extensions, and the storage directory is both web-accessible and configured to process PHP files. In RBAC mode, access may be available to users assigned the granular upload-only role.
Exploit preconditions
- Attack surface: The authenticated file-upload endpoint at
/server/php/submit.php - Required access: A valid account with the upload-capable permission, such as the granular upload role in affected RBAC configurations
- Trigger point: A subsequent authenticated request for an uploaded file under the web-served files directory
- Why exploitation is possible: The default type restriction does not reject PHP extensions, the filename handling preserves the extension, and nginx routes matching PHP files to php-fpm
Why this happens
The underlying issue is an unrestricted file-upload condition mapped to CWE-434: Unrestricted Upload of File with Dangerous Type. The component treats an empty extension allow-list as if it were a restrictive policy, allowing executable server-side files to be stored in a directory that is directly served by the same application stack. This combines insufficient content and filename validation with an unsafe storage and execution boundary.
Potential impact
- An authenticated upload-authorized user may execute arbitrary PHP code as
www-data - The file-upload container could be compromised
- Application data or captured network artifacts could be accessed or altered
- The attacker could use the compromised container to attempt credential access or lateral movement
- Service integrity and availability could be affected
General mitigation guidance
Mitigation generally focuses on separating uploaded content from executable application content and enforcing a deny-by-default upload policy.
Common defensive patterns include:
- Store uploads outside web roots or on a separate non-executable service
- Enforce a non-empty, explicit allow-list of permitted types and extensions
- Validate file content using trusted server-side inspection rather than relying only on client metadata
- Generate server-side filenames and remove executable extensions from stored objects
- Configure web servers to serve uploaded content as inert data and never pass the upload directory to PHP handlers
- Apply least-privilege permissions to the upload process and container
- Require authorization checks that match the sensitivity of the upload operation
How teams detect issues like this
Detection approaches can include:
- Static analysis for empty or optional upload allow-lists and extension checks based only on user-controlled filenames
- Code review of upload paths, filename normalization, storage locations, and web-server handler mappings
- Configuration policy checks ensuring upload directories are outside executable document roots
- Runtime monitoring for PHP or other server-side script files appearing in upload directories
- Web and application logs correlating upload requests with later requests for uploaded files
- Automated security review tools that flag unrestricted uploads and executable content handling

