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{
|
|
|
|
Scan for servers that allow access to the SVN wc.db file.
|
2012-12-06 22:18:50 +00:00
|
|
|
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
|
|
|
|
)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2012-12-06 22:18:50 +00:00
|
|
|
def target_url(path)
|
2012-12-06 21:30:23 +00:00
|
|
|
if ssl
|
2012-12-06 22:18:50 +00:00
|
|
|
return "https://#{vhost}:#{rport}#{path}"
|
2012-12-06 21:30:23 +00:00
|
|
|
else
|
2012-12-06 22:18:50 +00:00
|
|
|
return "http://#{vhost}:#{rport}#{path}"
|
2012-12-06 21:30:23 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def run_host(ip)
|
2012-12-06 22:18:50 +00:00
|
|
|
path = '/.svn/wc.db'
|
|
|
|
if wcdb_exists(target_url, path)
|
2012-12-06 21:30:23 +00:00
|
|
|
print_good("SVN database found on #{target_url}")
|
|
|
|
report_note(
|
|
|
|
:host => rhost,
|
|
|
|
:port => rport,
|
|
|
|
:proto => 'tcp',
|
|
|
|
:sname => (ssl ? 'https' : 'http'),
|
|
|
|
:type => 'users',
|
|
|
|
:data => 'SVN wc.db database is available'
|
|
|
|
)
|
|
|
|
else
|
|
|
|
vprint_error("SVN database not found")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-12-06 22:18:50 +00:00
|
|
|
def wcdb_exists(url, path)
|
2012-12-06 21:30:23 +00:00
|
|
|
|
2012-12-06 22:18:50 +00:00
|
|
|
vprint_status("Trying #{url}#{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 22:18:50 +00:00
|
|
|
})
|
2012-12-06 21:30:23 +00:00
|
|
|
|
2012-12-06 22:18:50 +00:00
|
|
|
if res and res.code == 200
|
2012-12-06 21:30:23 +00:00
|
|
|
return true
|
|
|
|
else
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
|
|
|
|
rescue ::Timeout::Error, ::Errno::EPIPE
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|