On this page 21 sections
  1. What FTP is
  2. Default ports
  3. Initial enumeration
  4. Useful Nmap FTP scripts
  5. Anonymous login
  6. Anonymous credentials
  7. FTP navigation
  8. Download files
  9. Upload files
  10. Check read and write permissions
  11. Why writable FTP matters
  12. Metasploit FTP version scanner
  13. Metasploit anonymous FTP
  14. Metasploit FTP login
  15. Hydra FTP authentication testing
  16. Connection throttling
  17. Active FTP
  18. Passive FTP
  19. FTP vs FTPS vs SFTP
  20. Enumeration workflow
  21. Quick reference
01

What FTP is

FTP, or File Transfer Protocol, is used to transfer files between a client and a server. Traditional FTP does not encrypt credentials or transferred data, so usernames, passwords and files may travel in clear text.

02

Default ports

FTP normally uses TCP port 21 for the control connection. Traditional active FTP may use TCP port 20 for the server-side data connection. FTPS may use port 21 with explicit TLS or port 990 for implicit FTPS.

03

Initial enumeration

Start by confirming that the FTP service is reachable and identifying the server implementation and version. Banner and version information may reveal useful details about the software in use.

FTP version detection
nmap -sV -p 21 <TARGET>
Default scripts and version detection
nmap -sC -sV -p 21 <TARGET>
Manual banner grabbing
nc -nv <TARGET> 21
04

Useful Nmap FTP scripts

Nmap includes NSE scripts that can check anonymous access, retrieve server information and perform additional FTP enumeration.

Anonymous FTP check
nmap -p 21 --script ftp-anon <TARGET>
FTP system information
nmap -p 21 --script ftp-syst <TARGET>
Run FTP-related scripts
nmap -p 21 --script "ftp-*" <TARGET>
List local FTP NSE scripts
ls /usr/share/nmap/scripts/ftp*
05

Anonymous login

One of the first checks against an FTP server is whether anonymous authentication is allowed. Anonymous FTP is not automatically vulnerable; the real impact depends on the files that can be accessed and whether the anonymous account has write permissions.

Connect to FTP
ftp <TARGET>
06

Anonymous credentials

A common anonymous FTP login uses anonymous as the username. The password may also be anonymous, blank or an email address depending on the server configuration.

Typical username
anonymous
Typical password
anonymous
07

FTP navigation

Once authenticated, enumerate available directories and files before downloading anything. FTP clients provide commands similar to basic filesystem navigation.

List files
ls
Detailed listing
dir
Current remote directory
pwd
Change remote directory
cd <DIRECTORY>
Change local directory
lcd <LOCAL_DIRECTORY>
08

Download files

Interesting FTP content may include configuration files, backups, scripts, source code, documentation or exposed credentials. Download relevant files for offline analysis when authorised.

Download one file
get <FILE>
Download multiple files
mget *
09

Upload files

Write access is more significant than read-only access because it allows files to be created or modified. However, FTP write access does not automatically provide code execution; the impact depends on where the writable directory is used.

Upload one file
put <FILE>
Upload multiple files
mput <FILES>
10

Check read and write permissions

Determine whether the current FTP account can read, download, upload, overwrite or delete files. When write testing is authorised, use a harmless test file instead of modifying existing content.

Upload test file
put test.txt
Delete test file
delete test.txt
11

Why writable FTP matters

A writable directory becomes especially interesting when it maps to another service, such as a web root, application directory or automated file-processing location. The context determines whether file upload can lead to a greater impact.

12

Metasploit FTP version scanner

Metasploit contains auxiliary modules for FTP service detection and enumeration.

Start Metasploit
msfconsole
Search FTP modules
search type:auxiliary ftp
FTP version scanner
use auxiliary/scanner/ftp/ftp_version
Set target
set RHOSTS <TARGET>
Run module
run
13

Metasploit anonymous FTP

The anonymous FTP scanner checks whether the server permits anonymous authentication.

Load anonymous scanner
use auxiliary/scanner/ftp/anonymous
Set target
set RHOSTS <TARGET>
Run check
run
14

Metasploit FTP login

The FTP login scanner can validate username and password combinations during an authorised credential audit.

Load FTP login scanner
use auxiliary/scanner/ftp/ftp_login
Set target
set RHOSTS <TARGET>
Set username list
set USER_FILE <USERLIST>
Set password list
set PASS_FILE <PASSWORDLIST>
Run scanner
run
15

Hydra FTP authentication testing

Hydra can validate FTP credentials against a target. Aggressive login attempts may trigger rate limiting, account lockouts, temporary blocking or connection throttling.

Single username
hydra -l <USERNAME> -P <PASSWORDLIST> ftp://<TARGET>
Username and password lists
hydra -L <USERLIST> -P <PASSWORDLIST> ftp://<TARGET>
Verbose testing
hydra -V -L <USERLIST> -P <PASSWORDLIST> ftp://<TARGET>
16

Connection throttling

If the FTP server starts closing connections during repeated authentication attempts, this may indicate rate limiting, connection limits or another service-protection mechanism. It should not be treated as universal FTP behaviour.

17

Active FTP

In active mode, the client creates the control connection to the server, but the server initiates the data connection back toward the client. This can create problems when the client is behind NAT or restrictive firewall rules.

18

Passive FTP

In passive mode, the client initiates both the control and data connections. This generally works better through NAT and firewalls and is commonly used in modern environments.

19

FTP vs FTPS vs SFTP

FTP is the traditional unencrypted protocol. FTPS is FTP protected with TLS. SFTP is the SSH File Transfer Protocol and runs over SSH, normally on TCP port 22. SFTP is not the same thing as FTP over SSH.

20

Enumeration workflow

Confirm the FTP service, identify the version, capture the banner, test anonymous access, enumerate files and directories, determine read and write permissions, analyse interesting files and then validate credentials if authorised. Correlate any writable directory with other exposed services.

Initial scan
nmap -sC -sV -p 21 <TARGET>
Anonymous check
nmap -p 21 --script ftp-anon <TARGET>
Manual connection
ftp <TARGET>
21

Quick reference

These are the FTP commands worth remembering during service enumeration.

Version detection
nmap -sV -p 21 <TARGET>
Default enumeration
nmap -sC -sV -p 21 <TARGET>
Anonymous check
nmap -p 21 --script ftp-anon <TARGET>
Manual FTP
ftp <TARGET>
Banner grabbing
nc -nv <TARGET> 21
Hydra
hydra -L <USERLIST> -P <PASSWORDLIST> ftp://<TARGET>
Metasploit version
use auxiliary/scanner/ftp/ftp_version
Metasploit anonymous
use auxiliary/scanner/ftp/anonymous
Metasploit login
use auxiliary/scanner/ftp/ftp_login