Lucene search
K

PsExec Service Installed

🗓️ 16 May 2011 00:00:00Reported by TenableType 
nessus
 nessus
🔗 www.tenable.com👁 203 Views

The remote Windows host has a remote control service installed

Refs
Code
#
# (C) Tenable Network Security, Inc.
#

include('compat.inc');

if (description)
{
  script_id(53916);
  script_version("1.7");
  script_set_attribute(attribute:"plugin_modification_date", value:"2022/02/01");

  script_name(english:"PsExec Service Installed");
  script_summary(english:"Checks for psexesvc.exe");

  script_set_attribute(attribute:"synopsis", value:"The remote Windows host has a remote control service installed.");

  script_set_attribute(attribute:"description", value:
"The PsExec service, a tool that allows remote control of the system,
is installed on the remote Windows host.");

  script_set_attribute(attribute:"see_also", value:"https://docs.microsoft.com/en-us/sysinternals/downloads/psexec");
  script_set_attribute(attribute:"solution", value:"n/a");
  script_set_attribute(attribute:"risk_factor", value:"None");

  script_set_attribute(attribute:"plugin_publication_date", value:"2011/05/16");

  script_set_attribute(attribute:"plugin_type", value:"local");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:microsoft:psexec");
  script_set_attribute(attribute:"asset_inventory", value:"True");
  script_set_attribute(attribute:"agent", value:"windows");
  script_end_attributes();

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

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

  script_dependencies("smb_hotfixes.nasl");
  script_require_keys("SMB/Registry/Enumerated");
  script_require_ports(139, 445);

  exit(0);
}

include("audit.inc");
include("smb_hotfixes.inc");
include("misc_func.inc");
include("smb_func.inc");

get_kb_item_or_exit('SMB/Registry/Enumerated');

rootfile = hotfix_get_systemroot();
if (!rootfile) exit(1, 'Can\'t get the Windows system root.');

share = ereg_replace(pattern:'^([A-Za-z]):.*', replace:'\\1$', string:rootfile);

port    = kb_smb_transport();
login   = kb_smb_login();
pass    = kb_smb_password();
domain  = kb_smb_domain();

if(! smb_session_init()) audit(AUDIT_FN_FAIL, "smb_session_init");

rc = NetUseAdd(login:login, password:pass, domain:domain, share:share);
if (rc != 1)
{
  NetUseDel();
  audit(AUDIT_SHARE_FAIL,share);
}

info = '';
count = 0;

foreach root (make_list(rootfile, rootfile + '\\system32'))
{
  path = ereg_replace(pattern:'^[A-Za-z]:(.*)', replace:'\\1', string:root);
  exe = path + '\\psexesvc.exe';

  fh = CreateFile(
    file:exe,
    desired_access:GENERIC_READ,
    file_attributes:FILE_ATTRIBUTE_NORMAL,
    share_mode:FILE_SHARE_READ,
    create_disposition:OPEN_EXISTING
  );

  if (!isnull(fh))
  {
    ver = GetFileVersion(handle:fh);
    CloseFile(handle:fh);

    if (isnull(ver)) version = 'unknown';
    else version = join(sep:'.', ver);

    set_kb_item(name:'SMB/PSExec/'+root+'/Version', value:version);
    info +=
      '\n  File    : ' + root + '\\psexesvc.exe' +
      '\n  Version : ' + version + '\n';
    count++;
  }
}

NetUseDel();

if (count > 0)
{
  if (report_verbosity > 0)
  {
    if (count > 1) s = 's of the PsExec service were found';
    else s = ' of the PsExec service was found';

    report =
      '\n  The following version' + s + ' on the remote host : ' +
      info;
    security_note(port:port, extra:data_protection::sanitize_user_paths(report_text:report));
  }
  else security_note(port);
  exit(0);
}
else exit(0, 'The PsExec service wasn\'t detected on the remote host.');

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

01 Feb 2022 00:00Current
5.5Medium risk
Vulners AI Score5.5
203