Samba 3.5.x < 3.5.22 / 3.6.x < 3.6.25 / 4.0.x < 4.0.25 / 4.1.x < 4.1.17 TALLOC_FREE() RCE - Nessus

Critical   Plugin ID: 81485

This page contains detailed information about the Samba 3.5.x < 3.5.22 / 3.6.x < 3.6.25 / 4.0.x < 4.0.25 / 4.1.x < 4.1.17 TALLOC_FREE() RCE Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 81485
Name: Samba 3.5.x < 3.5.22 / 3.6.x < 3.6.25 / 4.0.x < 4.0.25 / 4.1.x < 4.1.17 TALLOC_FREE() RCE
Filename: samba_4_1_17.nasl
Vulnerability Published: 2015-02-23
This Plugin Published: 2015-02-24
Last Modification Time: 2018-11-15
Plugin Version: 1.11
Plugin Type: remote
Plugin Family: Misc.
Dependencies: smb_nativelanman.nasl
Required KB Items [?]: Settings/ParanoidReport, SMB/NativeLanManager, SMB/samba

Vulnerability Information


Severity: Critical
Vulnerability Published: 2015-02-23
Patch Published: 2015-02-23
CVE [?]: CVE-2015-0240
CPE [?]: cpe:/a:samba:samba
Exploited by Malware: True

Synopsis

The remote Samba server is affected by a remote code execution vulnerability.

Description

According to its banner, the version of Samba running on the remote host is 3.5.x prior to 3.5.22, 3.6.x prior to 3.6.25, 4.0.x prior to 4.0.25, or 4.1.x prior to 4.1.17. It is, therefore, affected by a remote code execution vulnerability in the TALLOC_FREE() function of 'rpc_server/netlogon/srv_netlog_nt.c'. A remote attacker, using a specially crafted sequence of packets followed by a subsequent anonymous netlogon packet, can execute arbitrary code as the root user.

Note that Nessus has not tested for this issue but has instead relied only on the application's self-reported version number.

Solution

Upgrade to Samba 3.6.25 / 4.0.25 / 4.1.17 or later. Alternatively, install the patch or apply the workaround referenced in the vendor advisory.

Public Exploits


Target Network Port(s): N/A
Target Asset(s): N/A
Exploit Available: True (Exploit-DB, GitHub)
Exploit Ease: Exploits are available

Here's the list of publicly known exploits and PoCs for verifying the Samba 3.5.x < 3.5.22 / 3.6.x < 3.6.25 / 4.0.x < 4.0.25 / 4.1.x < 4.1.17 TALLOC_FREE() RCE vulnerability:

  1. Exploit-DB: exploits/linux_x86/dos/36741.py
    [EDB-36741: Samba < 3.6.2 (x86) - Denial of Service (PoC)]
  2. GitHub: https://gist.github.com/worawit/051e881fc94fe4a49295
    [CVE-2015-0240]

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 V2 Vector [?]: AV:N/AC:L/Au:N/C:C/I:C/A:C/E:H/RL:OF/RC:C
CVSS Base Score:10.0 (High)
Impact Subscore:10.0
Exploitability Subscore:10.0
CVSS Temporal Score:8.7 (High)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:8.7 (High)

Go back to menu.

Plugin Source


This is the samba_4_1_17.nasl nessus plugin source code. This script is Copyright (C) 2015-2018 Tenable Network Security, Inc.

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

include("compat.inc");

