Security Updates for Microsoft SQL Server (February 2020) - Nessus

High   Plugin ID: 133719

This page contains detailed information about the Security Updates for Microsoft SQL Server (February 2020) Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 133719
Name: Security Updates for Microsoft SQL Server (February 2020)
Filename: smb_nt_ms20_feb_mssql.nasl
Vulnerability Published: 2020-02-11
This Plugin Published: 2020-02-14
Last Modification Time: 2022-04-11
Plugin Version: 1.10
Plugin Type: local
Plugin Family: Windows : Microsoft Bulletins
Dependencies: ms_bulletin_checks_possible.nasl, mssql_version.nasl, smb_enum_services.nasl, smb_hotfixes.nasl
Required KB Items [?]: SMB/MS_Bulletin_Checks/Possible

Vulnerability Information


Severity: High
Vulnerability Published: 2020-02-11
Patch Published: 2020-02-11
CVE [?]: CVE-2020-0618
CPE [?]: cpe:/a:microsoft:sql_server

Synopsis

The Microsoft SQL Server installation on the remote host is missing a security update.

Description

The Microsoft SQL Server installation on the remote host is missing a security update. It is, therefore, affected by the following vulnerability :

- A remote code execution vulnerability exists in Microsoft SQL Server Reporting Services when it incorrectly handles page requests. An attacker who successfully exploited this vulnerability could execute code in the context of the Report Server service account. (CVE-2020-0618)

Solution

Microsoft has released the following security updates to address this issue: -KB4532095 -KB4532097 -KB4532098 -KB4535288 -KB4535706

Public Exploits


Target Network Port(s): 139, 445, 1433
Target Asset(s): Host/patch_management_checks, Services/mssql
Exploit Available: True (Metasploit Framework, Exploit-DB, GitHub, Immunity Canvas)
Exploit Ease: Exploits are available

Here's the list of publicly known exploits and PoCs for verifying the Security Updates for Microsoft SQL Server (February 2020) vulnerability:

  1. Metasploit: exploit/windows/http/ssrs_navcorrector_viewstate
    [SQL Server Reporting Services (SSRS) ViewState Deserialization]
  2. Exploit-DB: exploits/windows/remote/48816.py
    [EDB-48816: Microsoft SQL Server Reporting Services 2016 - Remote Code Execution]
  3. GitHub: https://github.com/Mathankumar2701/ALL-PENTESTING-BIBLE
    [CVE-2020-0618]
  4. GitHub: https://github.com/Mr-xn/Penetration_Testing_POC
    [CVE-2020-0618]
  5. GitHub: https://github.com/SexyBeast233/SecBooks
    [CVE-2020-0618]
  6. GitHub: https://github.com/bhdresh/SnortRules
    [CVE-2020-0618]
  7. GitHub: https://github.com/jumpif0/test
    [CVE-2020-0618]
  8. GitHub: https://github.com/lovechinacoco/https-github.com-mai-lang-chai-Middleware-Vulnerability-detection
    [CVE-2020-0618]
  9. GitHub: https://github.com/michael101096/cs2020_msels
    [CVE-2020-0618]
  10. GitHub: https://github.com/pwntester/ysoserial.net
    [CVE-2020-0618]
  11. GitHub: https://github.com/tdtc7/qps
    [CVE-2020-0618]
  12. GitHub: https://github.com/euphrat1ca/CVE-2020-0618
    [CVE-2020-0618: SQL Server Reporting Services(CVE-2020-0618)中的RCE]
  13. GitHub: https://github.com/wortell/cve-2020-0618
    [CVE-2020-0618: CVE-2020-0618 Honeypot]
  14. 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-2020-0618
CVSS V2 Vector: AV:N/AC:L/Au:S/C:P/I:P/A:P/E:F/RL:OF/RC:C
CVSS Base Score:6.5 (Medium)
Impact Subscore:6.4
Exploitability Subscore:8.0
CVSS Temporal Score:5.4 (Medium)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:5.4 (Medium)
CVSS V3 Vector: CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H/E:F/RL:O/RC:C
CVSS Base Score:8.8 (High)
Impact Subscore:5.9
Exploitability Subscore:2.8
CVSS Temporal Score:8.2 (High)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:8.2 (High)
STIG Severity [?]: I
STIG Risk Rating: High

