Mercury SMTP Server AUTH CRAM-MD5 Remote Buffer Overflow - Nessus

High   Plugin ID: 25928

This page contains detailed information about the Mercury SMTP Server AUTH CRAM-MD5 Remote Buffer Overflow Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 25928
Name: Mercury SMTP Server AUTH CRAM-MD5 Remote Buffer Overflow
Filename: mercury_smtp_auth_cram_md5_overflow.nasl
Vulnerability Published: N/A
This Plugin Published: 2007-08-23
Last Modification Time: 2018-08-22
Plugin Version: 1.19
Plugin Type: remote
Plugin Family: SMTP problems
Dependencies: smtpserver_detect.nasl

Vulnerability Information


Severity: High
Vulnerability Published: N/A
Patch Published: N/A
CVE [?]: CVE-2007-4440
CPE [?]: N/A

Synopsis

The remote mail server is affected by a buffer overflow vulnerability.

Description

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.

Solution

Upgrade to Mercury/32 v4.52 or later or apply the 4.01c / 1.49 security patch.

Public Exploits


Target Network Port(s): 25
Target Asset(s): Services/smtp
Exploit Available: True (Metasploit Framework, Exploit-DB, Core Impact)
Exploit Ease: Exploits are available

Here's the list of publicly known exploits and PoCs for verifying the Mercury SMTP Server AUTH CRAM-MD5 Remote Buffer Overflow vulnerability:

  1. Metasploit: exploit/windows/smtp/mercury_cram_md5
    [Mercury Mail SMTP AUTH CRAM-MD5 Buffer Overflow]
  2. Exploit-DB: exploits/windows/dos/4294.pl
    [EDB-4294: Mercury/32 Mail SMTPD - Remote Stack Overrun (PoC)]
  3. Exploit-DB: exploits/windows/remote/16821.rb
    [EDB-16821: Mercury/32 Mail SMTPD - AUTH CRAM-MD5 Buffer Overflow (Metasploit)]

Before running any exploit against any system, make sure you are authorized by the owner of the target system(s) to perform such activity. In any other case, this would be considered as an illegal activity.

WARNING: Beware of using unverified exploits from sources such as GitHub or Exploit-DB. These exploits and PoCs could contain malware. For more information, see how to use exploits safely.

Risk Information


CVSS V2 Vector [?]: AV:N/AC:L/Au:N/C:P/I:P/A:P/E:F/RL:OF/RC:C
CVSS Base Score:7.5 (High)
Impact Subscore:6.4
Exploitability Subscore:10.0
CVSS Temporal Score:6.2 (Medium)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:6.2 (Medium)

Go back to menu.

Plugin Source


This is the mercury_smtp_auth_cram_md5_overflow.nasl nessus plugin source code. This script is Copyright (C) 2007-2018 and is owned by Tenable, Inc. or an Affiliate thereof.

#
# (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);

The latest version of this script can be found in these locations depending on your platform:

  • Linux / Unix:
    /opt/nessus/lib/nessus/plugins/mercury_smtp_auth_cram_md5_overflow.nasl
  • Windows:
    C:\ProgramData\Tenable\Nessus\nessus\plugins\mercury_smtp_auth_cram_md5_overflow.nasl
  • Mac OS X:
    /Library/Nessus/run/lib/nessus/plugins/mercury_smtp_auth_cram_md5_overflow.nasl

Go back to menu.

How to Run


Here is how to run the Mercury SMTP Server AUTH CRAM-MD5 Remote Buffer Overflow as a standalone plugin via the Nessus web user interface (https://localhost:8834/):

  1. Click to start a New Scan.
  2. Select Advanced Scan.
  3. Navigate to the Plugins tab.
  4. On the top right corner click to Disable All plugins.
  5. On the left side table select SMTP problems plugin family.
  6. On the right side table select Mercury SMTP Server AUTH CRAM-MD5 Remote Buffer Overflow plugin ID 25928.
  7. Specify the target on the Settings tab and click to Save the scan.
  8. Run the scan.

Here are a few examples of how to run the plugin in the command line. Note that the examples below demonstrate the usage on the Linux / Unix platform.

Basic usage:

/opt/nessus/bin/nasl mercury_smtp_auth_cram_md5_overflow.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

/opt/nessus/bin/nasl -a mercury_smtp_auth_cram_md5_overflow.nasl -t <IP/HOST>

Run the plugin with trace script execution written to the console (useful for debugging):

/opt/nessus/bin/nasl -T - mercury_smtp_auth_cram_md5_overflow.nasl -t <IP/HOST>

Run the plugin with using a state file for the target and updating it (useful for running multiple plugins on the target):

/opt/nessus/bin/nasl -K /tmp/state mercury_smtp_auth_cram_md5_overflow.nasl -t <IP/HOST>

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: CWE | Common Weakness Enumeration:
  • CWE-119 (Weakness) Improper Restriction of Operations within the Bounds of a Memory Buffer
See also: Similar and related Nessus plugins:
  • 24785 - Mercury IMAP Server LOGIN Command Remote Overflow
  • 26067 - Mercury IMAP Server SEARCH Command Remote Buffer Overflow
  • 15867 - Mercury Mail Remote IMAP Server Remote Overflow
  • 20812 - Mercury Mail ph Server Remote Overflow
  • 24910 - TestDirector (TD) for Mercury Quality Center SPIDERLib.Loader ActiveX Control (Spider90.ocx) ProgColor Property Overflow (2)
  • 24909 - TestDirector (TD) for Mercury Quality Center SPIDERLib.Loader ActiveX Control (Spider90.ocx) ProgColor Property Overflow
  • 24327 - Mercury LoadRunner Agent server_ip_name Field Remote Buffer Overflow
  • 46255 - HP Mercury LoadRunner Agent Remote Command Execution
  • 11889 - Exchange XEXCH50 Remote Buffer Overflow
  • 107149 - Exim < 4.90.1 Buffer Overflow RCE Vulnerability
  • 129470 - Exim 4.92.x < 4.92.3 Heap Buffer Overflow

Version


This page has been produced using Nessus Professional 10.1.2 (#68) LINUX, Plugin set 202205072148.
Plugin file mercury_smtp_auth_cram_md5_overflow.nasl version 1.19. For more plugins, visit the Nessus Plugin Library.

Go back to menu.