ASN.1 Multiple Integer Overflows (SMTP check) - Nessus

Critical   Plugin ID: 12065

This page contains detailed information about the ASN.1 Multiple Integer Overflows (SMTP check) Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 12065
Name: ASN.1 Multiple Integer Overflows (SMTP check)
Filename: mail_asn1_decoding.nasl
Vulnerability Published: 2004-02-10
This Plugin Published: 2004-02-18
Last Modification Time: 2018-11-15
Plugin Version: 1.40
Plugin Type: remote
Plugin Family: SMTP problems
Dependencies: smtpscan.nasl, smtpserver_detect.nasl

Vulnerability Information


Severity: Critical
Vulnerability Published: 2004-02-10
Patch Published: 2004-02-10
CVE [?]: CVE-2003-0818
CPE [?]: N/A

Synopsis

The remote host has multiple integer overflow vulnerabilities.

Description

The remote Windows host has an ASN.1 library with multiple integer overflow vulnerabilities. These issues could lead to a heap-based buffer overflow. A remote attacker could exploit these issues to execute arbitrary code.

This particular check sent a malformed SMTP authorization packet and determined that the remote host is not patched.

Solution

Microsoft has released a set of patches for Windows NT, 2000, XP, and 2003.

Public Exploits


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

Here's the list of publicly known exploits and PoCs for verifying the ASN.1 Multiple Integer Overflows (SMTP check) vulnerability:

  1. Metasploit: exploit/windows/smb/ms04_007_killbill
    [MS04-007 Microsoft ASN.1 Library Bitstring Heap Overflow]
  2. Exploit-DB: exploits/windows/remote/16377.rb
    [EDB-16377: Microsoft Windows - ASN.1 Library Bitstring Heap Overflow (MS04-007) (Metasploit)]
  3. Immunity Canvas: CANVAS

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:C/I:C/A:C/E:F/RL:OF/RC:C
CVSS Base Score:10.0 (High)
Impact Subscore:10.0
Exploitability Subscore:10.0
CVSS Temporal Score:8.3 (High)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:8.3 (High)

Go back to menu.

Plugin Source


This is the mail_asn1_decoding.nasl nessus plugin source code. This script is Copyright (C) 2004-2018 Tenable Network Security, Inc.

#
# (C) Tenable Network Security, Inc.
#

#
# Thanks to Juliano Rizzo <[email protected]> for suggesting to do
# the check using SMTP NTLM authentication.
#
# Credit for the original advisory and blob : eEye
#

include("compat.inc");

if (description)
{
 script_id(12065);
 script_version("1.40");
 script_cvs_date("Date: 2018/11/15 20:50:24");

 script_bugtraq_id(9633, 9635, 9743, 13300);
 script_cve_id("CVE-2003-0818");
 script_xref(name:"MSFT", value:"MS04-007");
 script_xref(name:"MSKB", value:"828028");

 script_name(english:"ASN.1 Multiple Integer Overflows (SMTP check)");
 script_summary(english:"Checks if the remote host has a patched ASN.1 decoder (828028)");

 script_set_attribute(
   attribute:"synopsis",
   value:"The remote host has multiple integer overflow vulnerabilities."
 );
 script_set_attribute( attribute:"description", value:
"The remote Windows host has an ASN.1 library with multiple integer
overflow vulnerabilities.  These issues could lead to a heap-based
buffer overflow.  A remote attacker could exploit these issues to
execute arbitrary code.

This particular check sent a malformed SMTP authorization packet and
determined that the remote host is not patched." );
 script_set_attribute(attribute:"see_also", value:"https://docs.microsoft.com/en-us/security-updates/SecurityBulletins/2004/ms04-007");
 script_set_attribute(
   attribute:"solution",
   value:
"Microsoft has released a set of patches for Windows NT, 2000, XP, and
2003."
 );
 script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:C/I:C/A:C");
 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:'MS04-007 Microsoft ASN.1 Library Bitstring Heap Overflow');
 script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");
 script_set_attribute(attribute:"exploit_framework_canvas", value:"true");
 script_set_attribute(attribute:"canvas_package", value:'CANVAS');

 script_set_attribute(attribute:"vuln_publication_date", value:"2004/02/10");
 script_set_attribute(attribute:"patch_publication_date", value:"2004/02/10");
 script_set_attribute(attribute:"plugin_publication_date", value:"2004/02/18");

 script_set_attribute(attribute:"plugin_type", value:"remote");
 script_end_attributes();

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

 script_copyright(english:"This script is Copyright (C) 2004-2018 Tenable Network Security, Inc.");

 script_require_ports("Services/smtp", 25);
 script_dependencies("smtpserver_detect.nasl", "smtpscan.nasl");

 exit(0);
}

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


function gssapi(oid, spenego)
{
 local_var len;
 len = strlen(oid) + strlen(spenego);
 return raw_string(0x60, 0x84,0,0,0,len % 256) + oid + spenego;
}

# Returns SPNEGO OID (1.3.6.5.5.2)
function oid()
{
 local_var oid, len;
 oid = raw_string(0x2b, 0x06, 0x01, 0x05, 0x05, 0x02);
 len = strlen(oid);
 return raw_string(0x06, 0x83,0,0,len % 256) + oid;
}


# ANS.1 encodes our negTokenInit blob
function spenego(negTokenInit)
{
 local_var len;
 len = strlen(negTokenInit);

 return raw_string(0xa0, 0x82,0,len % 256) + negTokenInit;
}