Go back to menu.

Plugin Source


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

#%NASL_MIN_LEVEL 70300
#
# (C) Tenable Network Security, Inc.
#



# The descriptive text and package checks in this plugin were  
# extracted from the Microsoft Security Updates API. The text
# itself is copyright (C) Microsoft Corporation.

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

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

  script_cve_id("CVE-2020-0618");
  script_xref(name:"IAVA", value:"2020-A-0074-S");
  script_xref(name:"MSKB", value:"4532095");
  script_xref(name:"MSKB", value:"4532097");
  script_xref(name:"MSKB", value:"4532098");
  script_xref(name:"MSKB", value:"4535288");
  script_xref(name:"MSKB", value:"4535706");
  script_xref(name:"MSFT", value:"MS20-4532095");
  script_xref(name:"MSFT", value:"MS20-4532097");
  script_xref(name:"MSFT", value:"MS20-4532098");
  script_xref(name:"MSFT", value:"MS20-4535288");
  script_xref(name:"MSFT", value:"MS20-4535706");

  script_name(english:"Security Updates for Microsoft SQL Server (February 2020)");

  script_set_attribute(attribute:"synopsis", value:
"The Microsoft SQL Server installation on the remote host is missing a security update.");
  script_set_attribute(attribute:"description", value:
"The Microsoft SQL Server installation on the remote host is
missing a security update. It is, therefore, affected by the
following vulnerability :

  - A remote code execution vulnerability exists in
    Microsoft SQL Server Reporting Services when it
    incorrectly handles page requests. An attacker who
    successfully exploited this vulnerability could execute
    code in the context of the Report Server service
    account.  (CVE-2020-0618)");
  # https://support.microsoft.com/en-us/help/4532097/description-of-the-security-update-for-sql-server-2016-sp2-gdr-feb
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?ff30ef1b");
  # https://support.microsoft.com/en-us/help/4535288/description-of-the-security-update-for-sql-server-2014-sp3-cu4-feb
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?8089305a");
  # https://support.microsoft.com/en-us/help/4532095/description-of-the-security-update-for-sql-server-2014-sp3-gdr-feb
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?899d9f68");
  # https://support.microsoft.com/en-us/help/4532098/security-update-for-sql-server-2012-sp4-gdr
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?7c9e8cfc");
  # https://support.microsoft.com/en-us/help/4535706/description-of-the-security-update-for-sql-server-2016-sp2-cu11-februa
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?226a31d0");
  script_set_attribute(attribute:"solution", value:
"Microsoft has released the following security updates to address this issue:
  -KB4532095
  -KB4532097
  -KB4532098
  -KB4535288
  -KB4535706");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:S/C:P/I:P/A:P");
  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:L/UI:N/S:U/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-2020-0618");

  script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
  script_set_attribute(attribute:"exploit_available", value:"true");
  script_set_attribute(attribute:"metasploit_name", value:'SQL Server Reporting Services (SSRS) ViewState Deserialization');
  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:"2020/02/11");
  script_set_attribute(attribute:"patch_publication_date", value:"2020/02/11");
  script_set_attribute(attribute:"plugin_publication_date", value:"2020/02/14");

  script_set_attribute(attribute:"plugin_type", value:"local");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:microsoft:sql_server");
  script_set_attribute(attribute:"stig_severity", value:"I");
  script_set_attribute(attribute:"thorough_tests", value:"true");
  script_end_attributes();

  script_category(ACT_GATHER_INFO);
  script_family(english:"Windows : Microsoft Bulletins");

  script_copyright(english:"This script is Copyright (C) 2020-2022 and is owned by Tenable, Inc. or an Affiliate thereof.");

  script_dependencies("smb_hotfixes.nasl", "mssql_version.nasl", "smb_enum_services.nasl", "ms_bulletin_checks_possible.nasl");
  script_require_keys("SMB/MS_Bulletin_Checks/Possible");
  script_require_ports(139, 445, 1433, "Services/mssql", "Host/patch_management_checks");

  exit(0);
}

include('audit.inc');
include('smb_func.inc');
include('smb_hotfixes.inc');
include('smb_hotfixes_fcheck.inc');
include('misc_func.inc');

get_kb_item_or_exit('SMB/MS_Bulletin_Checks/Possible');

