CVE-2020–29607: Remote Code Execution Via File Upload Restriction Bypass In Pluck CMS ≤ 4.7.13 [Authenticated]
Web Application Description
Pluck CMS
Pluck is a small and simple content management system (CMS), written in PHP. With Pluck, you can easily manage your own website. Pluck focuses on simplicity and ease of use. This makes Pluck an excellent choice for every small website. Licensed under the General Public License (GPL), Pluck is completely open source. This allows you to do with the software whatever you want, as long as the software stays open source.
Vulnerability
File Upload Restriction Bypass in Pluck CMS ≤ 4.7.13 allows an admin privileged user to gain access in the host through the “manage files” functionality, which result in remote code execution.
Vulnerable Endpoint
/admin.php?action=files
Vulnerable Code
Restrictions
Blacklisting PHP Extensions: In above-shown code of data/inc/files.php
, At line 44, the application is assigning a list of blacklist PHP file extensions in blockedExtentions
variable which is then used to restrict a user to upload files with these extensions. If the user tries to upload the file with these extensions then the application appends .txt
to the file name before uploading to the files
directory of the system.
Restricting PHP Execution Through .htaccess: In above-shown content of files/.htaccess
, The developer sets the SetHandler
to None
for the .php
& .phtml
PHP file extensions, so that a user can not execute .php
& .phtml
PHP files from the files
upload directory. Also, the developer disabled CGI execution from the files
upload directory.
Attack Vector
- Bypassing .htaccess Restriction: In order to bypass
.htaccess
restriction, An adversary can use any PHP extensions other than.php
&.phtml
such as.php5
,.php7
,.pht
, etc. - Bypassing Blacklisting of PHP Extensions: In order to bypass blacklisting of PHP extensions, An adversary can use any extension other than extensions mentioned in code. So for the Proof Of Concept, we used
.phar
PHP extension.
Note: For the proof of concept, we used
.phar
PHP extension through which we can bypass both the above restrictions.
Proof of Concept
Implemented Mitigations In Pluck CMS 4.7.15
- Blacklist of
.phar
PHP extension. - Adding
php_flag engine off
in.htaccess
file to disable PHP execution fromfiles
upload directory.
Disclosure Timeline
Reported to the Vendor: 1st Dec 2020
CVE Assigned: 9th Dec 2020
CVE Published: 16th Dec 2020
CVSS Score As Per NIST NVD
CVSS Version 3.x Base Score: 7.2 HIGH
CVSS Version 2.0 Base Score: 6.5 MEDIUM
References
If you enjoyed reading my article do clap and follow on Medium & Twitter:
Twitter: https://twitter.com/loopspell
LinkedIn: https://www.linkedin.com/in/ankitkushwah/