CVE-2021-23394
published 2021-06-13CVE-2021-23394: The package studio-42/elfinder before 2.1.58 are vulnerable to Remote Code Execution (RCE) via execution of PHP code in a .phar file. NOTE: This only applies…
PriorityP183critical9.8CVSS 3.1
AVNACLPRNUINSUCHIHAH
ITWEXPLOITVulnCheck KEV
Exploited in the wild
EPSS
19.08%
97.0th percentile
The package studio-42/elfinder before 2.1.58 are vulnerable to Remote Code Execution (RCE) via execution of PHP code in a .phar file. NOTE: This only applies if the server parses .phar files as PHP.
Affected
3 ranges
| Vendor | Product | Version range | Fixed in |
|---|---|---|---|
| std42 | elfinder | < 2.1.58 | 2.1.58 |
| studio-42 | elfinder | >= 0 < 2.1.58 | 2.1.58 |
| studio-42 | elfinder | >= unspecified < 2.1.58 | 2.1.58 |
Detection & IOCsextracted from sources · hover to see the quote
path/elFinder/files/{{filename}}.phar
- →Detect elFinder RCE probe by checking for JSON response containing all three fields: 'isowner', 'phash', and 'changed' with content-type application/json and HTTP 200
- →Exploitation involves uploading and executing a .phar file under the elFinder files directory; monitor for GET requests to .phar files under /elFinder/files/
- →Successful RCE is confirmed when the HTTP response body contains the MD5 hash of the attacker-controlled payload string, indicating PHP code execution via .phar file
- →The vulnerability only applies when the server is configured to parse .phar files as PHP; audit server configuration for .phar PHP handler associations ↗
- ·CVE-2021-23394 RCE via .phar file execution is only exploitable if the web server is configured to parse .phar files as PHP; not universally applicable to all elFinder deployments ↗
- ·Affected versions are studio-42/elfinder before 2.1.58; deployments on 2.1.58 or later are not vulnerable ↗
CVSS provenance
nvdv3.19.8CRITICALCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
nvdv2.06.8MEDIUMAV:N/AC:M/Au:N/C:P/I:P/A:P
vulncheck8.1HIGH
CVEs like this are exactly what “Exploited This Week” covers.
Every Monday: what got weaponized or added to CISA KEV in the last seven days — each CVE cross-linked to its PoC, Nuclei template, and detection rule. Free, one email a week, unsubscribe in one click.
GHSA
elFinder unsafe upload filtering leading to remote code execution
ghsa·2021-06-15
CVE-2021-23394 [HIGH] CWE-434 elFinder unsafe upload filtering leading to remote code execution
elFinder unsafe upload filtering leading to remote code execution
### Impact
Before elFinder 2.1.58, the upload filter did not disallow the upload of `.phar` files. As several Linux distributions are now shipping Apache configured in a way it will process these files as PHP scripts, attackers could gain arbitrary code execution on the server hosting the PHP connector (even in minimal configuration).
### Patches
The issue has been addressed with https://github.com/Studio-42/elFinder/commit/75ea92decc16a5daf7f618f85dc621d1b534b5e1, associating `.phar` files to the right MIME type. Unless explicitly allowed in the configuration, such files cannot be uploaded anymore. This patch is part of the last release of elFinder, 2.1.58.
### Workarounds
If you can't update to 2.1.58, make sure your
OSV
elFinder unsafe upload filtering leading to remote code execution
osv·2021-06-15
CVE-2021-23394 [HIGH] elFinder unsafe upload filtering leading to remote code execution
elFinder unsafe upload filtering leading to remote code execution
### Impact
Before elFinder 2.1.58, the upload filter did not disallow the upload of `.phar` files. As several Linux distributions are now shipping Apache configured in a way it will process these files as PHP scripts, attackers could gain arbitrary code execution on the server hosting the PHP connector (even in minimal configuration).
### Patches
The issue has been addressed with https://github.com/Studio-42/elFinder/commit/75ea92decc16a5daf7f618f85dc621d1b534b5e1, associating `.phar` files to the right MIME type. Unless explicitly allowed in the configuration, such files cannot be uploaded anymore. This patch is part of the last release of elFinder, 2.1.58.
### Workarounds
If you can't update to 2.1.58, make sure your
VulnCheck
std42 elfinder Unrestricted Upload of File with Dangerous Type
vulncheck·2021·CVSS 8.1
CVE-2021-23394 [HIGH] std42 elfinder Unrestricted Upload of File with Dangerous Type
std42 elfinder Unrestricted Upload of File with Dangerous Type
The package studio-42/elfinder before 2.1.58 are vulnerable to Remote Code Execution (RCE) via execution of PHP code in a .phar file. NOTE: This only applies if the server parses .phar files as PHP.
Affected: std42 elfinder
Required Action: Apply remediations or mitigations per vendor instructions or discontinue use of the product if remediation or mitigations are unavailable.
Exploitation References: https://www.f5.com/labs/articles/threat-intelligence/sensor-intel-series-top-cves-august-2024; https://www.f5.com/labs/articles/threat-intelligence/botpoke-scanner-switches-ip; https://www.f5.com/labs/articles/threat-intelligence/continued-scanning-for-cve-2023-1389; https://app.crowdsec.net/cti/cve-explorer/CVE-2021-23394
No detection rules found.
Nuclei
elFinder < 2.1.58 - Remote Code Execution
nuclei·CVSS 9.8
CVE-2021-23394 [CRITICAL] elFinder < 2.1.58 - Remote Code Execution
elFinder HTTP/1.1
Host: {{Hostname}}
Accept: application/json
matchers:
- type: dsl
dsl:
- contains_all(body, 'isowner', 'phash', 'changed')
- contains(content_type, 'application/json')
- status_code == 200
condition: and
internal: true
- raw:
- |
GET /elFinder/files/{{filename}}.phar HTTP/1.1
Host: {{Hostname}}
matchers:
- type: word
part: body
words:
- "{{md5(payload_str)}}"
# digest: 4a0a00473045022067bd70a709f9b934923cc0df00336730f18650e79ef73c4aa997e167eb7ff786022100bfc0f5c66befc59d91f0dbbc7c22959fba2e9df3246db2e969ff7f9f2d03f66e:922c64590222798bb761d5b6d8e72950
https://blog.sonarsource.com/elfinder-case-study-of-web-file-manager-vulnerabilities/https://github.com/Studio-42/elFinderhttps://github.com/Studio-42/elFinder/commit/75ea92decc16a5daf7f618f85dc621d1b534b5e1https://github.com/Studio-42/elFinder/issues/3295https://snyk.io/vuln/SNYK-PHP-STUDIO42ELFINDER-1290554https://blog.sonarsource.com/elfinder-case-study-of-web-file-manager-vulnerabilities/https://github.com/Studio-42/elFinderhttps://github.com/Studio-42/elFinder/commit/75ea92decc16a5daf7f618f85dc621d1b534b5e1https://github.com/Studio-42/elFinder/issues/3295https://snyk.io/vuln/SNYK-PHP-STUDIO42ELFINDER-1290554
2021-06-13
Published
Exploited in the wild