|
| 1 | +## |
| 2 | +# $Id$ |
| 3 | +## |
| 4 | + |
| 5 | +## |
| 6 | +# This file is part of the Metasploit Framework and may be subject to |
| 7 | +# redistribution and commercial restrictions. Please see the Metasploit |
| 8 | +# web site for more information on licensing and terms of use. |
| 9 | +# http://metasploit.com/ |
| 10 | +## |
| 11 | + |
| 12 | + |
| 13 | +require 'msf/core' |
| 14 | + |
| 15 | + |
| 16 | +class Metasploit3 < Msf::Auxiliary |
| 17 | + |
| 18 | + include Msf::Exploit::Remote::HttpClient |
| 19 | + include Msf::Auxiliary::Report |
| 20 | + include Msf::Auxiliary::Scanner |
| 21 | + |
| 22 | + def initialize |
| 23 | + super( |
| 24 | + 'Name' => 'SVN wc.db Scanner', |
| 25 | + 'Version' => '$Revision$', |
| 26 | + 'Description' => %q{ |
| 27 | + Scan for servers that allow access to the SVN wc.db file. |
| 28 | + Based on the work by Tim Meddin as described at |
| 29 | + http://pen-testing.sans.org/blog/pen-testing/2012/12/06/all-your-svn-are-belong-to-us# |
| 30 | + }, |
| 31 | + 'Author' => |
| 32 | + [ |
| 33 | + 'Stephen Haywood <[email protected]', |
| 34 | + ], |
| 35 | + 'References' => |
| 36 | + [ |
| 37 | + ], |
| 38 | + 'License' => MSF_LICENSE |
| 39 | + ) |
| 40 | + |
| 41 | + register_options( |
| 42 | + [ |
| 43 | + ], self.class) |
| 44 | + |
| 45 | + end |
| 46 | + |
| 47 | + def target_url |
| 48 | + if ssl |
| 49 | + return "https://#{vhost}:#{rport}" |
| 50 | + else |
| 51 | + return "http://#{vhost}:#{rport}" |
| 52 | + end |
| 53 | + end |
| 54 | + |
| 55 | + def run_host(ip) |
| 56 | + if wcdb_exists("#{target_url}") |
| 57 | + print_good("SVN database found on #{target_url}") |
| 58 | + report_note( |
| 59 | + :host => rhost, |
| 60 | + :port => rport, |
| 61 | + :proto => 'tcp', |
| 62 | + :sname => (ssl ? 'https' : 'http'), |
| 63 | + :type => 'users', |
| 64 | + :data => 'SVN wc.db database is available' |
| 65 | + ) |
| 66 | + else |
| 67 | + vprint_error("SVN database not found") |
| 68 | + end |
| 69 | + end |
| 70 | + |
| 71 | + def wcdb_exists(url) |
| 72 | + |
| 73 | + vprint_status("Trying url: #{url}") |
| 74 | + begin |
| 75 | + res = send_request_cgi( |
| 76 | + { |
| 77 | + 'method' => 'GET', |
| 78 | + 'uri' => '/.svn/wc.db', |
| 79 | + 'ctype' => 'text/plain' |
| 80 | + }, 20) |
| 81 | + |
| 82 | + if res.code == 200 |
| 83 | + return true |
| 84 | + else |
| 85 | + return false |
| 86 | + end |
| 87 | + rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout |
| 88 | + rescue ::Timeout::Error, ::Errno::EPIPE |
| 89 | + end |
| 90 | + end |
| 91 | + |
| 92 | +end |
0 commit comments