webasyst / webasyst-framework

Webasyst PHP Framework
http://www.webasyst.com/
GNU Lesser General Public License v3.0
291 stars 202 forks source link

Insecure file upload - Code execution #370

Open emaragkos opened 1 year ago

emaragkos commented 1 year ago

The web application does not allow file uploads with dangerous extensions such as .php

image

webasyst-framework-master\wa-system\controller\waUploadJsonController.class.php

image

The above filtering is insufficient since it is possible to upload files with extensions that will be executed such as .phar

image

image

image

Tested on version: 2.7.2.732

Leonix commented 1 year ago

Thank you very much for your report.

Please explain which server environment are you running? .phar should not be executable by web server. It is not executable by default in Apache configurations that I know of.

Is this a default configuration for some common server setup? Are there other executable extensions besides .phar in this setup?

Anyway, it is probably a good idea to deny .phar uploading via web file manager. And possibly even to disable PHP execution inside wa-data/public/site directory. Thank you again for your vigilance :)

emaragkos commented 1 year ago

Its a LAMP environment that uses a default Vesta Panel deployment and the installation of webasyst was automated through Softaculous. I assume it is something default with this setup because I haven't made any modifications to allow such extensions to be executed. Either way as you already mentioned, I absolutely agree, nothing should be executed from wa-data/public/site and .phar extensions shouldn't be allowed either.

symbioticphp commented 1 year ago

Вообще сделайте белый список, так будет проще, а кому надо будут включать в него нужные им расширения в конфиге.