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

93 lines
2.1 KiB
Ruby
Raw Normal View History

2012-12-06 21:30:23 +00:00
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# web site for more information on licensing and terms of use.
# http://metasploit.com/
##
require 'msf/core'
class Metasploit3 < Msf::Auxiliary
include Msf::Exploit::Remote::HttpClient
include Msf::Auxiliary::Report
include Msf::Auxiliary::Scanner
def initialize
super(
'Name' => 'SVN wc.db Scanner',
'Description' => %q{
2012-12-18 17:46:27 +00:00
Scan for servers that allow access to the SVN wc.db file.
Based on the work by Tim Meddin.
2012-12-06 21:30:23 +00:00
},
'Author' =>
[
2012-12-06 22:18:50 +00:00
'Stephen Haywood <stephen[at]averagesecurityguy.info>',
2012-12-06 21:30:23 +00:00
],
'References' =>
[
2012-12-06 22:18:50 +00:00
['URL', 'http://pen-testing.sans.org/blog/pen-testing/2012/12/06/all-your-svn-are-belong-to-us#']
2012-12-06 21:30:23 +00:00
],
'License' => MSF_LICENSE
)
2012-12-18 17:46:27 +00:00
register_advanced_options(
[
2012-12-18 17:46:27 +00:00
OptString.new('BASE_PATH', [false, 'Path to the directory with the .svn folder.', nil])
], self.class)
2012-12-06 21:30:23 +00:00
end
def run_host(ip)
if datastore['BASE_PATH']
get_wcdb(datastore['BASE_PATH'] + '/.svn/wc.db')
else
get_wcdb('/.svn/wc.db')
end
2012-12-06 21:30:23 +00:00
end
2012-12-18 17:46:27 +00:00
def get_wcdb(path)
proto = (ssl ? 'https://' : 'http://')
vprint_status("Trying #{proto}#{vhost}:#{rport}#{path}")
2012-12-06 21:30:23 +00:00
begin
res = send_request_cgi(
{
'method' => 'GET',
2012-12-06 22:18:50 +00:00
'uri' => path,
2012-12-06 21:30:23 +00:00
'ctype' => 'text/plain'
}
)
2012-12-06 21:30:23 +00:00
2012-12-06 22:18:50 +00:00
if res and res.code == 200
print_good("SVN wc.db database found on #{vhost}:#{rport}")
2012-12-18 17:46:27 +00:00
file = store_loot(
"svn.wcdb.database",
"application/octet-stream",
vhost,
res.body,
"wc.db",
"SVN wc.db database"
)
2012-12-18 17:46:27 +00:00
print_good("SVN wc.db database stored in #{file}")
report_note(
:host => rhost,
:port => rport,
:proto => 'tcp',
:sname => (ssl ? 'https' : 'http'),
:type => 'svn_wc_database',
:data => "SVN wc.db database is stored in #{file}"
)
2012-12-06 21:30:23 +00:00
else
vprint_error("SVN wc.db database not found on #{vhost}:#{rport}")
2012-12-06 21:30:23 +00:00
end
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
rescue ::Timeout::Error, ::Errno::EPIPE
end
end
end