Microsoft SQL Server sa Account Default Blank Password - Nessus

Critical   Plugin ID: 10673

This page contains detailed information about the Microsoft SQL Server sa Account Default Blank Password Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 10673
Name: Microsoft SQL Server sa Account Default Blank Password
Filename: mssql_blank_password.nasl
Vulnerability Published: 2000-07-11
This Plugin Published: 2001-05-25
Last Modification Time: 2022-04-11
Plugin Version: 1.42
Plugin Type: remote
Plugin Family: Databases
Dependencies: mssqlserver_detect.nasl, sybase_detect.nasl
Excluded KB Items [?]: global_settings/supplied_logins_only

Vulnerability Information


Severity: Critical
Vulnerability Published: 2000-07-11
Patch Published: N/A
CVE [?]: CVE-2000-1209
CPE [?]: cpe:/a:microsoft:sql_server

Synopsis

The remote database service has an account with a blank password.

Description

The remote instance of MS SQL / SQL Server has the default 'sa' account enabled without any password.

An attacker may leverage this flaw to execute commands against the remote host, as well as read the content of any databases it might have.

Solution

Disable the 'sa' account or set a password for it.

In addition, filter incoming TCP traffic to this port.

For MSDE (OEM versions without MSQL console) :

C:\MSSQL7\BINN\osql -U sa

At the Password: prompt press <Enter>.

Type the following replacing .password. with the password you wish to assign, in single quotes:

EXEC sp_password NULL, .password., .sa. go exit

Public Exploits


Target Network Port(s): 1433
Target Asset(s): Services/mssql
Exploit Available: True (Metasploit Framework, Exploit-DB, Immunity Canvas)
Exploit Ease: No exploit is required

Here's the list of publicly known exploits and PoCs for verifying the Microsoft SQL Server sa Account Default Blank Password vulnerability:

  1. Metasploit: exploit/windows/mssql/mssql_payload_sqli
    [Microsoft SQL Server Payload Execution via SQL Injection]
  2. Metasploit: exploit/windows/mssql/mssql_payload
    [Microsoft SQL Server Payload Execution]
  3. Exploit-DB: exploits/windows/remote/16394.rb
    [EDB-16394: Microsoft SQL Server - Payload Execution (via SQL Injection) (Metasploit)]
  4. Exploit-DB: exploits/windows/remote/16395.rb
    [EDB-16395: Microsoft SQL Server - Payload Execution (Metasploit)]
  5. 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 Score Source [?]: CVE-2000-1209
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)
CVSS V3 Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H/E:F/RL:O/RC:C
CVSS Base Score:10.0 (Critical)
Impact Subscore:6.0
Exploitability Subscore:3.9
CVSS Temporal Score:9.3 (Critical)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:9.3 (Critical)

Go back to menu.

Plugin Source


This is the mssql_blank_password.nasl nessus plugin source code. This script is Copyright (C) 2001-2022 H D Moore

#%NASL_MIN_LEVEL 70300
##
#
# this script attempts to log in to a SQL server using the 
# "sa" account with a blank password.
#
##

# Changes by Tenable:
# - Revised plugin title (6/8/09)
# - Match NVD score for CVE, replace string() calls (9/14/18)

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

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

  script_cve_id("CVE-2000-1209");
  script_bugtraq_id(4797);

  script_name(english:"Microsoft SQL Server sa Account Default Blank Password");

  script_set_attribute(attribute:"synopsis", value:
"The remote database service has an account with a blank password.");
  script_set_attribute(attribute:"description", value:
"The remote instance of MS SQL / SQL Server has the default 'sa'
account enabled without any password. 

An attacker may leverage this flaw to execute commands against the
remote host, as well as read the content of any databases it might
have.");
  script_set_attribute(attribute:"solution", value:
"Disable the 'sa' account or set a password for it.  

In addition, filter incoming TCP traffic to this port. 

For MSDE (OEM versions without MSQL console) : 

 C:\MSSQL7\BINN\osql -U sa

 At the Password: prompt press <Enter>.

 Type the following replacing .password. with the password you wish to
 assign, in single quotes:

 EXEC sp_password NULL, .password., .sa.
 go
 exit");
  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_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H");
  script_set_cvss3_temporal_vector("CVSS:3.0/E:F/RL:O/RC:C");
  script_set_attribute(attribute:"cvss_score_source", value:"CVE-2000-1209");

  script_set_attribute(attribute:"exploitability_ease", value:"No exploit is required");
  script_set_attribute(attribute:"exploit_available", value:"false");
  script_set_attribute(attribute:"metasploit_name", value:'Microsoft SQL Server Payload Execution via SQL Injection');
  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:"2000/07/11");
  script_set_attribute(attribute:"plugin_publication_date", value:"2001/05/25");

  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_ATTACK);
  script_family(english:"Databases");

  script_copyright(english:"This script is Copyright (C) 2001-2022 H D Moore");

  script_dependencies("mssqlserver_detect.nasl", "sybase_detect.nasl");
  script_exclude_keys("global_settings/supplied_logins_only");
  script_require_ports("Services/mssql", 1433);

  exit(0);
}

