Skip to content

Commit d8cf45e

Browse files
author
Tod Beardsley
committed
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.
1 parent b990b14 commit d8cf45e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/msf/core/exploit/ftpserver.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ def initialize(info = {})
2222
# Register the options that all FTP exploits may make use of.
2323
register_options(
2424
[
25-
OptPort.new('SRVPORT', [ true, "The local port to listen on.", 21 ])
25+
OptPort.new('SRVPORT', [ true, "The local port to listen on.", 21 ]),
26+
OptPort.new('PASVPORT', [ false, "The local PASV data port to listen on (0 is random)", 0 ])
2627
], Msf::Exploit::Remote::FtpServer)
2728
end
2829

@@ -172,7 +173,7 @@ def passive_data_port_for_client(c)
172173
if(not @state[c][:passive_sock])
173174
s = Rex::Socket::TcpServer.create(
174175
'LocalHost' => '0.0.0.0',
175-
'LocalPort' => 0,
176+
'LocalPort' => datastore['PASVPORT'].to_i,
176177
'Context' => { 'Msf' => framework, 'MsfExploit' => self }
177178
)
178179

0 commit comments

Comments
 (0)