Class: WPScan::Finders::Timthumbs::KnownLocations

Inherits:
Finder
  • Object
show all
Includes:
Finder::Enumerator
Defined in:
app/finders/timthumbs/known_locations.rb

Overview

Known Locations Timthumbs Finder Note: A vulnerable version, 2.8.13 can be found here: github.com/GabrielGil/TimThumb/blob/980c3d6a823477761570475e8b83d3e9fcd2d7ae/timthumb.php

Constant Summary

Constants inherited from Finder

Finder::DIRECT_ACCESS

Instance Attribute Summary

Attributes inherited from Finder

#progress_bar, #target

Instance Method Summary collapse

Methods included from Finder::Enumerator

#enumerate, #full_request_params, #head_or_get_request_params, #maybe_get_full_response

Methods inherited from Finder

#browser, #found_by, #hydra, #initialize, #passive, #titleize

Constructor Details

This class inherits a constructor from WPScan::Finders::Finder

Instance Method Details

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

Parameters:

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

Options Hash (opts):

  • :list (String)

    Mandatory

Returns:

  • (Array<Timthumb>)


21
22
23
24
25
26
27
28
29
30
31
# File 'app/finders/timthumbs/known_locations.rb', line 21

def aggressive(opts = {})
  found = []

  enumerate(target_urls(opts), opts.merge(check_full_response: 400)) do |res|
    next unless /no image specified/i.match?(res.body)

    found << Model::Timthumb.new(res.request.url, opts.merge(found_by: found_by, confidence: 100))
  end

  found
end

#create_progress_bar(opts = {}) ⇒ Object



61
62
63
# File 'app/finders/timthumbs/known_locations.rb', line 61

def create_progress_bar(opts = {})
  super(opts.merge(title: ' Checking Known Locations -'))
end

#main_theme_timthumbs_pathsObject



56
57
58
59
# File 'app/finders/timthumbs/known_locations.rb', line 56

def main_theme_timthumbs_paths
  %w[timthumb.php lib/timthumb.php inc/timthumb.php includes/timthumb.php
     scripts/timthumb.php tools/timthumb.php functions/timthumb.php]
end

#target_urls(opts = {}) ⇒ Hash

Parameters:

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

Options Hash (opts):

  • :list (String)

    Mandatory

Returns:

  • (Hash)


37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'app/finders/timthumbs/known_locations.rb', line 37

def target_urls(opts = {})
  urls = {}

  File.open(opts[:list]) do |f|
    f.each_with_index do |path, index|
      urls[target.url(path.chomp)] = index
    end
  end

  # Add potential timthumbs located in the main theme
  if target.main_theme
    main_theme_timthumbs_paths.each do |path|
      urls[target.main_theme.url(path)] = 1 # index not important there
    end
  end

  urls
end

#valid_response_codesArray<Integer>

Returns:

  • (Array<Integer>)


13
14
15
# File 'app/finders/timthumbs/known_locations.rb', line 13

def valid_response_codes
  @valid_response_codes ||= [400]
end