FTP mixin: Report if host is up but service doesn't match#21575
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the shared FTP remote mixin so that when an FTP module connects to an open TCP port but the initial greeting does not look like an FTP banner, Metasploit still reports the host/service to the workspace (instead of silently closing without recording anything).
Changes:
- Add a fallback
report_service()path inFtp#connectwhen the greeting does not match an FTP RFC-959 style banner. - Record the service as
unknownwith a TCP parent, and store a short info string intended to capture the banner (or a fallback message).
Impact Analysis:
- Blast radius: medium/high (all modules/mixins calling
Msf::Exploit::Remote::Ftp#connect, including scanners likeauxiliary/scanner/ftp/ftp_version; downstream effect is limited to DB/workspace reporting). - Data and contract effects: introduces additional service rows for
(host, port)when the port is open but not FTP (or when no FTP banner is received), potentially increasing “services” counts and persisting “unknown” service entries. - Rollback and test focus: easy rollback (single mixin change); validate against (1) real FTP services (still reports
ftpand note), (2) non-FTP banner services (records banner/info as intended), and (3) no-banner/timeouts (does not mislead or spam).
Contributor
|
Tested and seems to work as expected: We have some merged conflicts and I believe that copilot comment may be worth looking into. Once those are resolved I can get this merged for you 👍 |
Contributor
Author
FTP$ git status
On branch ftp_mixin3
Your branch is up to date with 'origin/ftp_mixin3'.
nothing to commit, working tree clean
$
$ ./msfconsole -q -x 'db_status; workspace -D;
setg VERBOSE true;
use auxiliary/scanner/ftp/ftp_version;
set RHOSTS 10.0.0.10;'
[*] Connected to msf. Connection type: postgresql.
[*] Deleted workspace: default
[*] Recreated the default workspace
VERBOSE => true
RHOSTS => 10.0.0.10
msf auxiliary(scanner/ftp/ftp_version) > run
[+] 10.0.0.10:21 - FTP Banner: '220 (vsFTPd 2.3.4)\x0d\x0a'
[*] 10.0.0.10:21 - Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf auxiliary(scanner/ftp/ftp_version) > workspace -v
Workspaces
==========
current name hosts services vulns creds loots notes
------- ---- ----- -------- ----- ----- ----- -----
* default 1 2 0 0 0 2
msf auxiliary(scanner/ftp/ftp_version) > services
Services
========
host port proto name state info resource parents
---- ---- ----- ---- ----- ---- -------- -------
10.0.0.10 21 tcp tcp open {}
10.0.0.10 21 tcp ftp open 220 (vsFTPd 2.3.4)\x0d\x0a {} tcp (21/tcp)
msf auxiliary(scanner/ftp/ftp_version) > notes
Notes
=====
Time Host Service Port Protocol Type Data
---- ---- ------- ---- -------- ---- ----
2026-07-16 15:24:09 UTC 10.0.0.10 ftp 21 tcp ftp.banner {:banner=>"220 (vsFTPd 2.3.4)"}
2026-07-16 15:24:09 UTC 10.0.0.10 ftp 21 tcp ftp.cpe {:cpe=>"cpe:/a:vsftpd_project:vsftpd:2.3.4"}
msf auxiliary(scanner/ftp/ftp_version) >Non-FTP, but banner (SSH)msf auxiliary(scanner/ftp/ftp_version) > workspace -D
[*] Deleted workspace: default
[*] Recreated the default workspace
msf auxiliary(scanner/ftp/ftp_version) > run RPORT=22
[*] 10.0.0.10:22 - Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf auxiliary(scanner/ftp/ftp_version) > workspace -v
Workspaces
==========
current name hosts services vulns creds loots notes
------- ---- ----- -------- ----- ----- ----- -----
* default 1 2 0 0 0 0
msf auxiliary(scanner/ftp/ftp_version) > services
Services
========
host port proto name state info resource parents
---- ---- ----- ---- ----- ---- -------- -------
10.0.0.10 22 tcp unknown open SSH-2.0-OpenSSH_4.7p1 Debian-8ubuntu1 {} tcp (22/tcp)
10.0.0.10 22 tcp tcp open {}
msf auxiliary(scanner/ftp/ftp_version) >Non-FTP, no banner (X11)msf auxiliary(scanner/ftp/ftp_version) > workspace -D
[*] Deleted workspace: default
[*] Recreated the default workspace
msf auxiliary(scanner/ftp/ftp_version) > run RPORT=6000
[*] 10.0.0.10:6000 - Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf auxiliary(scanner/ftp/ftp_version) > workspace -v
Workspaces
==========
current name hosts services vulns creds loots notes
------- ---- ----- -------- ----- ----- ----- -----
* default 1 2 0 0 0 0
msf auxiliary(scanner/ftp/ftp_version) > services
Services
========
host port proto name state info resource parents
---- ---- ----- ---- ----- ---- -------- -------
10.0.0.10 6000 tcp unknown open Non-FTP service {} tcp (6000/tcp)
10.0.0.10 6000 tcp tcp open {}
msf auxiliary(scanner/ftp/ftp_version) >Host, but no service |
Contributor
Author
|
Thats great to hear @cgranleese-r7, thanks! Fixed up and forced push'd |
cgranleese-r7
approved these changes
Jul 17, 2026
Contributor
Release NotesImproves |
Contributor
Author
|
Thanks @cgranleese-r7 ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This has come from: #21416
When
ftp_version(or any module using the FTP mixin) connects to an open port that responds with a non-FTP banner, the greeting fails to match/^(120|220)[\s-]/.Currently, the connection simply closes with nothing added to the workspace.
This uses
report_service()to update the workspace with the unknown service (and also host).Demo
Before
After