Files
wpscan/app/finders/interesting_findings/upload_sql_dump.rb
2019-03-24 13:01:29 +00:00

32 lines
853 B
Ruby

# frozen_string_literal: true
module WPScan
module Finders
module InterestingFindings
# UploadSQLDump finder
class UploadSQLDump < CMSScanner::Finders::Finder
SQL_PATTERN = /(?:DROP|CREATE|(?:UN)?LOCK) TABLE|INSERT INTO/.freeze
# @return [ InterestingFinding ]
def aggressive(_opts = {})
head_res = browser.forge_request(dump_url, target.head_or_get_request_params).run
return unless head_res.code == 200
return unless Browser.get(dump_url, headers: { 'Range' => 'bytes=0-3000' }).body =~ SQL_PATTERN
Model::UploadSQLDump.new(
dump_url,
confidence: 100,
found_by: DIRECT_ACCESS
)
end
def dump_url
@dump_url ||= target.url('wp-content/uploads/dump.sql')
end
end
end
end
end