FTP Data Exfiltration
FTP data exfiltration focuses on extracting files and data from an FTP server after successful authentication.
This phase assumes valid credentials or anonymous access have already been obtained.
Bulk Download
Mirror everything:
For FTPS:
Directory Listing & Targeted Download
Use nxc for quick ops:
FTP 192.168.0.10 21 192.168.0.10 [*] Banner: (vsFTPd 3.0.5) FTP 192.168.0.10 21 192.168.0.10 [+] user:password FTP 192.168.0.10 21 192.168.0.10 [*] Directory Listing FTP 192.168.0.10 21 192.168.0.10 drwxr-xr-x 2 1000 1000 4096 Sep 30 17:29 Desktop FTP 192.168.0.10 21 192.168.0.10 drwxr-xr-x 2 1000 1000 4096 Aug 28 2022 Documents FTP 192.168.0.10 21 192.168.0.10 drwxr-xr-x 2 1000 1000 4096 Jul 13 23:42 Downloads FTP 192.168.0.10 21 192.168.0.10 drwxr-xr-x 2 1000 1000 4096 Aug 28 2022 Music FTP 192.168.0.10 21 192.168.0.10 drwxr-xr-x 2 1000 1000 4096 Aug 28 2022 Pictures FTP 192.168.0.10 21 192.168.0.10 drwxr-xr-x 2 1000 1000 4096 Aug 28 2022 Public FTP 192.168.0.10 21 192.168.0.10 drwxr-xr-x 2 1000 1000 4096 Aug 28 2022 Templates FTP 192.168.0.10 21 192.168.0.10 drwxr-xr-x 2 1000 1000 4096 Aug 28 2022 Videos FTP 192.168.0.10 21 192.168.0.10 drwx------ 4 1000 1000 4096 Aug 28 2022 snap
List a Specific Directory
Download a Specific File
FTP 10.10.176.246 21 10.10.176.246 [*] Banner: (vsFTPd 3.0.3) FTP 10.10.176.246 21 10.10.176.246 [+] user:password FTP 10.10.176.246 21 10.10.176.246 [+] Downloaded: ftp_flag.thm
Uploading & Handling Binary Files
Before transferring binary files (executables, archives, images), binary mode must be enabled.
Enable Binary Transfer Mode
Upload a File
FTP 10.10.176.246 21 10.10.176.246 [*] Banner: (vsFTPd 3.0.3) FTP 10.10.176.246 21 10.10.176.246 [+] user:password FTP 10.10.176.246 21 10.10.176.246 [-] Failed to upload file. Response: (550 Permission denied.)
Recursive Download with lftp
For FTPS:
All FTP commands
FTP Command | Description of Command |
! | Escape to the shell. |
$ | Execute macro |
? | Print local help information. |
account | Send account command to remote server. |
append | Append to a file. |
ascii | Set ascii transfer type. |
beep | Beep when command completed. |
binary | Set binary transfer type. |
bye | Terminate FTP session and exit. |
case | Toggle mget upper/lower case id mapping. |
cd | Change remote working directory. |
cdup | Change remote working directory to parent directory. |
chmod | Change file permissions of remote file. |
close | Terminate FTP session. |
cr | Toggle carriage return stripping on ascii gets. |
debug | Toggle/set debugging mode. |
delete | Delete remote file |
dir | List contents of remote directory. |
disconnect | Terminate FTP session. |
exit | Terminate FTP sessions and exit. |
form | Set file transfer format. |
get | Receive file. |
glob | Toggle meta character expansion of local file names. |
hash | Toggle printing ‘#’ for each buffer transferred. |
help | Display local help information. |
idle | Get (set) idle timer on remote side. |
image | Set binary transfer type. |
ipany | Allow use of any address family. |
ipv4 | Restrict address usage to IPv4. |
ipv6 | Restrict address usage to IPv6. |
lcd | Change local working directory. |
ls | List contents of remote directory. |
macdef | Define a macro. |
mdelete | Delete multiple files. |
mdir | List contents of multiple remote directories. |
mget | Get multiple files. |
mkdir | Make directory on remote machine. |
mls | List contents of multiple remote directories. |
mode | Set file transfer mode. |
modtime | Show last modification time of remote file. |
mput | Send multiple files. |
newer | Get file if remote file is newer than local file. |
nlist | List remote directory nlist contents. |
nmap | Set templates for default file name mapping. |
ntrans | Set translation table for default file name mapping. |
open | Connect to remote ftp. |
passive | Enter passive transfer mode. |
prompt | Force interactive prompting on multiple commands. |
proxy | Issue command on an alternate connection. |
put | Send one file. |
pwd | Print working directory on remote machine. |
qc | Print ? in place of control characters on stdout. |
quit | Terminate ftp session and exit. |
quote | Send arbitrary ftp command. |
recv | Receive file. |
reget | Get file restarting at end of local file. |
rename | Rename file. |
reset | Clear queued command replies. |
restart | Restart file transfer at bytecount. |
rhelp | Get help from remote server. |
rmdir | Remove directory on remote machine. |
rstatus | Show status of remote machine. |
runique | Toggle store unique for local files. |
send | Send one file. |
sendport | Toggle use of PORT cmd for each data connection. |
site | Send site specific command to remote server. |
size | Show size of remote file. |
status | Show current status. |
struct | Set file transfer structure. |
sunique | Toggle store unique on remote machine. |
system | Show remote system type. |
tenex | Set tenex file transfer type. |
tick | Toggle printing byte counter during transfers. |
trace | Toggle packet tracing. |
type | Set file transfer type. |
umask | Get (set) umask on remote site. |
user | Send new user information. |
verbose | Toggle verbose mode. |
References
-
List of FTP Commands (IETF RFC-based)en.wikipedia.org/wiki/List_of_FTP_commands (opens in new tab)
Comprehensive RFC list of FTP protocol commands
-
RFC 959 – File Transfer Protocoldatatracker.ietf.org/doc/html/rfc959 (opens in new tab)
RFC 959 – File Transfer Protocol (FTP)
-
NetExec - File Listingwww.netexec.wiki/ftp-protocol/file-listing-etc (opens in new tab)
-
NetExec - File Upload & Downloadwww.netexec.wiki/ftp-protocol/get-and-put-files (opens in new tab)
Instructions for using FTP commands to access and transfer files using NetExec.
Was this helpful?
Your feedback helps improve this page.