Microsoft SQL Server Authentication Function Remote Overflow - Nessus

High   Plugin ID: 11067

This page contains detailed information about the Microsoft SQL Server Authentication Function Remote Overflow Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 11067
Name: Microsoft SQL Server Authentication Function Remote Overflow
Filename: mssql_hello_overflow.nasl
Vulnerability Published: 2002-08-05
This Plugin Published: 2002-08-07
Last Modification Time: 2022-04-11
Plugin Version: 1.41
Plugin Type: remote
Plugin Family: Databases
Dependencies: mssqlserver_detect.nasl, mssql_version.nasl
Required KB Items [?]: Settings/ParanoidReport

Vulnerability Information


Severity: High
Vulnerability Published: 2002-08-05
Patch Published: N/A
CVE [?]: CVE-2002-1123
CPE [?]: cpe:/a:microsoft:sql_server

Synopsis

The remote database server is affected by a remote command execution vulnerability.

Description

The remote Microsoft SQL server is vulnerable to the Hello overflow.

An attacker may use this flaw to execute commands against the remote host as LOCAL/SYSTEM, as well as read your database content.

*** This alert might be a false positive.

Solution

Apply the patch from the Microsoft Bulletin.

Public Exploits


Target Network Port(s): 1433
Target Asset(s): Services/mssql
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 Microsoft SQL Server Authentication Function Remote Overflow vulnerability:

  1. Metasploit: exploit/windows/mssql/ms02_056_hello
    [MS02-056 Microsoft SQL Server Hello Overflow]
  2. Exploit-DB: exploits/windows/remote/16398.rb
    [EDB-16398: Microsoft SQL Server - Hello Overflow (MS02-056) (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 mssql_hello_overflow.nasl nessus plugin source code. This script is Copyright (C) 2002-2022 Dave Aitel

#%NASL_MIN_LEVEL 70300
##
# Script audit and contributions from Carmichael Security <http://www.carmichaelsecurity.com>
#      Erik Anderson <[email protected]>
#      Added BugtraqID
#
# this script tests for the "You had me at hello" overflow
# in MSSQL (tcp/1433)
# Copyright Dave Aitel (2002)
# Bug found by: Dave Aitel (2002)
#
##
#TODO:
#techically we should also go to the UDP 1434 resolver service
#and get any additional ports!!!

# Changes by Tenable:
# - Revised plugin title (6/8/09)
# - Add MSKB script_xref (8/29/17)

include('deprecated_nasl_level.inc');
include('compat.inc');

if (description)
{
  script_id(11067);
  script_version("1.41");
  script_set_attribute(attribute:"plugin_modification_date", value:"2022/04/11");

  script_cve_id("CVE-2002-1123");
  script_bugtraq_id(5411);
  script_xref(name:"MSFT", value:"MS02-056");
  script_xref(name:"MSKB", value:"316333");
  script_xref(name:"MSKB", value:"327068");

  script_name(english:"Microsoft SQL Server Authentication Function Remote Overflow");

  script_set_attribute(attribute:"synopsis", value:
"The remote database server is affected by a remote command execution
vulnerability.");
  script_set_attribute(attribute:"description", value:
"The remote Microsoft SQL server is vulnerable to the Hello overflow.

An attacker may use this flaw to execute commands against the remote
host as LOCAL/SYSTEM, as well as read your database content.

*** This alert might be a false positive.");
  # http://web.archive.org/web/20031204044027/http://support.microsoft.com/default.aspx?scid=kb;en-us;Q316333&sd=tech
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?32a9c483");
  script_set_attribute(attribute:"see_also", value:"https://docs.microsoft.com/en-us/security-updates/SecurityBulletins/2002/ms02-056");
  script_set_attribute(attribute:"see_also", value:"https://seclists.org/bugtraq/2002/Aug/106");
  script_set_attribute(attribute:"solution", value:
"Apply the patch from the Microsoft Bulletin.");
  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:'MS02-056 Microsoft SQL Server Hello 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:"2002/08/05");
  script_set_attribute(attribute:"plugin_publication_date", value:"2002/08/07");

  script_set_attribute(attribute:"potential_vulnerability", value:"true");
  script_set_attribute(attribute:"plugin_type", value:"remote");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:microsoft:sql_server");
  script_set_attribute(attribute:"thorough_tests", value:"true");
  script_end_attributes();

  script_category(ACT_DESTRUCTIVE_ATTACK);
  script_family(english:"Databases");

  script_copyright(english:"This script is Copyright (C) 2002-2022 Dave Aitel");

  script_dependencies("mssqlserver_detect.nasl", "mssql_version.nasl");
  script_require_keys("Settings/ParanoidReport");
  script_require_ports(1433, "Services/mssql");

  exit(0);
}

include("audit.inc");
include("global_settings.inc");

if (report_paranoia < 2) audit(AUDIT_PARANOID);

ver_list = get_kb_list("mssql/installs/*/SQLVersion");
if (ver_list)
{
  do_check = FALSE;
  foreach item (keys(ver_list))
  {
    version = get_kb_item(item);
    if (!isnull(version) && ereg(pattern:"^8\.00\.(0?[0-5][0-9][0-9]|0?6[0-5][0-9]|66[0-4])", string:version))
    {
      do_check = TRUE;
      break;
    }
  }
  if (!do_check) exit(0, 'No potentially vulnerable installs of Microsoft SQL Server were detected.');
}

#
# The script code starts here
#
#taken from mssql.spk
pkt_hdr = raw_string(
0x12 ,0x01 ,0x00 ,0x34 ,0x00 ,0x00 ,0x00 ,0x00  ,0x00 ,0x00 ,0x15 ,0x00 ,0x06 ,0x01 ,0x00 ,0x1b
,0x00 ,0x01 ,0x02 ,0x00 ,0x1c ,0x00 ,0x0c ,0x03  ,0x00 ,0x28 ,0x00 ,0x04 ,0xff ,0x08 ,0x00 ,0x02
,0x10 ,0x00 ,0x00 ,0x00
);

#taken from mssql.spk
pkt_tail = raw_string (
0x00 ,0x24 ,0x01 ,0x00 ,0x00
);

#techically we should also go to the UDP 1434 resolver service
#and get any additional ports!!!
port = get_kb_item("Services/mssql");
if(!port)port = 1433;

found = 0;
report = "The Microsoft SQL Server install is vulnerable to the Hello overflow.";


if(get_port_state(port))
{
    soc = open_sock_tcp(port);

    if(soc)
    {
    	#uncomment this to see what normally happens
        #attack_string="MSSQLServer";
	#uncomment next line to actually test for overflow
	attack_string=crap(560);
        # this creates a variable called sql_packet
	sql_packet = string(pkt_hdr,attack_string,pkt_tail);
	send(socket:soc, data:sql_packet);
        r  = recv(socket:soc, length:4096);
	close(soc);
	#display ("Result:",r,"\n");
	if(!r)
	    {
	    # display("Security Hole in MSSQL\n");
            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/mssql_hello_overflow.nasl
  • Windows:
    C:\ProgramData\Tenable\Nessus\nessus\plugins\mssql_hello_overflow.nasl
  • Mac OS X:
    /Library/Nessus/run/lib/nessus/plugins/mssql_hello_overflow.nasl

Go back to menu.

How to Run


Here is how to run the Microsoft SQL Server Authentication Function Remote 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 Databases plugin family.
  6. On the right side table select Microsoft SQL Server Authentication Function Remote Overflow plugin ID 11067.
  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 mssql_hello_overflow.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

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

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

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

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: MSKB | Microsoft Knowledge Base: MSFT | Microsoft Security Bulletin:
  • MS02-056
See also: Similar and related Nessus plugins:
  • 10673 - Microsoft SQL Server sa Account Default Blank Password
  • 11214 - MS02-061: Microsoft SQL Server Multiple Vulnerabilities (uncredentialed check)
  • 19387 - CA BrightStor ARCserve Backup Agent for Windows Long String Overflow
  • 105613 - ADV180002: Microsoft SQL Server January 2018 Security Update (Meltdown) (Spectre)
  • 126631 - Security Updates for Microsoft SQL Server (July 2019)
  • 126630 - Security Updates for Microsoft SQL Server (Uncredentialed Check) (July 2019)
  • 133719 - Security Updates for Microsoft SQL Server (February 2020)
  • 133718 - Security Updates for Microsoft SQL Server (Uncredentialed Check) (February 2020)
  • 145033 - Security Updates for Microsoft SQL Server (January 2021)
  • 25117 - XAMPP ADOdb mssql_connect Remote Buffer Overflow
  • 63147 - MariaDB 5.1 < 5.1.66 Buffer Overflow
  • 63148 - MariaDB 5.2 < 5.2.13 Buffer Overflow
  • 63149 - MariaDB 5.3 < 5.3.11 Buffer Overflow
  • 63150 - MariaDB 5.5 < 5.5.28a Buffer Overflow
  • 17835 - MySQL < 5.0.90 / 5.1.43 / 5.5.0-m2 Multiple Buffer Overflows
  • 65734 - MySQL 5.5 < 5.5.30 yaSSL Buffer Overflow
  • 17814 - yaSSL 1.7.5 Buffer Overflow
  • 11563 - Oracle Net Services CREATE DATABASE LINK Query Overflow
  • 12047 - Oracle Database 9i Multiple Functions Local Overflow

Version


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

Go back to menu.