Summary
A file extraction validation flaw in elFinder can allow an attacker with ZIP upload permission to place PHP-executable files in a web-accessible directory.
If the web server executes relevant PHP extensions, the attacker may achieve remote code execution through the extracted file.
Affected context
The issue occurs in elFinder deployments that permit ZIP uploads and extraction into a web-accessible files/ directory. It becomes risky when the server executes PHP-related extensions and MIME validation relies on incomplete extension mappings, allowing executable files to bypass upload-deny rules during extraction.
Exploit preconditions
- Attack surface: elFinder's ZIP upload and extraction functionality
- Required access: Permission to upload ZIP archives
- Trigger point: Extraction of archive entries into the managed files directory
- Why exploitation is possible: MIME detection does not apply normalization before the extraction allow check, so certain PHP extensions may evade rules intended to block PHP content
Why this happens
The vulnerability results from inconsistent MIME-type handling between file detection and policy enforcement. checkExtractItems() calls internal MIME detection without applying the normalization step that maps several PHP-related extensions to text/x-php. As a result, allowPutMime() may approve files that upload-deny rules would otherwise reject. This maps to CWE-434: Unrestricted Upload of File with Dangerous Type, because executable content can be placed in a web-accessible location without reliable type validation.
Potential impact
- An attacker may execute arbitrary PHP code on the server
- The web application and managed files may be compromised
- Stored files or application data could be modified or deleted
- Credentials and other server-side secrets could be exposed
- The host may be used for lateral movement or further compromise
General mitigation guidance
Mitigation generally focuses on ensuring that archive extraction follows the same trusted validation rules as direct uploads.
Common defensive patterns include:
- Applying canonical MIME and extension normalization before every allow or deny decision
- Treating archive contents as untrusted input and validating each extracted entry
- Storing uploaded and extracted files outside web-executable directories where feasible
- Disabling script execution in upload and file-management directories
- Allowlisting permitted file types instead of relying only on deny rules
- Enforcing least-privilege permissions for the web server and managed storage
- Preventing archive paths from bypassing destination and content policies
How teams detect issues like this
Organizations can look for this class of issue through:
- Static analysis rules identifying inconsistent MIME normalization across upload and extraction paths
- Code review checks for archive extraction that bypasses ordinary upload validation
- Tests covering uncommon executable extensions and alternate MIME representations
- Web-server policy checks confirming that upload directories cannot execute scripts
- Monitoring for ZIP extraction followed by requests to newly created script-like files
- Policy enforcement requiring allowlisted file types and non-executable storage locations
Automated security review tools may help identify dangerous file handling and archive-processing patterns.

