FreeBSD : samba -- multiple vulnerabilities (3546a833-03ea-11dc-a51d-0019b95d4f14) - Nessus

Critical   Plugin ID: 25260

This page contains detailed information about the FreeBSD : samba -- multiple vulnerabilities (3546a833-03ea-11dc-a51d-0019b95d4f14) Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 25260
Name: FreeBSD : samba -- multiple vulnerabilities (3546a833-03ea-11dc-a51d-0019b95d4f14)
Filename: freebsd_pkg_3546a83303ea11dca51d0019b95d4f14.nasl
Vulnerability Published: 2007-05-14
This Plugin Published: 2007-05-20
Last Modification Time: 2021-01-06
Plugin Version: 1.20
Plugin Type: local
Plugin Family: FreeBSD Local Security Checks
Dependencies: ssh_get_info.nasl
Required KB Items [?]: Host/FreeBSD/pkg_info, Host/FreeBSD/release, Host/local_checks_enabled

Vulnerability Information


Severity: Critical
Vulnerability Published: 2007-05-14
Patch Published: 2007-05-16
CVE [?]: CVE-2007-2444, CVE-2007-2446, CVE-2007-2447
CPE [?]: cpe:/o:freebsd:freebsd, p-cpe:/a:freebsd:freebsd:ja-samba, p-cpe:/a:freebsd:freebsd:samba

Synopsis

The remote FreeBSD host is missing one or more security-related updates.

Description

The Samba Team reports :

A bug in the local SID/Name translation routines may potentially result in a user being able to issue SMB/CIFS protocol operations as root.

When translating SIDs to/from names using Samba local list of user and group accounts, a logic error in the smbd daemon's internal security stack may result in a transition to the root user id rather than the non-root user. The user is then able to temporarily issue SMB/CIFS protocol operations as the root user. This window of opportunity may allow the attacker to establish additional means of gaining root access to the server.

Various bugs in Samba's NDR parsing can allow a user to send specially crafted MS-RPC requests that will overwrite the heap space with user defined data.

Unescaped user input parameters are passed as arguments to /bin/sh allowing for remote command execution.

This bug was originally reported against the anonymous calls to the SamrChangePassword() MS-RPC function in combination with the 'username map script' smb.conf option (which is not enabled by default).

After further investigation by Samba developers, it was determined that the problem was much broader and impacts remote printer and file share management as well. The root cause is passing unfiltered user input provided via MS-RPC calls to /bin/sh when invoking externals scripts defined in smb.conf. However, unlike the 'username map script' vulnerability, the remote file and printer management scripts require an authenticated user session.

Solution

Update the affected packages.

Public Exploits


Target Network Port(s): N/A
Target Asset(s): N/A
Exploit Available: True (Metasploit Framework, Exploit-DB, GitHub, Immunity Canvas, Core Impact)
Exploit Ease: Exploits are available

