2.FTP
Manual FTP Connection
Netcat FTP Connection
Anonymous Login (FTP Client)
Brute-Force (Medusa)
FTP Bounce Attack (Nmap)
CoreFTP Arbitrary File Write (curl)
FTP Client Commands (Post-Login)
. FTP Basics
Function:
File transfer between computers.
Directory and file operations (list, rename, delete).
Port: TCP/21.
Attack Vectors:
Misconfigurations (anonymous access, excessive privileges).
Exploiting known vulnerabilities.
Discovering new vulnerabilities.
II. Enumeration
Nmap:
-sC
(default scripts):ftp-anon
script (anonymous login check).-sV
(version enumeration): FTP banner, version info.Example:
nmap -sC -sV -p 21 <target_IP>
Manual Interaction:
ftp
client.nc
(netcat).
III. Misconfigurations
Anonymous Authentication:
Username:
anonymous
, no password.Risks: Sensitive data access, malicious file uploads.
Access Control:
Incorrect read/write permissions.
IV. Protocol-Specific Attacks
Brute-Forcing:
Tools: Medusa (
medusa -u <user> -P <passlist> -h <target> -M ftp
).Note: Password spraying is more effective.
FTP Bounce Attack:
Using an FTP server to scan internal network devices.
Nmap:
-b anonymous:password@<FTP_server_IP> <internal_target_IP>
.Modern servers have protections, but misconfigurations exist.
V. Latest FTP Vulnerabilities (CVE-2022-22836 - CoreFTP)
Vulnerability:
Authenticated directory/path traversal.
Arbitrary file write.
Attack Method:
HTTP PUT request with directory traversal characters (
../
).
Exploitation:
curl -k -X PUT -H "Host: <IP>" --basic -u <username>:<password> --data-binary "PoC." --path-as-is https://<IP>/../../../../../../whoops
SPPD Breakdown:
Directory Traversal:
Source: Malicious HTTP PUT request.
Process: Misinterprets path.
Privileges: Bypass restrictions.
Destination: Local system (traversed directory).
Arbitrary File Write:
Source: Filename and content.
Process: Writes content.
Privileges: Allowed due to traversal.
Destination: Arbitrary file on the local system.
Points for Consideration:
Active vs. Passive FTP: Briefly mention the difference and security implications.
Secure FTP: Discuss SFTP and FTPS and their advantages.
FTP Tools: Expand on tools like
lftp
andFileZilla
(for client side), and also vsftpd, and proftpd (for server side).Real-World Examples: Add more examples of FTP misconfigurations and exploits.
Mitigation: Provide more detailed mitigation strategies for FTP vulnerabilities.
More Nmap script examples: There are many more useful ftp Nmap scripts.
More curl usage: There are many more ways to use curl to interact with FTP.
Last updated