Skip to content

Commit e5e9c7c

Browse files
Fixed ftp.rb so it closes all data sockets
ftp.rb was doing a shutdown without a close on data (not command) sockets. This can cause CLOSE_WAIT for extended periods in certain circumstances-ending only when msf itself is closed.
1 parent 9b219f4 commit e5e9c7c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/msf/core/exploit/ftp.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,14 @@ def data_connect(mode = nil, nsock = self.sock)
9696
# This method handles disconnecting our data channel
9797
#
9898
def data_disconnect
99-
self.datasocket.shutdown if self.datasocket
100-
self.datasocket = nil
99+
begin
100+
if datasocket
101+
datasocket.shutdown
102+
datasocket.close
103+
end
104+
rescue IOError
105+
end
106+
datasocket = nil if datasocket
101107
end
102108

103109
#

0 commit comments

Comments
 (0)