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

88 lines
2.2 KiB
Ruby
Raw Normal View History

2012-12-06 21:30:23 +00:00
##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
2012-12-06 21:30:23 +00:00
##
require 'msf/core'
class Metasploit3 < Msf::Auxiliary
2012-12-06 21:30:23 +00:00
2013-08-30 21:28:54 +00:00
include Msf::Exploit::Remote::HttpClient
include Msf::Auxiliary::Report
include Msf::Auxiliary::Scanner
2012-12-06 21:30:23 +00:00
2013-08-30 21:28:54 +00:00
def initialize
super(
'Name' => 'SVN wc.db Scanner',
'Description' => %q{
Scan for servers that allow access to the SVN wc.db file.
Based on the work by Tim Meddin.
},
'Author' =>
[
'Stephen Haywood <stephen[at]averagesecurityguy.info>',
],
'References' =>
[
['URL', 'http://pen-testing.sans.org/blog/pen-testing/2012/12/06/all-your-svn-are-belong-to-us#']
],
'License' => MSF_LICENSE
)
2012-12-18 17:46:27 +00:00
2013-08-30 21:28:54 +00:00
register_advanced_options(
[
OptString.new('TARGETURI', [false, 'Base path to the .svn directory', '/.svn/'])
], self.class)
end
2012-12-06 21:30:23 +00:00
2013-08-30 21:28:54 +00:00
def run_host(ip)
base_path = target_uri.path
get_wcdb(normalize_uri(base_path, 'wc.db'))
end
2012-12-18 17:46:27 +00:00
2013-08-30 21:28:54 +00:00
def get_wcdb(path)
proto = (ssl ? 'https://' : 'http://')
vprint_status("Trying #{proto}#{vhost}:#{rport}#{path}")
begin
res = send_request_cgi(
{
'method' => 'GET',
'uri' => path,
'ctype' => 'text/plain'
}
)
2012-12-06 21:30:23 +00:00
2013-08-30 21:28:54 +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
2013-08-30 21:28:54 +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
2013-08-30 21:28:54 +00:00
print_good("SVN wc.db database stored in #{file}")
2013-08-30 21:28:54 +00:00
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}"
)
else
vprint_error("SVN wc.db database not found on #{vhost}:#{rport}")
end
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
rescue ::Timeout::Error, ::Errno::EPIPE
end
end
2012-12-06 21:30:23 +00:00
end