Class: WPScan::Target

Inherits:
CMSScanner::Target
  • Object
show all
Includes:
Platform::WordPress
Defined in:
lib/wpscan/target.rb,
lib/wpscan/target/platform/wordpress.rb,
lib/wpscan/target/platform/wordpress/custom_directories.rb

Overview

Includes the WordPress Platform

Defined Under Namespace

Modules: Platform

Constant Summary

Constants included from Platform::WordPress

Platform::WordPress::COOKIE_PATTERNS, Platform::WordPress::WORDPRESS_HOSTED_PATTERN, Platform::WordPress::WORDPRESS_PATTERN, Platform::WordPress::WP_ADMIN_AJAX_PATTERN, Platform::WordPress::WP_JSON_OEMBED_PATTERN

Instance Attribute Summary

Attributes included from Platform::WordPress

#mu_plugins, #multisite, #registration_enabled

Instance Method Summary collapse

Methods included from Platform::WordPress

#content_dir, #content_dir=, #content_uri, #content_url, #default_content_dir_exists?, #do_login, #login_request, #login_url, #maybe_add_cookies, #plugin_url, #plugins_dir, #plugins_dir=, #plugins_uri, #plugins_url, #registration_url, #sub_dir, #theme_url, #themes_dir, #themes_uri, #themes_url, #url, #wordpress?, #wordpress_from_meta_comments_or_scripts?, #wordpress_hosted?

Instance Method Details

#config_backups(opts = {}) ⇒ Array<ConfigBackup>

Parameters:

  • opts (Hash) (defaults to: {})

Returns:

  • (Array<ConfigBackup>)


80
81
82
# File 'lib/wpscan/target.rb', line 80

def config_backups(opts = {})
  @config_backups ||= Finders::ConfigBackups::Base.find(self, opts)
end

#db_exports(opts = {}) ⇒ Array<DBExport>

Parameters:

  • opts (Hash) (defaults to: {})

Returns:

  • (Array<DBExport>)


87
88
89
# File 'lib/wpscan/target.rb', line 87

def db_exports(opts = {})
  @db_exports ||= Finders::DbExports::Base.find(self, opts)
end

#head_or_get_request_paramsHash

Returns:

  • (Hash)


11
12
13
14
15
16
17
# File 'lib/wpscan/target.rb', line 11

def head_or_get_request_params
  @head_or_get_request_params ||= if Browser.head(url).code == 405
                                    { method: :get, maxfilesize: 1 }
                                  else
                                    { method: :head }
                                  end
end

#main_theme(opts = {}) ⇒ Theme

Parameters:

  • opts (Hash) (defaults to: {})

Returns:

  • (Theme)


50
51
52
53
54
# File 'lib/wpscan/target.rb', line 50

def main_theme(opts = {})
  @main_theme = Finders::MainTheme::Base.find(self, opts) if @main_theme.nil?

  @main_theme
end

#medias(opts = {}) ⇒ Array<Media>

Parameters:

  • opts (Hash) (defaults to: {})

Returns:

  • (Array<Media>)


94
95
96
# File 'lib/wpscan/target.rb', line 94

def medias(opts = {})
  @medias ||= Finders::Medias::Base.find(self, opts)
end

#plugins(opts = {}) ⇒ Array<Plugin>

Parameters:

  • opts (Hash) (defaults to: {})

Returns:

  • (Array<Plugin>)


59
60
61
# File 'lib/wpscan/target.rb', line 59

def plugins(opts = {})
  @plugins ||= Finders::Plugins::Base.find(self, opts)
end

#themes(opts = {}) ⇒ Array<Theme>

Parameters:

  • opts (Hash) (defaults to: {})

Returns:

  • (Array<Theme>)


66
67
68
# File 'lib/wpscan/target.rb', line 66

def themes(opts = {})
  @themes ||= Finders::Themes::Base.find(self, opts)
end

#timthumbs(opts = {}) ⇒ Array<Timthumb>

Parameters:

  • opts (Hash) (defaults to: {})

Returns:

  • (Array<Timthumb>)


73
74
75
# File 'lib/wpscan/target.rb', line 73

def timthumbs(opts = {})
  @timthumbs ||= Finders::Timthumbs::Base.find(self, opts)
end

#users(opts = {}) ⇒ Array<User>

Parameters:

  • opts (Hash) (defaults to: {})

Returns:

  • (Array<User>)


101
102
103
# File 'lib/wpscan/target.rb', line 101

def users(opts = {})
  @users ||= Finders::Users::Base.find(self, opts)
end

#vulnerable?Boolean

Returns:

  • (Boolean)


20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/wpscan/target.rb', line 20

def vulnerable?
  [@wp_version, @main_theme, @plugins, @themes, @timthumbs].each do |e|
    Array(e).each { |ae| return true if ae && ae.vulnerable? } # rubocop:disable Style/SafeNavigation
  end

  return true unless Array(@config_backups).empty?
  return true unless Array(@db_exports).empty?

  Array(@users).each { |u| return true if u.password }

  false
end

#wp_version(opts = {}) ⇒ WpVersion, false

Returns The WpVersion found or false if not detected.

Parameters:

  • opts (Hash) (defaults to: {})

Returns:

  • (WpVersion, false)

    The WpVersion found or false if not detected



41
42
43
44
45
# File 'lib/wpscan/target.rb', line 41

def wp_version(opts = {})
  @wp_version = Finders::WpVersion::Base.find(self, opts) if @wp_version.nil?

  @wp_version
end

#xmlrpcXMLRPC?

Returns:

  • (XMLRPC, nil)


34
35
36
# File 'lib/wpscan/target.rb', line 34

def xmlrpc
  @xmlrpc ||= interesting_findings&.select { |f| f.is_a?(Model::XMLRPC) }&.first
end