if (description)
{
  script_id(81485);
  script_version("1.11");
  script_cvs_date("Date: 2018/11/15 20:50:24");

  script_cve_id("CVE-2015-0240");
  script_bugtraq_id(72711);

  script_name(english:"Samba 3.5.x < 3.5.22 / 3.6.x < 3.6.25 / 4.0.x < 4.0.25 / 4.1.x < 4.1.17 TALLOC_FREE() RCE");
  script_summary(english:"Checks the version of Samba.");

  script_set_attribute(attribute:"synopsis", value:
"The remote Samba server is affected by a remote code execution
vulnerability.");
  script_set_attribute(attribute:"description", value:
"According to its banner, the version of Samba running on the remote
host is 3.5.x prior to 3.5.22, 3.6.x prior to 3.6.25, 4.0.x prior to
4.0.25, or 4.1.x prior to 4.1.17. It is, therefore, affected by a
remote code execution vulnerability in the TALLOC_FREE() function of
'rpc_server/netlogon/srv_netlog_nt.c'. A remote attacker, using a
specially crafted sequence of packets followed by a subsequent
anonymous netlogon packet, can execute arbitrary code as the root
user.

Note that Nessus has not tested for this issue but has instead relied
only on the application's self-reported version number.");
  script_set_attribute(attribute:"see_also", value:"https://www.samba.org/samba/security/CVE-2015-0240.html");
  script_set_attribute(attribute:"see_also", value:"https://www.samba.org/samba/history/samba-3.6.25.html");
  script_set_attribute(attribute:"see_also", value:"https://www.samba.org/samba/history/samba-4.0.25.html");
  script_set_attribute(attribute:"see_also", value:"https://www.samba.org/samba/history/samba-4.1.17.html");
  script_set_attribute(attribute:"solution", value:
"Upgrade to Samba 3.6.25 / 4.0.25 / 4.1.17 or later. Alternatively,
install the patch or apply the workaround referenced in the vendor
advisory.");
  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:H/RL:OF/RC:C");
  script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
  script_set_attribute(attribute:"exploit_available", value:"true");
  script_set_attribute(attribute:"exploited_by_malware", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2015/02/23");
  script_set_attribute(attribute:"patch_publication_date", value:"2015/02/23");
  script_set_attribute(attribute:"plugin_publication_date", value:"2015/02/24");

  script_set_attribute(attribute:"potential_vulnerability", value:"true");
  script_set_attribute(attribute:"plugin_type", value:"remote");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:samba:samba");
  script_end_attributes();

  script_category(ACT_GATHER_INFO);
  script_family(english:"Misc.");

  script_copyright(english:"This script is Copyright (C) 2015-2018 Tenable Network Security, Inc.");

  script_dependencies("smb_nativelanman.nasl");
  script_require_keys("SMB/NativeLanManager", "SMB/samba", "Settings/ParanoidReport");
  exit(0);
}

include("audit.inc");
include("global_settings.inc");
include("misc_func.inc");

if (report_paranoia < 2) audit(AUDIT_PARANOID);

port = get_kb_item("SMB/transport");
if (!port) port = 445;

lanman = get_kb_item_or_exit("SMB/NativeLanManager");

if ("Samba " >!< lanman) audit(AUDIT_NOT_LISTEN, "Samba", port);

if (lanman =~ '^Samba 3(\\.[56])?$' || lanman =~ '^Samba 4(\\.[0-2])?$')
  audit(AUDIT_VER_NOT_GRANULAR, "Samba", port, version);

version = lanman - 'Samba ';
ver = split(version, sep:'.', keep:FALSE);
for (i=0; i<max_index(ver); i++)
  ver[i] = int(ver[i]);

fix = NULL;

if (
  (ver[0] == 3 && ver[1] == 5 && ver[2] <= 22) ||
  (ver[0] == 3 && ver[1] == 6 && ver[2] < 25)
)
  fix = '3.6.25';
if (ver[0] == 4 && ver[1] == 0 && ver[2] < 25) fix = '4.0.25';
if (ver[0] == 4 && ver[1] == 1 && ver[2] < 17) fix = '4.1.17';

# Note that 4.2.x < 4.2.0rc5 is vuln,
# but we don't make much noise about it.
if (version =~ "^4\.2\.0rc[0-4]$") fix = '4.2.0rc5';

if (fix)
{
  if (report_verbosity > 0)
  {
    report = '\n  Installed version : ' + version +
             '\n  Fixed version     : ' + fix + '\n';
    security_hole(port:port, extra:report);
  }
  else security_hole(port);
  exit(0);
}
else audit(AUDIT_LISTEN_NOT_VULN, "Samba", port, version);

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

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

Go back to menu.

How to Run


Here is how to run the Samba 3.5.x < 3.5.22 / 3.6.x < 3.6.25 / 4.0.x < 4.0.25 / 4.1.x < 4.1.17 TALLOC_FREE() RCE 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 Misc. plugin family.
  6. On the right side table select Samba 3.5.x < 3.5.22 / 3.6.x < 3.6.25 / 4.0.x < 4.0.25 / 4.1.x < 4.1.17 TALLOC_FREE() RCE plugin ID 81485.
  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 samba_4_1_17.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

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

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

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

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: See also: Similar and related Nessus plugins:
  • 81440 - CentOS 5 : samba3x (CESA-2015:0249)
  • 81441 - CentOS 6 : samba4 (CESA-2015:0250)
  • 81442 - CentOS 6 : samba (CESA-2015:0251)
  • 81443 - CentOS 7 : samba (CESA-2015:0252)
  • 82139 - Debian DLA-156-1 : samba security update
  • 81450 - Debian DSA-3171-1 : samba - security update
  • 81463 - FreeBSD : samba -- Unexpected code execution in smbd (996c219c-bbb1-11e4-88ae-d050992ecde8)
  • 81536 - GLSA-201502-15 : Samba: Multiple vulnerabilities
  • 82334 - Mandriva Linux Security Advisory : samba (MDVSA-2015:081)
  • 82335 - Mandriva Linux Security Advisory : samba (MDVSA-2015:082)
  • 82336 - Mandriva Linux Security Advisory : samba4 (MDVSA-2015:083)
  • 81561 - openSUSE Security Update : samba (openSUSE-2015-179)
  • 90558 - openSUSE Security Update : samba (openSUSE-2016-462) (Badlock)
  • 90609 - openSUSE Security Update : samba (openSUSE-2016-490) (Badlock)
  • 81464 - Oracle Linux 5 : samba3x (ELSA-2015-0249)
  • 81465 - Oracle Linux 6 : samba4 (ELSA-2015-0250)
  • 81466 - Oracle Linux 6 : samba (ELSA-2015-0251)
  • 81467 - Oracle Linux 7 : samba (ELSA-2015-0252)
  • 81468 - RHEL 5 : samba3x (RHSA-2015:0249)
  • 81469 - RHEL 6 : samba4 (RHSA-2015:0250)
  • 81470 - RHEL 6 : samba (RHSA-2015:0251)
  • 81471 - RHEL 7 : samba (RHSA-2015:0252)
  • 81472 - RHEL 5 : samba3x (RHSA-2015:0253)
  • 81473 - RHEL 6 : samba (RHSA-2015:0254)
  • 81474 - RHEL 6 : samba4 (RHSA-2015:0255)
  • 81475 - RHEL 6 : Storage Server (RHSA-2015:0256)
  • 146265 - RHEL 6 : Storage Server (RHSA-2015:0257)
  • 81476 - Scientific Linux Security Update : samba4 on SL6.x i386/x86_64 (20150223)
  • 81477 - Scientific Linux Security Update : samba on SL5.x i386 (20150223)
  • 81478 - Scientific Linux Security Update : samba on SL6.x, SL7.x i386/x86_64 (20150223)
  • 81479 - Scientific Linux Security Update : samba on SL7.x x86_64 (20150223)
  • 81653 - Slackware 14.1 / current : samba (SSA:2015-064-01)
  • 81508 - SuSE 11.3 Security Update : Samba (SAT Patch Number 10321)
  • 83687 - SUSE SLED12 / SLES12 Security Update : samba (SUSE-SU-2015:0353-1)
  • 81483 - Ubuntu 12.04 LTS / 14.04 LTS / 14.10 : samba vulnerability (USN-2508-1)

Version


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

Go back to menu.