Skip to content

elFinder: ZIP extraction bypasses uploadDeny MIME filter allowing PHP file upload (RCE)

High severity GitHub Reviewed Published Aug 3, 2026 in Studio-42/elFinder • Updated Sep 2, 2026

Package

composer Studio-42/elFinder (Composer)

Affected versions

< 2.1.70

Patched versions

2.1.70

Description

Summary

elFinder provides uploadDeny and uploadAllow options in its connector configuration to restrict which MIME types may be uploaded. When uploadDeny includes text/x-php, direct upload of .php, .phtml, and .phar files is correctly blocked. However, the extract command (ZIP decompression) internally calls checkExtractItems(), which invokes mimetypeInternalDetect() directly without passing the result through mimeTypeNormalize(). Because phtml, phar, and similar PHP-executable extensions are absent from mime.types, they are not resolved to text/x-php at the detection stage, causing the MIME filter to be silently bypassed. An attacker who is permitted to upload ZIP archives can therefore extract PHP-executable files into the web-accessible files/ directory. If the server is configured to execute the affected extension (e.g., .phtml, .phar) as PHP — which is the case in common Apache and Nginx deployments — this results in Remote Code Execution.


Details

elFinder's MIME validation pipeline for direct uploads (upload command) is:

mimetype()
  └─ mimetypeInternalDetect()   // stage 1: extension → MIME via mime.types
  └─ mimeTypeNormalize()        // stage 2: apply staticMimeMap
       phtml:* → text/x-php
       phar:*  → text/x-php
       php5:*  → text/x-php
  └─ allowPutMime()             // blocked: text/x-php ∈ uploadDeny

The extract command (checkExtractItems() in elFinderVolumeDriver.class.php, line 7110) uses a shortened pipeline:

// line 7110 — stage 2 (mimeTypeNormalize) is never called
if ($chkMime
    && ($mimeByName = elFinderVolumeDriver::mimetypeInternalDetect($name))
    && !$this->allowPutMime($mimeByName)) {

Because phtml and phar are not present in mime.types, mimetypeInternalDetect() returns a generic type (e.g., application/octet-stream) for these extensions. Without mimeTypeNormalize(), the staticMimeMap entries that would map phtml:*text/x-php are never applied, so allowPutMime() sees a non-blocked MIME and permits extraction.

Affected extensions confirmed: .phtml, .phar, .php5, .php3
Not bypassed: .php (present in mime.types, detected as text/x-php in stage 1)


PoC

Requirements:

  • elFinder 2.1.69 deployed under Apache/Nginx (PHP-FPM or mod_php)
  • Connector configured with uploadDeny = ['text/x-php'] and uploadAllow including application/zip
  • files/ directory served under a public web path

Step 1 — Confirm direct upload is blocked
Open elFinder in a browser and click the Upload button.
Select hello.phtml (content: <?php phpinfo(); ?>).
→ Upload is rejected with: "Upload file hello.phtml: File type not allowed (text/x-php)"
1

Step 2 — Upload a ZIP containing the payload
Create bypass.zip containing hello.phtml.
Upload bypass.zip via the Upload button.
→ ZIP is accepted (MIME: application/zipuploadAllow).
2

Step 3 — Extract the ZIP
Right-click bypass.zip in the file list → Extract files.
hello.phtml appears in the file list without any error.
→ File is now present at {files_dir}/hello.phtml on the server.
3

Step 4 — Execute the extracted PHP file

Navigate to:

http://<target>/elFinder/files/hello.phtml

→ Apache processes the file as PHP and renders the full phpinfo() output, confirming Remote Code Execution.


4

Impact

Any user with ZIP upload permission can bypass the uploadDeny MIME restriction, place PHP-executable files in a web-accessible directory, and achieve Remote Code Execution on the server.

Concrete impact:

  • Arbitrary PHP code execution on the web server
  • Full server environment disclosure via phpinfo() (paths, PHP version, loaded modules, environment variables)
  • Potential access to server filesystem, database credentials, and internal network services
  • Complete compromise of the web application if an attacker substitutes phpinfo() with a web shell (e.g., <?php system($_GET['cmd']); ?>)

Extensions confirmed executable on Apache (default config):
phtml, phar, php5, php3

Recommended fix:

Apply mimeTypeNormalize() inside checkExtractItems() so that the full MIME pipeline is used consistently:

// elFinderVolumeDriver.class.php, line 7110
// Before (vulnerable):
$mimeByName = elFinderVolumeDriver::mimetypeInternalDetect($name)

// After (fixed):
$mimeByName = $this->mimeTypeNormalize(
    elFinderVolumeDriver::mimetypeInternalDetect($name),
    $name,
    pathinfo($name, PATHINFO_EXTENSION)
)


References

@nao-pon nao-pon published to Studio-42/elFinder Aug 3, 2026
Published by the National Vulnerability Database Aug 31, 2026
Published to the GitHub Advisory Database Sep 2, 2026
Reviewed Sep 2, 2026
Last updated Sep 2, 2026

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
High
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H

EPSS score

Exploit Prediction Scoring System (EPSS)

This score estimates the probability of this vulnerability being exploited within the next 30 days. Data provided by FIRST.
(43rd percentile)

Weaknesses

Unrestricted Upload of File with Dangerous Type

The product allows the upload or transfer of dangerous file types that are automatically processed within its environment. Learn more on MITRE.

CVE ID

CVE-2026-81891

GHSA ID

GHSA-gxmj-r5rf-ggwq

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.