#
# The script code starts here
#
include("global_settings.inc");
include("misc_func.inc");

pkt_hdr = raw_string(
    0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
);


pkt_pt2 = raw_string (
    0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x61, 0x30, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x20, 0x18, 0x81, 0xb8, 0x2c, 0x08, 0x03,
    0x01, 0x06, 0x0a, 0x09, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x73, 0x71, 0x75, 0x65, 0x6c, 0x64, 0x61,
    0x20, 0x31, 0x2e, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00
);

pkt_pt3 = raw_string (
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x04, 0x02, 0x00, 0x00, 0x4d, 0x53, 0x44,
    0x42, 0x4c, 0x49, 0x42, 0x00, 0x00, 0x00, 0x07, 0x06, 0x00, 0x00,
    0x00, 0x00, 0x0d, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00
);

pkt_lang = raw_string(
    0x02, 0x01, 0x00, 0x47, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x00, 0x00,
    0x00, 0x03, 0x00, 0x00, 0x00
);

function make_sql_login_pkt (username, password)
{
    local_var nul, pblen, pbuf, plen, ppad, sql_packet, ublen, ubuf, ulen, upad;

    ulen = strlen(username);
    plen = strlen(password);
    
    upad = 30 - ulen;
    ppad = 30 - plen;
    
    ubuf = "";
    pbuf = "";
    
    nul = raw_string(0x00);
    
    if(ulen)
    {
        ublen = raw_string(ulen % 255);
    } else {
        ublen = raw_string(0x00);
    }
    
    if(plen)
    {
        pblen = raw_string(plen % 255);
    } else {
        pblen = raw_string(0x00);
    }  

    ubuf = username + crap(data:nul, length:upad);
    pbuf = password + crap(data:nul, length:ppad);

    sql_packet = pkt_hdr + ubuf + ublen + pbuf + pblen + pkt_pt2 + pblen + pbuf + pkt_pt3;

    # returning this as a string is NOT working!
    return sql_packet;
}


port = get_kb_item("Services/mssql");
if(!port)port = get_kb_item("Services/sybase");
if(!port)
{
  port = 1433;
  if (!service_is_unknown(port:port)) exit(0, "The service is already known on port "+port+".");
}
if (!get_tcp_port_state(port)) exit(0, "Port "+port+" is not open.");

if (supplied_logins_only) exit(0, "Nessus is currently configured to not log in with user accounts not specified in the scan policy.");

found = 0;


soc = open_sock_tcp(port);
if (!soc) exit(1, "Can't open socket on port "+port+".");

# this creates a variable called sql_packet
sql_packet = make_sql_login_pkt(username:"sa", password:"");

send(socket:soc, data:sql_packet);
send(socket:soc, data:pkt_lang);

r  = recv(socket:soc, length:255);
close(soc);

if (
  strlen(r) > 10 &&
  ord(r[8]) == 0xE3
)
{
  # Can we differentiate between mssql and sybase?
  # if (service_is_unknown(port:port)) register_service(port:port, proto:"mssql");

  security_hole(port);
  set_kb_item(name: 'MSSQL/blank_password/'+port, value: TRUE);

  exit(0);
}
else exit(0, "The SQL Server instance listening on port "+port+" is not affected.");

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

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

Go back to menu.

How to Run


Here is how to run the Microsoft SQL Server sa Account Default Blank Password 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 sa Account Default Blank Password plugin ID 10673.
  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_blank_password.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

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

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

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

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: See also: Similar and related Nessus plugins:
  • 11067 - Microsoft SQL Server Authentication Function Remote Overflow
  • 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

Version


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

Go back to menu.