diff --git a/lib/msf/http/wordpress/base.rb b/lib/msf/http/wordpress/base.rb index 30296cade8..e67f46a40c 100644 --- a/lib/msf/http/wordpress/base.rb +++ b/lib/msf/http/wordpress/base.rb @@ -5,15 +5,25 @@ module Msf::HTTP::Wordpress::Base # # @return [Rex::Proto::Http::Response,nil] Returns the HTTP response if the site is online and running wordpress, nil otherwise def wordpress_and_online? + wordpress_detect_regexes = [ + /["'][^"']*\/#{Regexp.escape(wp_content_dir)}\/[^"']*["']/i, + //i, + //i + ] + res = send_request_cgi( 'method' => 'GET', 'uri' => normalize_uri(target_uri.path) ) - wordpress_detect_regexes = [ - /["'][^"']*\/#{Regexp.escape(wp_content_dir)}\/[^"']*["']/i, - //i, - //i - ] + + # handle one redirect + if res && res.redirect? && res.redirection + res = send_request_cgi( + 'method' => 'GET', + 'uri' => path_from_uri(res.redirection) + ) + end + return res if res && res.code == 200 && res.body && wordpress_detect_regexes.any? { |r| res.body =~ r } return nil rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout => e