Lucene search
+L

Microsoft Windows SMB Accessible Shares

🗓️ 29 Feb 2012 00:00:00Reported by Copyright (C) 2012 Greenbone AGType 
openvas
 openvas
🔗 plugins.openvas.org👁 31 Views

Windows SMB Accessible Shares detected. Sets result into KB

Code
# SPDX-FileCopyrightText: 2012 Greenbone AG
# Some text descriptions might be excerpted from (a) referenced
# source(s), and are Copyright (C) by the respective right holder(s).
#
# SPDX-License-Identifier: GPL-2.0-only

if(description)
{
  script_oid("1.3.6.1.4.1.25623.1.0.902425");
  script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N");
  script_version("2026-03-18T05:59:10+0000");
  script_tag(name:"last_modification", value:"2026-03-18 05:59:10 +0000 (Wed, 18 Mar 2026)");
  script_tag(name:"creation_date", value:"2012-02-29 12:08:36 +0530 (Wed, 29 Feb 2012)");
  script_tag(name:"cvss_base", value:"0.0");
  script_name("Microsoft Windows SMB Accessible Shares");
  script_category(ACT_GATHER_INFO);
  script_tag(name:"qod_type", value:"remote_banner");
  script_copyright("Copyright (C) 2012 Greenbone AG");
  script_family("Windows");
  script_dependencies("smb_login.nasl");
  script_mandatory_keys("SMB/transport");
  script_exclude_keys("login/SMB/kerberos/success");
  script_require_ports(139, 445);
  # nb: No script_mandatory_keys() for these as the code below also works with an anonymous user...
  script_require_keys("SMB/name", "SMB/login", "SMB/password");

  script_tag(name:"summary", value:"The script detects the Windows SMB Accessible Shares and sets the
  result into KB.");

  exit(0);
}

include("smb_nt.inc");

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

if(!port){
  port = 139;
}

if(!get_port_state(port)){
 exit(0);
}

soc = open_sock_tcp(port);
if(!soc){
  exit(0);
}

r = smb_session_request(soc:soc, remote:name);
if(!r)
{
  close(soc);
  exit(0);
}

prot = smb_neg_prot(soc:soc);
if(!prot)
{
  close(soc);
  exit(0);
}

r = smb_session_setup(soc:soc, login:login, password:pass, domain:"", prot:prot);
if(!r)
{
  r = smb_session_setup(soc:soc, login:"anonymous", password:pass, domain:"", prot:prot);
  if(!r)
  {
    close(soc);
    exit(0);
  }
}

uid = session_extract_uid(reply:r);
if(!uid)
{
  close(soc);
  exit(0);
}

foreach s (make_list("A$", "C$", "D$", "ADMIN$", "WINDOWS$", "ROOT$", "WINNT$", "IPC$", "E$"))
{
  r = smb_tconx(soc:soc, name:name, uid:uid, share:s);
  if(r)
  {
    tid = tconx_extract_tid(reply:r);
    if(tid){
      r = secure_dialect_negotiation(uid:uid, tid:tid, soc:soc);
      if (r) {
        set_kb_item(name:"SMB/Accessible_Shares", value:s);
        report += s + '\n';
      }
    }
  }
}

if( report )
{
  report = 'The following shares were found\n' + report;
  log_message( port:port, data:report );
}

close(soc);

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

18 Mar 2026 00:00Current
5.8Medium risk
Vulners AI Score5.8
31