FTP

port 20/21

Table of Contents

Interacting w/ FTP

Nmap

> sudo nmap -sV -p21 -sC -A 10.129.14.136

FTP

ftp IP

non default port

ftp IP PORT
Anonymous Access
> ftp 192.168.2.142    

Connected to 192.168.2.142.
220 (vsFTPd 2.3.4)
Name (192.168.2.142:kali): anonymous
331 Please specify the password.
Password:
230 Login successful.

recursively list all directories and files

ls -R

display directories as a tree

tree .

download all files on the server

wget -m --no-passive ftp://anonymous:anonymous@10.129.14.136

upload file

put filename

OpenSSL

if the FTP server runs with TLS/SSL encryption we can use the client openssl and communicate with the FTP server

> openssl s_client -connect 10.129.14.136:21 -starttls ftp

General Information

FTP is a cleartext Protocol that can be sniffed

Active/Passive Mode

  • Active mode -> server connects to client
  • Passive mode -> client connects to server, used to avoid issues with firewalls blocking the server's incoming connection to the client

Dangerous FTP settings

SettingDescription
anonymous_enable=YESAllowing anonymous login?
anon_upload_enable=YESAllowing anonymous to upload files?
anon_mkdir_write_enable=YESAllowing anonymous to create new directories?
no_anon_password=YESDo not ask anonymous for password?
anon_root=/home/username/ftpDirectory for anonymous.
write_enable=YESAllow the usage of FTP commands: STOR, DELE, RNFR, RNTO, MKD, RMD, APPE, and SITE?

TFTP (Trivial FTP)

TFTP General Information

  • FTP uses TCP, whereas TFTP uses UDP

Interacting with TFTP

Unlike FTP, TFTP does not provide user authentication, and does not have directory listing functionality. Use nmap tftp-enum to see files.

Because of the lack of security, TFTP, unlike FTP, may only be used in local and protected networks.

A few commands of TFTP:

CommandsDescription
connectSets the remote host, and optionally the port, for file transfers.
getTransfers a file or set of files from the remote host to the local host.
putTransfers a file or set of files from the local host onto the remote host.
quitExits tftp.
statusShows the current status of tftp, including the current transfer mode (ascii or binary), connection status, time-out value, and so on.
verboseTurns verbose mode, which displays additional information during file transfer, on or off.

Brute-Forcing FTP

FTP section in Password Attack's Cracking Network Services