FTP Enumeration (Port 21)
Enumerate FTP servers to identify anonymous access, misconfigurations, and potential file upload vulnerabilities.
FTP is commonly misconfigured to allow anonymous access or weak authentication, making it a prime target for initial access.
Quick Reference
# Test anonymous access |
Anonymous Access
# Connect with FTP client |
FTP Commands
# List files |
Nmap NSE Scripts
# Anonymous login check |
Download All Files
# Using wget (recursive download) |
SSL/TLS FTP
# Connect with OpenSSL |
Brute Force
# Hydra |
FTP Bounce Attack
# Using Nmap |
File Operations
# List directory contents |
Common Workflow
# Step 1: Check for anonymous access |
Notes
Common FTP Ports:
- Port 21: FTP control (commands)
- Port 20: FTP data (active mode)
- Port 990: FTPS (FTP over SSL/TLS)
FTP Modes:
- Active Mode: Server initiates data connection to client
- Passive Mode: Client initiates both control and data connections (use
--no-passiveto disable)
Anonymous Access:
Common anonymous credentials:
- Username:
anonymous, Password:anonymous - Username:
anonymous, Password:<blank> - Username:
ftp, Password:ftp - Username:
guest, Password:guest
Common Misconfigurations:
| Setting | Description | Risk |
|---|---|---|
anonymous_enable=YES |
Allows anonymous login | Unauthorized access |
anon_upload_enable=YES |
Allows anonymous uploads | Malware upload, defacement |
anon_mkdir_write_enable=YES |
Allows anonymous directory creation | File system manipulation |
no_anon_password=YES |
No password required for anonymous | Easier anonymous access |
write_enable=YES |
Allows write operations | File modification/upload |
VSFTPD Configuration:
Configuration file: /etc/vsftpd.conf
User restrictions: /etc/ftpusers (users denied FTP access)
FTP Bounce Attack:
Exploits FTP’s PORT command to scan internal networks or bypass firewall rules. Modern FTP servers have protections, but misconfigurations can make them vulnerable.
Sensitive Files to Look For:
- Configuration files (
.conf,.config,.ini) - Backup files (
.bak,.backup,.old) - Database dumps (
.sql,.db) - Credentials (
.txt,.logcontaining “password”, “credential”) - SSH keys (
.pem,.key,id_rsa) - Source code (
.php,.asp,.jsp)
Testing Checklist:
- Test anonymous access
- Check for write permissions
- Look for sensitive files
- Test FTP bounce attack
- Check for known vulnerabilities (vsftpd 2.3.4 backdoor, ProFTPD backdoors)
- Attempt brute force if no anonymous access
- Check SSL/TLS certificate for information disclosure
Security Best Practices (for defenders):
- Disable anonymous access unless required
- Use FTPS (FTP over SSL/TLS) instead of plain FTP
- Implement strong authentication
- Restrict write permissions
- Use
/etc/ftpusersto deny access to system accounts - Enable logging and monitor for suspicious activity
- Consider using SFTP (SSH File Transfer Protocol) instead
Common Vulnerabilities:
- vsftpd 2.3.4: Backdoor vulnerability (smiley face backdoor)
- ProFTPD: Multiple backdoor and RCE vulnerabilities
- Core FTP: Path traversal vulnerabilities
- Anonymous write access: File upload and potential RCE
Exploitation Examples:
# vsftpd 2.3.4 backdoor |