MS04-007: ASN.1 Vulnerability Could Allow Code Execution (828028) (uncredentialed check) (HTTP) - Nessus

High   Plugin ID: 12055

This page contains detailed information about the MS04-007: ASN.1 Vulnerability Could Allow Code Execution (828028) (uncredentialed check) (HTTP) Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 12055
Name: MS04-007: ASN.1 Vulnerability Could Allow Code Execution (828028) (uncredentialed check) (HTTP)
Filename: http_asn1_decoding.nasl
Vulnerability Published: 2004-02-10
This Plugin Published: 2004-02-15
Last Modification Time: 2018-11-15
Plugin Version: 1.55
Plugin Type: remote
Plugin Family: Windows
Dependencies: http_version.nasl
Required KB Items [?]: www/iis

Vulnerability Information


Severity: High
Vulnerability Published: 2004-02-10
Patch Published: 2004-02-10
CVE [?]: CVE-2003-0818
CPE [?]: cpe:/o:microsoft:windows

Synopsis

The remote Windows host is affected by a memory corruption vulnerability.

Description

The remote Windows host has an ASN.1 library with a vulnerability that could allow an attacker to execute arbitrary code on this host.

To exploit this flaw, an attacker would need to send a specially crafted ASN.1 encoded packet with improperly advertised lengths.

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

Solution

Apply the patch referenced above.

Public Exploits


Target Network Port(s): 80
Target Asset(s): Services/www
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 MS04-007: ASN.1 Vulnerability Could Allow Code Execution (828028) (uncredentialed check) (HTTP) 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: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 http_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 web NTML authentication.
#
# Credit for original advisory and blob: eEye
#


include("compat.inc");

if(description)
{
 script_id(12055);
 script_version ("1.55");

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

 script_name(english:"MS04-007: ASN.1 Vulnerability Could Allow Code Execution (828028) (uncredentialed check) (HTTP)");

 script_set_attribute(attribute:"synopsis", value:
"The remote Windows host is affected by a memory corruption
vulnerability." );
 script_set_attribute(attribute:"description", value:
"The remote Windows host has an ASN.1 library with a vulnerability that
could allow an attacker to execute arbitrary code on this host.

To exploit this flaw, an attacker would need to send a specially
crafted ASN.1 encoded packet with improperly advertised lengths.

This particular check sent a malformed HTML 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:"see_also", value:"https://seclists.org/bugtraq/2004/Feb/269" );
 script_set_attribute(attribute:"solution", value:
"Apply the patch referenced above." );
 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:'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:"plugin_publication_date", value: "2004/02/15");
 script_set_attribute(attribute:"vuln_publication_date", value: "2004/02/10");
 script_cvs_date("Date: 2018/11/15 20:50:27");
 script_set_attribute(attribute:"patch_publication_date", value: "2004/02/10");
 script_set_attribute(attribute:"plugin_type", value:"remote");
 script_set_attribute(attribute:"cpe", value:"cpe:/o:microsoft:windows");
 script_end_attributes();

 script_summary(english:"Checks if the remote host has a patched ASN.1 decoder (828028)");
 script_category(ACT_GATHER_INFO);
 script_copyright(english:"This script is Copyright (C) 2004-2018 Tenable Network Security, Inc.");
 script_family(english:"Windows");
 script_require_ports("Services/www", 80); 
 script_dependencies("http_version.nasl");
 script_require_keys("www/iis");
 exit(0);
}

#

include("global_settings.inc");
include("misc_func.inc");
include("http.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_http_port(default:80);

banner = get_http_banner(port:port);
if ( ! banner ) exit(1, "No HTTP banner on port "+port+".");
if ( "IIS" >!< banner ) exit(0, "Server on port "+port+" is not IIS.");


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



req = string("GET / HTTP/1.1\r\n",
"Authorization: Negotiate ", blob, "\r\n",
"Host: ", get_host_name(), "\r\n\r\n");

r = http_send_recv3(method:"GET", item: "/", port: port, 
  username: "", password: "", add_headers: make_array("Negociate", blob));
# Vulnerable -> WWW-Authenticate: Negotiate xxxxx\r\n
# Not vulnerable -> WWW-Authenticate: Negotiate\r\n
if (egrep(pattern:"WWW-Authenticate: Negotiate [a-zA-Z0-9\+/=]+$", string:r[1]))
{
 security_hole(port);
}

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

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

Go back to menu.

How to Run


Here is how to run the MS04-007: ASN.1 Vulnerability Could Allow Code Execution (828028) (uncredentialed check) (HTTP) 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 Windows plugin family.
  6. On the right side table select MS04-007: ASN.1 Vulnerability Could Allow Code Execution (828028) (uncredentialed check) (HTTP) plugin ID 12055.
  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 http_asn1_decoding.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

/opt/nessus/bin/nasl -a http_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 - http_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 http_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:
  • 12065 - ASN.1 Multiple Integer Overflows (SMTP check)
  • 12052 - MS04-007: ASN.1 parsing vulnerability (828028)
  • 12054 - MS04-007: ASN.1 Vulnerability Could Allow Code Execution (828028) (uncredentialed check) (NTLM)
  • 92539 - HTTP_PROXY Environment Variable Namespace Collision Vulnerability (httpoxy)
  • 10498 - Web Server HTTP Dangerous Method Detection
  • 10930 - Multiple Web Server on Windows MS/DOS Device Request Remote DOS
  • 15572 - MS04-031: Vulnerability NetDDE Could Allow Code Execution (841533) (uncredentialed check)
  • 12209 - MS04-011: Security Update for Microsoft Windows (835732) (uncredentialed check)
  • 15970 - MS04-035: WINS Code Execution (870763) (uncredentialed check)
  • 12205 - MS04-011: Microsoft Hotfix (credentialed check) (835732)
  • 15456 - MS04-031: Vulnerability in NetDDE Could Allow Code Execution (841533)
  • 15963 - MS04-044: Vulnerabilities in Windows Kernel and LSASS (885835)
  • 15962 - MS04-045: WINS Code Execution (870763)

Version


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

Go back to menu.