var kbs = make_list(
  '4532095',
  '4532097',
  '4532098',
  '4535288',
  '4535706'
);

if (get_kb_item('Host/patch_management_checks')) hotfix_check_3rd_party(kbs:kbs, severity:SECURITY_WARNING);

get_kb_item_or_exit('SMB/Registry/Enumerated');
get_kb_item_or_exit('SMB/WindowsVersion', exit_code:1);

var vuln = 0;
var ver_list = get_kb_list('mssql/installs/*/SQLVersion');
var program_files_dir = hotfix_get_programfilesdir();
var program_files_x86_dir = hotfix_get_programfilesdirx86();

if (isnull(ver_list)) audit(AUDIT_NOT_INST, 'Microsoft SQL Server');

var item, arch, sqlpath, share, version, localdb, instance_name, osqlpath;
foreach item (keys(ver_list))
{
  item -= '/SQLVersion';

  arch = get_kb_item(item + '/arch');

  item -= 'mssql/installs/';
  sqlpath = item;

  share = hotfix_path2share(path:sqlpath);

  if (!is_accessible_share(share:share)) continue;

  version = get_kb_item('mssql/installs/' + sqlpath + '/SQLVersion');

  if (empty_or_null(version)) continue;

  # continue if the instance is a localdb, which cannot be patched with the same KBs
  localdb = get_kb_item('mssql/installs/' + sqlpath + '/localdb');
  if (report_paranoia < 2 && localdb) 
  {
    instance_name = get_kb_item('mssql/installs/' + sqlpath + '/NamedInstance');
    dbg::log(src:SCRIPT_NAME, msg:'Skipping ' + instance_name + ' because it is a LOCALDB.');
    continue;
  }

  ############
  # 2012
  ############

  if (version =~ "^11\.0\.")
  {
    sqlpath = '\\Microsoft SQL Server\\110\\Setup Bootstrap\\SQLServer2012';
    osqlpath = '\\Microsoft SQL Server\\110\\Tools\\Binn';
    if (
    # 2012 SP4 GDR
    # KB 4532098
    hotfix_is_vulnerable(path:program_files_dir + sqlpath, file:'setup.exe', version:"2011.110.7493.4", min_version:"2011.110.0.0", kb:'4532098') ||
    (arch == "x86" &&
    hotfix_is_vulnerable(path:program_files_x86_dir + sqlpath, file:'setup.exe', version:"2011.110.7493.4", min_version:"2011.110.0.0", kb:'4532098') ||
    # check for OSQL.exe if the above is not found
    hotfix_is_vulnerable(path:program_files_dir + osqlpath, file:'OSQL.exe', version:'2011.110.7493.4', min_version:'2011.110.0.0', kb:'4532098') ||
    (arch == 'x86' &&
    hotfix_is_vulnerable(path:program_files_x86_dir + osqlpath, file:'OSQL.exe', version:'2011.110.7493.4', min_version:'2011.110.0.0', kb:'4532098'))
    )) vuln++;
  }

  ############
  # 2014
  ############
  if (version =~ "^12\.0\.")
  { 
    sqlpath = '\\Microsoft SQL Server\\120\\Setup Bootstrap\\SQLServer2014';
    osqlpath = '\\Microsoft SQL Server\\120\\Tools\\Binn';

    if ( 
      # 2014 SP3 GDR
      # KB 4532095
      hotfix_is_vulnerable(path:program_files_dir + osqlpath, file:'OSQL.exe', version:'2014.120.6118.4', min_version:'2014.120.6000.0', kb:'4532095') ||
      (arch == 'x86' &&
      hotfix_is_vulnerable(path:program_files_x86_dir + osqlpath, file:'OSQL.exe', version:'2014.120.6118.4', min_version:'2014.120.6000.0', kb:'4532095')) ||
      hotfix_is_vulnerable(path:program_files_dir + sqlpath, file:'setup.exe', version:'2014.120.6118.4', min_version:'2014.120.6000.0', kb:'4532095') ||
      (arch == 'x86' &&
      hotfix_is_vulnerable(path:program_files_x86_dir + sqlpath, file:'setup.exe', version:'2014.120.6118.4', min_version:'2014.120.6000.0', kb:'4532095')) ||

      # 2014 SP3 CU4
      # KB 4535288
      hotfix_is_vulnerable(path:program_files_dir + osqlpath, file:'OSQL.exe', version:'2014.120.6372.1', min_version:'2014.120.6200.0', kb:'4535288') ||
      (arch == 'x86' &&
      hotfix_is_vulnerable(path:program_files_x86_dir + sqlpath, file:'setup.exe', version:'2014.120.6372.1', min_version:'2014.120.6200.0', kb:'4535288')) ||
      hotfix_is_vulnerable(path:program_files_dir + sqlpath, file:'setup.exe', version:'2014.120.6372.1', min_version:'2014.120.6200.0', kb:'4535288') ||
      (arch == 'x86' &&
      hotfix_is_vulnerable(path:program_files_x86_dir + sqlpath, file:'setup.exe', version:'2014.120.6372.1', min_version:'2014.120.6200.0', kb:'4535288')
    ))
      vuln++;
  }

  ############
  # 2016
  ############
  else if (version =~ "^13\.0\.")
  {
    sqlpath = '\\Microsoft SQL Server\\130\\Setup Bootstrap\\SQLServer2016';
    osqlpath = '\\Microsoft SQL Server\\130\\Tools\\Binn';

    if (
       # 2016 SP2 GDR
       # KB 4532097
       #  - x64 only
       (arch == 'x64' &&
        hotfix_is_vulnerable(path:program_files_dir + sqlpath, file:'setup.exe', version:'2015.131.5102.14', min_version:'2015.131.5000.0', kb:'4532097')
       ) ||

       # 2016 SP2 CU11
       # KB 4535706
       #  - x64 only
      (arch == 'x64' &&
       hotfix_is_vulnerable(path:program_files_dir + osqlpath, file:'xmlrw.dll', version:'2015.131.5622.0', min_version:'2015.131.5149.0', kb:'4535706')
      )
    )
      vuln++;
  }
}

