Lucene search

K
nessusThis script is Copyright (C) 2023 and is owned by Tenable, Inc. or an Affiliate thereof.SMB_NT_MS22_NOV_5019966_CVE-2022-37967.NASL
HistoryMay 24, 2023 - 12:00 a.m.

Windows Kerberos Elevation of Privilege Vulnerability (CVE-2022-37967) (November 2022)

2023-05-2400:00:00
This script is Copyright (C) 2023 and is owned by Tenable, Inc. or an Affiliate thereof.
www.tenable.com
836

The remote Windows host is missing a security update. It is, therefore, affected by a Windows Kerberos Elevation of Privilege Vulnerability (CVE-2022-37967)

#%NASL_MIN_LEVEL 80900
##
# (C) Tenable, Inc.
##

include('compat.inc');

if (description)
{
  script_id(176328);
  script_version("1.7");
  script_set_attribute(attribute:"plugin_modification_date", value:"2023/10/13");

  script_cve_id("CVE-2022-37967");
  script_xref(name:"MSKB", value:"5020005");
  script_xref(name:"MSKB", value:"5020013");
  script_xref(name:"MSKB", value:"5020003");
  script_xref(name:"MSKB", value:"5020010");
  script_xref(name:"MSKB", value:"5019964");
  script_xref(name:"MSKB", value:"5019966");
  script_xref(name:"MSKB", value:"5019081");
  script_xref(name:"MSFT", value:"MS22-5020005");
  script_xref(name:"MSFT", value:"MS22-5020013");
  script_xref(name:"MSFT", value:"MS22-5020003");
  script_xref(name:"MSFT", value:"MS22-5020010");
  script_xref(name:"MSFT", value:"MS22-5019964");
  script_xref(name:"MSFT", value:"MS22-5019966");
  script_xref(name:"MSFT", value:"MS22-5019081");

  script_name(english:"Windows Kerberos Elevation of Privilege Vulnerability (CVE-2022-37967) (November 2022)");

  script_set_attribute(attribute:"synopsis", value:
"The remote Windows host is affected by multiple vulnerabilities.");
  script_set_attribute(attribute:"description", value:
"The remote Windows host is missing a security update. It is, therefore, affected by a
  Windows Kerberos Elevation of Privilege Vulnerability (CVE-2022-37967)");
  # https://support.microsoft.com/en-gb/topic/kb5020805-how-to-manage-kerberos-protocol-changes-related-to-cve-2022-37967-997e9acc-67c5-48e1-8d0d-190269bf4efb
  script_set_attribute(attribute:"see_also", value:"http://www.nessus.org/u?b63bc4a5");
  script_set_attribute(attribute:"see_also", value:"https://support.microsoft.com/help/5020005");
  script_set_attribute(attribute:"see_also", value:"https://support.microsoft.com/help/5020013");
  script_set_attribute(attribute:"see_also", value:"https://support.microsoft.com/help/5020003");
  script_set_attribute(attribute:"see_also", value:"https://support.microsoft.com/help/5020010");
  script_set_attribute(attribute:"see_also", value:"https://support.microsoft.com/help/5019964");
  script_set_attribute(attribute:"see_also", value:"https://support.microsoft.com/help/5019966");
  script_set_attribute(attribute:"see_also", value:"https://support.microsoft.com/help/5019081");
  script_set_attribute(attribute:"solution", value:
"Apply the appropriate Security Update for the host and update the registry per KB5020805");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:M/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:H/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-2022-37967");

  script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
  script_set_attribute(attribute:"exploit_available", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2022/11/08");
  script_set_attribute(attribute:"patch_publication_date", value:"2022/11/08");
  script_set_attribute(attribute:"plugin_publication_date", value:"2023/05/24");

  script_set_attribute(attribute:"plugin_type", value:"local");
  script_set_attribute(attribute:"cpe", value:"cpe:/o:microsoft:windows");
  script_set_attribute(attribute:"stig_severity", value:"I");
  script_end_attributes();

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

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

  script_dependencies("smb_hotfixes.nasl", "smb_reg_pdc.nasl", "smb_nt_ms22_nov_5020005.nasl", "smb_nt_ms22_nov_5020013.nasl", "smb_nt_ms22_nov_5020003.nasl", "smb_nt_ms22_nov_5020010.nasl", "smb_nt_ms22_nov_5019964.nasl", "smb_nt_ms22_nov_5019966.nasl", "smb_nt_ms22_nov_5019081.nasl");
  script_require_keys("SMB/Registry/Enumerated");
  script_require_ports(139, 445, "Host/patch_management_checks");

  exit(0);
}

include('smb_func.inc');
include('smb_hotfixes.inc');
include('smb_hotfixes_fcheck.inc');
include('smb_reg_query.inc');

get_kb_item_or_exit('SMB/Registry/Enumerated');
get_kb_item_or_exit('SMB/WindowsVersion', exit_code:1);
var build = get_kb_item_or_exit('SMB/WindowsVersionBuild', exit_code:1);

if (hotfix_check_sp_range(vista:'2') <= 0) audit(AUDIT_OS_SP_NOT_VULN);

var share = hotfix_get_systemdrive(as_share:TRUE, exit_on_fail:TRUE);
if (!is_accessible_share(share:share)) audit(AUDIT_SHARE_FAIL, share);

# patch is missing... check for reg key
var krbt_key = 'SYSTEM\\CurrentControlSet\\Services\\kdc\\KrbtgtFullPacSignature';  # per: https://support.microsoft.com/en-gb/topic/kb5020805-how-to-manage-kerberos-protocol-changes-related-to-cve-2022-37967-997e9acc-67c5-48e1-8d0d-190269bf4efb
var dc_key = 'SYSTEM\\CurrentControlSet\\Control\\ProductOptions\\ProductType'; # using DC detection logic from plugin id: 10413

var now = get_kb_item("/tmp/start_time");
if (empty_or_null(now))
  now = int(gettimeofday());
  
# if epoch < 1696896000 # oct 10 2023
# Open Registry, query (2) registry values, check values, then report findings
  var vuln = TRUE;
  var dc = FALSE;
  if (now < 1696896000 || 
      # we are past the 10/10/23 date and paranoid because MS might not have fixed this, so let's check
      # Note: if a customer reports this as a false positive after 10/10/23 && we confirm the fix has been released by MS, remove this paranoia, post-fix logic.
      (now > 1696896000 && report_paranoia == 2)
    )  
  {
    registry_init();
    var hklm = registry_hive_connect(hive:HKEY_LOCAL_MACHINE, exit_on_fail:TRUE);
    var krbt_val = get_registry_value(handle: hklm, item:krbt_key);
    var dc_val = get_registry_value(handle: hklm, item:dc_key);
    RegCloseKey(handle:hklm);
    close_registry(close:FALSE);

    if (dc_val == "LanmanNT") # we are a primary or backup domain controller
      dc = TRUE;
    if (krbt_val == 3) # if we are in enforcement mode then target is not vuln
      vuln = FALSE;
  }
  else vuln = FALSE; # we are past the 10/10/23 date and this check no longer applies, vuln = false;

  dbg::detailed_log(lvl:1, msg:'[dc_key][' + dc_val + '][krbt_val][' + krbt_val + ']'); 

  if (vuln && dc){
    var report = '\n Nessus detected the following insecure registry key configuration:\n';
    if (empty_or_null(krbt_val)) report += '    - ' + krbt_key + ' is Null' + krbt_val + '\n';
    else report += '    - ' + krbt_key + ' is present in the registry with value ' + krbt_val + '\n';
    hotfix_add_report(report);
    hotfix_security_hole();
    hotfix_check_fversion_end();
    exit(0);
  }
  else
  {
    hotfix_check_fversion_end();
    audit(AUDIT_HOST_NOT, hotfix_get_audit_report());
  }
VendorProductVersionCPE
microsoftwindowscpe:/o:microsoft:windows