Allow FTP server exploits pick a PASV port

This makes it somewhat easier to use FTP server exploit modules in
somewhat more restrictive networks, where you might only have a few
inbound ports to choose from.
This commit is contained in:
Tod Beardsley 2014-10-27 22:21:54 -05:00
parent b990b14a65
commit d8cf45ef67
No known key found for this signature in database
GPG Key ID: 1EFFB682ADB9F193
1 changed files with 3 additions and 2 deletions

View File

@ -22,7 +22,8 @@ module Exploit::Remote::FtpServer
# Register the options that all FTP exploits may make use of.
register_options(
[
OptPort.new('SRVPORT', [ true, "The local port to listen on.", 21 ])
OptPort.new('SRVPORT', [ true, "The local port to listen on.", 21 ]),
OptPort.new('PASVPORT', [ false, "The local PASV data port to listen on (0 is random)", 0 ])
], Msf::Exploit::Remote::FtpServer)
end
@ -172,7 +173,7 @@ module Exploit::Remote::FtpServer
if(not @state[c][:passive_sock])
s = Rex::Socket::TcpServer.create(
'LocalHost' => '0.0.0.0',
'LocalPort' => 0,
'LocalPort' => datastore['PASVPORT'].to_i,
'Context' => { 'Msf' => framework, 'MsfExploit' => self }
)