Samba NDR MS-RPC Request Heap-Based Remote Buffer Overflow - Nessus

Critical   Plugin ID: 25216

This page contains detailed information about the Samba NDR MS-RPC Request Heap-Based Remote Buffer Overflow Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 25216
Name: Samba NDR MS-RPC Request Heap-Based Remote Buffer Overflow
Filename: samba_overflow.nasl
Vulnerability Published: 2007-05-14
This Plugin Published: 2007-05-15
Last Modification Time: 2018-07-27
Plugin Version: 1.20
Plugin Type: local
Plugin Family: Misc.
Dependencies: smb_nativelanman.nasl
Required KB Items [?]: SMB/NativeLanManager

Vulnerability Information


Severity: Critical
Vulnerability Published: 2007-05-14
Patch Published: 2007-07-11
CVE [?]: CVE-2007-2446
CPE [?]: cpe:/a:samba:samba

Synopsis

It is possible to execute code on the remote host through Samba.

Description

The version of the Samba server installed on the remote host is affected by multiple heap overflow vulnerabilities, which can be exploited remotely to execute code with the privileges of the Samba daemon.

Solution

Upgrade to Samba version 3.0.25 or later.

Public Exploits


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

Here's the list of publicly known exploits and PoCs for verifying the Samba NDR MS-RPC Request Heap-Based Remote Buffer Overflow vulnerability:

  1. Metasploit: auxiliary/dos/samba/lsa_transnames_heap
    [Samba lsa_io_trans_names Heap Overflow]
  2. Metasploit: exploit/linux/samba/lsa_transnames_heap
    [Samba lsa_io_trans_names Heap Overflow]
  3. Metasploit: exploit/osx/samba/lsa_transnames_heap
    [Samba lsa_io_trans_names Heap Overflow]
  4. Metasploit: exploit/solaris/samba/lsa_transnames_heap
    [Samba lsa_io_trans_names Heap Overflow]
  5. Metasploit: auxiliary/dos/samba/lsa_addprivs_heap
    [Samba lsa_io_privilege_set Heap Overflow]
  6. Exploit-DB: exploits/linux/remote/9950.rb
    [EDB-9950: Samba 3.0.21 < 3.0.24 - LSA trans names Heap Overflow (Metasploit)]
  7. Exploit-DB: exploits/solaris/remote/16329.rb
    [EDB-16329: Samba 3.0.24 (Solaris) - 'lsa_io_trans_names' Heap Overflow (Metasploit)]
  8. Exploit-DB: exploits/linux/remote/16859.rb
    [EDB-16859: Samba 3.0.24 (Linux) - 'lsa_io_trans_names' Heap Overflow (Metasploit)]
  9. Exploit-DB: exploits/osx/remote/16875.rb
    [EDB-16875: Samba 3.0.10 (OSX) - 'lsa_io_trans_names' Heap Overflow (Metasploit)]
  10. GitHub: https://github.com/DOCTOR-ANR/cybercaptor-server
    [CVE-2007-2446]
  11. GitHub: https://github.com/Larryxi/My_tools
    [CVE-2007-2446]
  12. GitHub: https://github.com/fiware-cybercaptor/cybercaptor-server
    [CVE-2007-2446]
  13. GitHub: https://github.com/mudongliang/LinuxFlaw/tree/master/CVE-2007-2446
    [CVE-2007-2446]
  14. 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/E:F/RL:OF/RC:C
CVSS Base Score:10.0 (High)
Impact Subscore:10.0
Exploitability Subscore:10.0
CVSS Temporal Score:8.3 (High)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:8.3 (High)
CVSS V3 Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H/E:F/RL:O/RC:C
CVSS Base Score:9.8 (Critical)
Impact Subscore:5.9
Exploitability Subscore:3.9
CVSS Temporal Score:9.1 (Critical)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:9.1 (Critical)

Go back to menu.

Plugin Source


This is the samba_overflow.nasl nessus plugin source code. This script is Copyright (C) 2007-2018 and is owned by Tenable, Inc. or an Affiliate thereof.

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


include("compat.inc");

if (description)
{
  script_id(25216);
  script_version("1.20");
 script_cvs_date("Date: 2018/07/27 18:38:14");

  script_cve_id("CVE-2007-2446");
  script_bugtraq_id(23973, 24195, 24196, 24197, 24198);

  script_name(english:"Samba NDR MS-RPC Request Heap-Based Remote Buffer Overflow");
  script_summary(english:"Checks version of Samba");

 script_set_attribute(attribute:"synopsis", value:"It is possible to execute code on the remote host through Samba.");
 script_set_attribute(attribute:"description", value:
"The version of the Samba server installed on the remote host is
affected by multiple heap overflow vulnerabilities, which can be
exploited remotely to execute code with the privileges of the Samba
daemon.");
 script_set_attribute(attribute:"see_also", value:"http://www.samba.org/samba/security/CVE-2007-2446.html");
 script_set_attribute(attribute:"solution", value:"Upgrade to Samba version 3.0.25 or later.");
 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:F/RL:OF/RC:C");
 script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:L/PR:N/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:"exploitability_ease", value:"Exploits are available");
 script_set_attribute(attribute:"exploit_available", value:"true");
 script_set_attribute(attribute:"metasploit_name", value:'Samba lsa_io_trans_names Heap Overflow');
 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:"vuln_publication_date", value:"2007/05/14");
 script_set_attribute(attribute:"patch_publication_date", value:"2007/07/11");
 script_set_attribute(attribute:"plugin_publication_date", value:"2007/05/15");