hotfix_check_fversion_end();

if (vuln)
{
  hotfix_security_warning();
  exit(0);
}
audit(AUDIT_HOST_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/smb_nt_ms20_feb_mssql.nasl
  • Windows:
    C:\ProgramData\Tenable\Nessus\nessus\plugins\smb_nt_ms20_feb_mssql.nasl
  • Mac OS X:
    /Library/Nessus/run/lib/nessus/plugins/smb_nt_ms20_feb_mssql.nasl

Go back to menu.

How to Run


Here is how to run the Security Updates for Microsoft SQL Server (February 2020) 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 : Microsoft Bulletins plugin family.
  6. On the right side table select Security Updates for Microsoft SQL Server (February 2020) plugin ID 133719.
  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 smb_nt_ms20_feb_mssql.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

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

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

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

Go back to menu.

References


MSKB | Microsoft Knowledge Base: MSFT | Microsoft Security Bulletin:
  • MS20-4532095, MS20-4532097, MS20-4532098, MS20-4535288, MS20-4535706
IAVA | Information Assurance Vulnerability Alert:
  • 2020-A-0074-S
See also: Similar and related Nessus plugins:
  • 133718 - Security Updates for Microsoft SQL Server (Uncredentialed Check) (February 2020)
  • 133608 - KB4532691: Windows 10 Version 1809 and Windows Server 2019 February 2020 Security Update
  • 133609 - KB4532693: Windows 10 Version 1903 and Windows 10 Version 1909 February 2020 Security Update
  • 133610 - KB4537762: Windows 10 Version 1803 February 2020 Security Update
  • 133611 - KB4537764: Windows 10 Version 1607 and Windows Server 2016 February 2020 Security Update
  • 133612 - KB4537776: Windows 10 February 2020 Security Update
  • 133613 - KB4537789: Windows 10 Version 1709 February 2020 Security Update
  • 134863 - KB4537822: Windows Server 2008 February 2020 Security Update
  • 133614 - KB4537794: Windows Server 2012 February 2020 Security Update
  • 134864 - KB4537813: Windows 7 and Windows Server 2008 R2 February 2020 Security Update
  • 133615 - KB4537803: Windows 8.1 and Windows Server 2012 R2 February 2020 Security Update
  • 133617 - Security Updates for Exchange (February 2020)
  • 133618 - KB4537759: Security update for Adobe Flash Player (February 2020)
  • 133619 - Security Updates for Internet Explorer (February 2020)

Version


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

Go back to menu.