# ASN.1 encodes our mechType and mechListMIC
function negTokenInit(mechType, mechListMIC)
{
 local_var len, len2, data, data2;

 len = strlen(mechType);
 data = raw_string(0xa0, len + 2, 0x30, len);
 len += strlen(data) + strlen(mechListMIC) + 8;

 len2 = strlen(mechListMIC);
 data2 = raw_string(0xa3, len2 + 6, 0x30, len2 + 4, 0xa0, len2 - 8 , 0x3b, 0x2e);


 return raw_string(0x30,0x81,len % 256) + data + mechType + data2 + mechListMIC;
}

# Returns OID 1.3.6.1.4.1.311.2.2.10 (NTMSSP)
function mechType()
{
 return raw_string(0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x02, 0x0a);
}

function mechListMIC()
{
 local_var data;

 data = raw_string(0x04, 0x81, 0x01, 0x25) +
       	raw_string(0x24, 0x81, 0x27) +
        	raw_string(0x04, 0x01, 0x00, 0x24, 0x22, 0x24, 0x20, 0x24,
			   0x18, 0x24, 0x16, 0x24, 0x14, 0x24, 0x12, 0x24,
			   0x10, 0x24, 0x0e, 0x24, 0x0c, 0x24, 0x0a, 0x24,
			   0x08, 0x24, 0x06, 0x24, 0x04, 0x24, 0x02, 0x04,
			   0x00, 0x04, 0x82, 0x00, 0x02, 0x39, 0x25)  +
        	raw_string(0xa1, 0x08) +
       			raw_string(0x04, 0x06) +
				"Nessus";

 return data;
}




port = get_kb_item("Services/smtp");
if ( ! port ) port = 25;
if ( ! get_port_state(port) ) exit(0);


sig = get_kb_item("smtp/" + port + "/real_banner");
if (! sig ) sig = get_smtp_banner(port:port);

if ( sig && "Microsoft" >!< sig ) exit(0);


blob = base64(str:gssapi(oid:oid(), spenego:spenego(negTokenInit:negTokenInit(mechType:mechType(), mechListMIC:mechListMIC()))));

soc = open_sock_tcp(port);
if ( ! soc ) exit(0);
smtp_recv_line(socket:soc);
send(socket:soc, data:'EHLO there\r\n');
smtp_recv_line(socket:soc);
send(socket:soc, data:'AUTH GSSAPI\r\n');
r = smtp_recv_line(socket:soc);
if ( egrep(pattern:"^334 .*", string:r) )
{
 send(socket:soc, data:blob + '\r\n');
 r = smtp_recv_line(socket:soc);
 if ( egrep(pattern:"^334 .*", string:r ) ) { security_hole(port); }
}

close(soc);

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

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

Go back to menu.

How to Run


Here is how to run the ASN.1 Multiple Integer Overflows (SMTP check) 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 ASN.1 Multiple Integer Overflows (SMTP check) plugin ID 12065.
  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 mail_asn1_decoding.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

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

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

/opt/nessus/bin/nasl -T - mail_asn1_decoding.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 mail_asn1_decoding.nasl -t <IP/HOST>

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: MSKB | Microsoft Knowledge Base: MSFT | Microsoft Security Bulletin:
  • MS04-007
See also: Similar and related Nessus plugins:
  • 12055 - MS04-007: ASN.1 Vulnerability Could Allow Code Execution (828028) (uncredentialed check) (HTTP)
  • 12052 - MS04-007: ASN.1 parsing vulnerability (828028)
  • 12054 - MS04-007: ASN.1 Vulnerability Could Allow Code Execution (828028) (uncredentialed check) (NTLM)
  • 88593 - Cisco Security Manager 4.9.x < 4.9(0.397) / 4.10.x < 4.10(0.189) OpenSSL ASN.1 Signature Handling DoS
  • 15231 - Debian DSA-394-1 : openssl095 - ASN.1 parsing vulnerability
  • 59989 - Juniper Junos OpenSSL ASN.1 Memory Corruption (PSN-2012-07-645)
  • 17753 - OpenSSL < 0.9.7c ASN.1 Decoding Vulnerabilities
  • 58799 - OpenSSL < 0.9.8w ASN.1 asn1_d2i_read_bio Memory Corruption
  • 58800 - OpenSSL 1.0.0 < 1.0.0i ASN.1 asn1_d2i_read_bio Memory Corruption
  • 58801 - OpenSSL 1.0.1 < 1.0.1a ASN.1 asn1_d2i_read_bio Memory Corruption
  • 88809 - Tenable SecurityCenter OpenSSL ASN.1 Signature Verification Routine DoS (TNS-2016-01)
  • 11875 - OpenSSL ASN.1 Parser Multiple Remote DoS
  • 30123 - Citadel SMTP makeuserkey Function RCPT TO Command Remote Overflow
  • 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
  • 51179 - Exim string_format Function Remote Overflow
  • 22314 - Ipswitch IMail Server SMTP Service Crafted RCPT String Remote Overflow
  • 53534 - IBM Lotus Domino iCalendar Email Address ORGANIZER:mailto Header Remote Overflow
  • 15902 - MailCarrier < 3.0.1 SMTP EHLO Command Remote Overflow
  • 25928 - Mercury SMTP Server AUTH CRAM-MD5 Remote Buffer Overflow
  • 11499 - Sendmail < 8.12.9 NOCHAR Control Value prescan Overflow
  • 11316 - Sendmail headers.c crackaddr Function Address Field Handling Remote Overflow
  • 11838 - Sendmail < 8.12.10 prescan() Function Remote Overflow
  • 11593 - SLMail < 5.1.0.4433 Multiple Command Remote Overflows

Version


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

Go back to menu.