script_set_attribute(attribute:"plugin_type", value:"local");
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) 2007-2018 and is owned by Tenable, Inc. or an Affiliate thereof.");

  script_dependencies("smb_nativelanman.nasl");
  script_require_keys("SMB/NativeLanManager");
  script_require_ports(139, 445);

  exit(0);
}


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


function LsaLookupSid2 (handle, sid_array)
{
 local_var ref_id, data, sid, count, names, rep;

 ref_id = 0x20000;

 data = handle[0]  +  # Handle

        # PSID Array
        raw_dword (d:max_index (sid_array))  + # number of sid in PSID Array
        raw_dword (d:ref_id)                 + # Referent ID
        raw_dword (d:max_index (sid_array)) ;  # max_count

 ref_id++;

 # ref_id
 foreach sid (sid_array)
 {
  data += raw_dword (d:ref_id);

  ref_id++;
 }

 foreach sid (sid_array)
 {
  count = ord(sid[1]);

  data += raw_dword (d:count)   +
          sid ;
 }


 data += raw_dword (d:2)         + # count = 2 (1 more to test the flaw)
         raw_dword (d:0x20004)   + # (LSA_TRANSLATED_NAMES)
         raw_dword (d:1)         + # only 1 entry

         # name
         raw_dword (d:1) +
	 raw_word (w:0)  +
         raw_word (w:0)  +
         raw_dword (d:0) +
         raw_dword (d:0) +

         raw_dword (d:1)        + # Level (nothing else seems to work)
         raw_dword (d:0)        ; # Num mapped ?

 data = dce_rpc_pipe_request (fid:handle[1], code:OPNUM_LSALOOKUPSID, data:data);
 if (!data)
   return NULL;

 rep = dce_rpc_parse_response (fid:handle[1], data:data);
 if (!rep || (strlen (rep) < 20))
   return NULL;

 return rep;
}


lanman = get_kb_item("SMB/NativeLanManager");
if ("Samba" >!< lanman)
  audit(AUDIT_HOST_NOT, "running Samba" );


sid = raw_string (0x01,0x02,0x00,0x00,0x00,0x00,0x00,0x05,0x20,0x00,0x00,0x00,0x20,0x02,0x00,0x00);

name	= kb_smb_name();
port	= kb_smb_transport();




if(! smb_session_init()) audit(AUDIT_FN_FAIL, 'smb_session_init');
r = NetUseAdd(share:"IPC$");
if ( r != 1 ) audit(AUDIT_SHARE_FAIL, "IPC$");

group = NULL;

lsa = LsaOpenPolicy (desired_access:0x20801);
if (!isnull(lsa))
{
 sids = NULL;
 sids[0] = sid;
 names = LsaLookupSid2 (handle:lsa, sid_array:sids);
 if (!isnull(names))
   security_hole(port);

 LsaClose (handle:lsa);
 NetUseDel();
}
else
{
  NetUseDel();
  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/samba_overflow.nasl
  • Windows:
    C:\ProgramData\Tenable\Nessus\nessus\plugins\samba_overflow.nasl
  • Mac OS X:
    /Library/Nessus/run/lib/nessus/plugins/samba_overflow.nasl

Go back to menu.

How to Run


Here is how to run the Samba NDR MS-RPC Request Heap-Based Remote Buffer Overflow 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 NDR MS-RPC Request Heap-Based Remote Buffer Overflow plugin ID 25216.
  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_overflow.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

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

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

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

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: See also: Similar and related Nessus plugins:
  • 25224 - CentOS 3 / 4 / 5 : samba (CESA-2007:0354)
  • 25228 - Debian DSA-1291-1 : samba - several vulnerabilities
  • 25260 - FreeBSD : samba -- multiple vulnerabilities (3546a833-03ea-11dc-a51d-0019b95d4f14)
  • 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
  • 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)
  • 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)
  • 73498 - A10 Networks Remote Buffer Overflow
  • 83763 - Citrix XenServer QEMU FDC Buffer Overflow RCE (CTX201078) (VENOM)
  • 76348 - HylaFAX+ 5.2.4 < 5.5.4 Remote Buffer Overflow
  • 151882 - Libgcrypt < 1.9.1 Heap Buffer Overflow Vulnerability
  • 70103 - IBM Lotus Sametime Multiplexer Buffer Overflow
  • 69319 - Mac OS X Directory Service Buffer Overflow
  • 108521 - MikroTik RouterOS < 6.40.7 or 6.41.x < 6.41.3 SMB Buffer Overflow
  • 29253 - Samba < 3.0.28 send_mailslot Function Remote Buffer Overflow
  • 17720 - Samba SWAT 3.0.2 - 3.0.4 HTTP Basic Auth base64 Buffer Overflow
  • 58662 - Samba 3.x < 3.6.4 / 3.5.14 / 3.4.16 RPC Multiple Buffer Overflows
  • 142712 - Oracle Solaris PAM parse_user_name() buffer overflow (CVE-2020-14871)
  • 25929 - SurgeMail IMAP Server SEARCH Command Remote Buffer Overflow
  • 146102 - VLC < 3.0.12 Buffer Overflow
  • 105614 - ESXi 6.5 < Build 6765664 Heap Buffer Overflow (VMSA-2017-0021) (remote check)

Version


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

Go back to menu.