Here's the list of publicly known exploits and PoCs for verifying the FreeBSD : samba -- multiple vulnerabilities (3546a833-03ea-11dc-a51d-0019b95d4f14) vulnerability:

  1. Metasploit: exploit/multi/samba/usermap_script
    [Samba "username map script" Command Execution]
  2. Metasploit: auxiliary/dos/samba/lsa_addprivs_heap
    [Samba lsa_io_privilege_set Heap Overflow]
  3. Metasploit: auxiliary/dos/samba/lsa_transnames_heap
    [Samba lsa_io_trans_names Heap Overflow]
  4. Metasploit: exploit/linux/samba/lsa_transnames_heap
    [Samba lsa_io_trans_names Heap Overflow]
  5. Metasploit: exploit/osx/samba/lsa_transnames_heap
    [Samba lsa_io_trans_names Heap Overflow]
  6. Metasploit: exploit/solaris/samba/lsa_transnames_heap
    [Samba lsa_io_trans_names Heap Overflow]
  7. Exploit-DB: exploits/linux/remote/9950.rb
    [EDB-9950: Samba 3.0.21 < 3.0.24 - LSA trans names Heap Overflow (Metasploit)]
  8. Exploit-DB: exploits/unix/remote/16320.rb
    [EDB-16320: Samba 3.0.20 < 3.0.25rc3 - 'Username' map script' Command Execution (Metasploit)]
  9. Exploit-DB: exploits/solaris/remote/16329.rb
    [EDB-16329: Samba 3.0.24 (Solaris) - 'lsa_io_trans_names' Heap Overflow (Metasploit)]
  10. Exploit-DB: exploits/linux/remote/16859.rb
    [EDB-16859: Samba 3.0.24 (Linux) - 'lsa_io_trans_names' Heap Overflow (Metasploit)]
  11. Exploit-DB: exploits/osx/remote/16875.rb
    [EDB-16875: Samba 3.0.10 (OSX) - 'lsa_io_trans_names' Heap Overflow (Metasploit)]
  12. GitHub: https://github.com/DOCTOR-ANR/cybercaptor-server
    [CVE-2007-2446]
  13. GitHub: https://github.com/Larryxi/My_tools
    [CVE-2007-2446]
  14. GitHub: https://github.com/fiware-cybercaptor/cybercaptor-server
    [CVE-2007-2446]
  15. GitHub: https://github.com/mudongliang/LinuxFlaw/tree/master/CVE-2007-2446
    [CVE-2007-2446]
  16. GitHub: https://github.com/0xKn/CVE-2007-2447
    [CVE-2007-2447]
  17. GitHub: https://github.com/0xkasra/CVE-2007-2447
    [CVE-2007-2447]
  18. GitHub: https://github.com/3hydraking/usermap_script_CVE-2007-2447
    [CVE-2007-2447]
  19. GitHub: https://github.com/3t4n/samba-3.0.24-CVE-2007-2447-vunerable-
    [CVE-2007-2447]
  20. GitHub: https://github.com/3x1t1um/CVE-2007-2447
    [CVE-2007-2447]
  21. GitHub: https://github.com/4n0nym0u5dk/usermap_script_CVE-2007-2447
    [CVE-2007-2447]
  22. GitHub: https://github.com/Alien0ne/CVE-2007-2447
    [CVE-2007-2447: CVE-2007-2447 - Samba usermap script]
  23. GitHub: https://github.com/GaloisInc/msf-haskell
    [CVE-2007-2447]
  24. GitHub: https://github.com/JoseBarrios/CVE-2007-2447
    [CVE-2007-2447: Remote Command Injection Vulnerability (CVE-2007-2447), allows remote attackers to ...]
  25. GitHub: https://github.com/SamHackingArticles/CVE-2007-2447
    [CVE-2007-2447]
  26. GitHub: https://github.com/Un4gi/CVE-2007-2447
    [CVE-2007-2447: Samba 3.0.20 username map script exploit]
  27. GitHub: https://github.com/Unam3dd/exploit_smb_usermap_script
    [CVE-2007-2447: Python Script Exploit SMB Usermap Script CVE-2007-2447]
  28. GitHub: https://github.com/Unix13/metasploitable2
    [CVE-2007-2447: PHP-CGI-REMOTE_CVE-2012-1823, UnrealIRCd, MySQL, PostgreSQL and SSH bruteforce, ...]
  29. GitHub: https://github.com/WildfootW/CVE-2007-2447_Samba_3.0.25rc3
    [CVE-2007-2447]
  30. GitHub: https://github.com/Ziemni/CVE-2007-2447-in-Python
    [CVE-2007-2447: Python implementation of 'Username' map script' RCE Exploit for Samba 3.0.20 < ...]
  31. GitHub: https://github.com/cherrera0001/CVE-2007-2447
    [CVE-2007-2447: Samba usermap script.]
  32. GitHub: https://github.com/gwyomarch/Lame-HTB-Writeup-FR
    [CVE-2007-2447]
  33. GitHub: https://github.com/k4u5h41/usermap_script_CVE-2007-2447
    [CVE-2007-2447]
  34. GitHub: https://github.com/macosta-42/Exploit-Development
    [CVE-2007-2447]
  35. GitHub: https://github.com/marcocastro100/Intrusion_Detection_System-Python
    [CVE-2007-2447]
  36. GitHub: https://github.com/persian64/CVE-2007-2447
    [CVE-2007-2447]
  37. GitHub: https://github.com/pwnd-root/exploits-and-stuff
    [CVE-2007-2447]
  38. GitHub: https://github.com/voukatas/PenTest_Metasploitable2
    [CVE-2007-2447]
  39. GitHub: https://github.com/xbufu/CVE-2007-2447
    [CVE-2007-2447: Exploit code for CVE-2007-2447 written in Python3.]
  40. GitHub: https://github.com/xlcc4096/exploit-CVE-2007-2447
    [CVE-2007-2447: Exploit for the vulnerability CVE-2007-2447]
  41. GitHub: https://github.com/yukitsukai47/PenetrationTesting_cheatsheet
    [CVE-2007-2447]
  42. GitHub: https://github.com/amriunix/CVE-2007-2447
    [CVE-2007-2447: CVE-2007-2447 - Samba usermap script]
  43. GitHub: https://github.com/b1fair/smb_usermap
    [CVE-2007-2447: A simple exploit for CVE-2007-2447]
  44. GitHub: https://github.com/nickvourd/smb-usermap-destroyer
    [CVE-2007-2447: Smb Usermap Destoyer is a python2 exploit for CVE-2007-2447 ( 'Username' map script' ...]
  45. GitHub: https://github.com/ozuma/CVE-2007-2447
    [CVE-2007-2447: Exploit Samba]
  46. GitHub: https://github.com/Ki11i0n4ir3/Sambaster
    [CVE-2007-2447: Cve-2007-2447 this script was rewrite the part of Metasploit modules to python3]
  47. 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 V2 Vector [?]: AV:N/AC:L/Au:N/C:C/I:C/A:C
CVSS Base Score:10.0 (High)
Impact Subscore:10.0
Exploitability Subscore:10.0
CVSS Temporal Score:NA (None)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:10.0 (High)

Go back to menu.

Plugin Source


This is the freebsd_pkg_3546a83303ea11dca51d0019b95d4f14.nasl nessus plugin source code. This script is Copyright (C) 2007-2021 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 FreeBSD VuXML database :
#
# Copyright 2003-2018 Jacques Vidrine and contributors
#
# Redistribution and use in source (VuXML) and 'compiled' forms (SGML,
# HTML, PDF, PostScript, RTF and so forth) with or without modification,
# are permitted provided that the following conditions are met:
# 1. Redistributions of source code (VuXML) must retain the above
#    copyright notice, this list of conditions and the following
#    disclaimer as the first lines of this file unmodified.
# 2. Redistributions in compiled form (transformed to other DTDs,
#    published online in any format, converted to PDF, PostScript,
#    RTF and other formats) must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer
#    in the documentation and/or other materials provided with the
#    distribution.
# 
# THIS DOCUMENTATION IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS DOCUMENTATION,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

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

if (description)
{
  script_id(25260);
  script_version("1.20");
  script_set_attribute(attribute:"plugin_modification_date", value:"2021/01/06");

  script_cve_id("CVE-2007-2444", "CVE-2007-2446", "CVE-2007-2447");

  script_name(english:"FreeBSD : samba -- multiple vulnerabilities (3546a833-03ea-11dc-a51d-0019b95d4f14)");
  script_summary(english:"Checks for updated packages in pkg_info output");

  script_set_attribute(
    attribute:"synopsis", 
    value:
"The remote FreeBSD host is missing one or more security-related
updates."
  );
  script_set_attribute(
    attribute:"description", 
    value:
"The Samba Team reports :

A bug in the local SID/Name translation routines may potentially
result in a user being able to issue SMB/CIFS protocol operations as
root.

When translating SIDs to/from names using Samba local list of user and
group accounts, a logic error in the smbd daemon's internal security
stack may result in a transition to the root user id rather than the
non-root user. The user is then able to temporarily issue SMB/CIFS
protocol operations as the root user. This window of opportunity may
allow the attacker to establish additional means of gaining root
access to the server.

Various bugs in Samba's NDR parsing can allow a user to send specially
crafted MS-RPC requests that will overwrite the heap space with user
defined data.

Unescaped user input parameters are passed as arguments to /bin/sh
allowing for remote command execution.

This bug was originally reported against the anonymous calls to the
SamrChangePassword() MS-RPC function in combination with the 'username
map script' smb.conf option (which is not enabled by default).

After further investigation by Samba developers, it was determined
that the problem was much broader and impacts remote printer and file
share management as well. The root cause is passing unfiltered user
input provided via MS-RPC calls to /bin/sh when invoking externals
scripts defined in smb.conf. However, unlike the 'username map script'
vulnerability, the remote file and printer management scripts require
an authenticated user session."
  );
  # http://de5.samba.org/samba/security/CVE-2007-2444.html
  script_set_attribute(
    attribute:"see_also",
    value:"https://www.samba.org/samba/security/CVE-2007-2444.html"
  );
  # http://de5.samba.org/samba/security/CVE-2007-2446.html
  script_set_attribute(
    attribute:"see_also",
    value:"https://www.samba.org/samba/security/CVE-2007-2446.html"
  );
  # http://de5.samba.org/samba/security/CVE-2007-2447.html
  script_set_attribute(
    attribute:"see_also",
    value:"https://www.samba.org/samba/security/CVE-2007-2447.html"
  );
  # https://vuxml.freebsd.org/freebsd/3546a833-03ea-11dc-a51d-0019b95d4f14.html
  script_set_attribute(
    attribute:"see_also",
    value:"http://www.nessus.org/u?5bcbde7b"
  );
  script_set_attribute(attribute:"solution", value:"Update the affected packages.");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:C/I:C/A:C");
  script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
  script_set_attribute(attribute:"exploit_available", value:"true");
  script_set_attribute(attribute:"exploit_framework_core", value:"true");
  script_set_attribute(attribute:"metasploit_name", value:'Samba "username map script" Command Execution');
  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:"plugin_type", value:"local");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:freebsd:freebsd:ja-samba");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:freebsd:freebsd:samba");
  script_set_attribute(attribute:"cpe", value:"cpe:/o:freebsd:freebsd");

  script_set_attribute(attribute:"vuln_publication_date", value:"2007/05/14");
  script_set_attribute(attribute:"patch_publication_date", value:"2007/05/16");
  script_set_attribute(attribute:"plugin_publication_date", value:"2007/05/20");
  script_end_attributes();

  script_category(ACT_GATHER_INFO);
  script_copyright(english:"This script is Copyright (C) 2007-2021 and is owned by Tenable, Inc. or an Affiliate thereof.");
  script_family(english:"FreeBSD Local Security Checks");

  script_dependencies("ssh_get_info.nasl");
  script_require_keys("Host/local_checks_enabled", "Host/FreeBSD/release", "Host/FreeBSD/pkg_info");

  exit(0);
}


include("audit.inc");
include("freebsd_package.inc");


if (!get_kb_item("Host/local_checks_enabled")) audit(AUDIT_LOCAL_CHECKS_NOT_ENABLED);
if (!get_kb_item("Host/FreeBSD/release")) audit(AUDIT_OS_NOT, "FreeBSD");
if (!get_kb_item("Host/FreeBSD/pkg_info")) audit(AUDIT_PACKAGE_LIST_MISSING);


flag = 0;

if (pkg_test(save_report:TRUE, pkg:"samba>3.*<3.0.25")) flag++;
if (pkg_test(save_report:TRUE, pkg:"samba>3.*,1<3.0.25,1")) flag++;
if (pkg_test(save_report:TRUE, pkg:"ja-samba>3.*<3.0.25")) flag++;
if (pkg_test(save_report:TRUE, pkg:"ja-samba>3.*,1<3.0.25,1")) flag++;

if (flag)
{
  if (report_verbosity > 0) security_hole(port:0, extra:pkg_report_get());
  else security_hole(0);
  exit(0);
}
else 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/freebsd_pkg_3546a83303ea11dca51d0019b95d4f14.nasl
  • Windows:
    C:\ProgramData\Tenable\Nessus\nessus\plugins\freebsd_pkg_3546a83303ea11dca51d0019b95d4f14.nasl
  • Mac OS X:
    /Library/Nessus/run/lib/nessus/plugins/freebsd_pkg_3546a83303ea11dca51d0019b95d4f14.nasl

Go back to menu.

How to Run


Here is how to run the FreeBSD : samba -- multiple vulnerabilities (3546a833-03ea-11dc-a51d-0019b95d4f14) 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 FreeBSD Local Security Checks plugin family.
  6. On the right side table select FreeBSD : samba -- multiple vulnerabilities (3546a833-03ea-11dc-a51d-0019b95d4f14) plugin ID 25260.
  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 freebsd_pkg_3546a83303ea11dca51d0019b95d4f14.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

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

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

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

Go back to menu.

References


See also: Similar and related Nessus plugins:
  • 25224 - CentOS 3 / 4 / 5 : samba (CESA-2007:0354)
  • 25228 - Debian DSA-1291-1 : samba - several vulnerabilities
  • 25233 - Fedora Core 5 : samba-3.0.24-5.fc5 (2007-506)
  • 25234 - Fedora Core 6 : samba-3.0.24-5.fc6 (2007-507)
  • 25236 - GLSA-200705-15 : Samba: Multiple vulnerabilities
  • 25830 - Mac OS X Multiple Vulnerabilities (Security Update 2007-007)
  • 25237 - Mandrake Linux Security Advisory : samba (MDKSA-2007:104-1)
  • 67499 - Oracle Linux 3 / 4 / 5 : samba (ELSA-2007-0354)
  • 25239 - RHEL 2.1 / 3 / 4 / 5 : samba (RHSA-2007:0354)
  • 25217 - Samba < 3.0.25 Multiple Vulnerabilities
  • 82580 - Samba 3.0.0 'SamrChangePassword' RCE
  • 25216 - Samba NDR MS-RPC Request Heap-Based Remote Buffer Overflow
  • 60180 - Scientific Linux Security Update : samba on SL5.x, SL4.x, SL3.x i386/x86_64
  • 25222 - Slackware 10.0 / 10.1 / 10.2 / 11.0 / current : samba (SSA:2007-134-01)
  • 27429 - openSUSE 10 Security Update : samba (samba-3349)
  • 27430 - openSUSE 10 Security Update : samba (samba-3350)
  • 29576 - SuSE 10 Security Update : Samba (ZYPP Patch Number 3351)
  • 27431 - openSUSE 10 Security Update : samba (samba-3827)
  • 27432 - openSUSE 10 Security Update : samba (samba-3828)
  • 29577 - SuSE 10 Security Update : Samba (ZYPP Patch Number 3829)
  • 28059 - Ubuntu 6.06 LTS / 6.10 / 7.04 : samba vulnerabilities (USN-460-1)
  • 40370 - VMSA-2007-0006 : Critical security updates for all supported versions of VMware ESX Server, VMware Server, VMware Workstation, VMware ACE, and VMware Player
  • 29965 - Xerox WorkCentre Multiple Samba Vulnerabilities (XRX08-001)

Version


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

Go back to menu.