FTP Credential Exploitation
Valid FTP credentials give authenticated access to the FTP file tree. The scope of access depends on the account's chroot configuration and filesystem permissions. From here the goal is to extract sensitive files, identify credential material that pivots to other services, and determine whether FTP write access leads to further impact.
- Directory tree mapping list and recurse the full accessible tree, checking for chroot escapes via cd /.
- Bulk download mirror everything with wget or lftp and grep for passwords, keys, and connection strings.
- Write access testing upload a test file to confirm write permissions, then pivot to web shell upload if the path is web-accessible.
- Chroot escape attempt to navigate to /etc and download passwd to confirm unrestricted filesystem access.
- Credential reuse test recovered FTP credentials against SSH, SMB, and web application logins immediately.
Connect with Valid Credentials
Enter $USER and $PASSWORD at the prompts. A 230 Login successful response confirms access.
With curl for non-interactive access:
Map the Directory Tree
List the full accessible tree from the root:
Recursively list all subdirectories in an interactive session:
ls -la cd / ls -la
Some FTP servers chroot authenticated users to their home directory. Attempting cd / and observing whether the listing changes confirms whether chroot is in effect.
Download Files of Interest
Download a single file:
Download everything recursively with wget:
With lftp for parallel and resumable transfers:
Inside lftp:
Search Downloaded Content for Credentials
SSH private keys, database connection strings, application config files, and .env files are the highest value finds. Credentials recovered here are tested for reuse against SSH, SMB, and any other services on the target.
Test Upload Access
Even with standard credentials, the account may have write access to specific paths:
If upload succeeds and the path is web-accessible, pivot to FTP Web Shell Upload.
Navigate Outside the Chroot
If the server is not properly chrooted, path traversal via the FTP session may reach OS-level files:
cd / cd /etc get passwd
If /etc/passwd downloads successfully, the FTP daemon is running without chroot and the authenticated user can access the full filesystem with whatever OS-level permissions the FTP process holds.
Credential Reuse Against Other Services
FTP credentials are frequently reused across SSH, web application logins, and database accounts. Test the recovered credentials immediately:
References
-
Mirror command, parallel transfer, and authenticated FTP usage reference
-
Pennyw0rth/NetExecREPO: Pennyw0rth/NetExec, github.com/Pennyw0rth/NetExec (opens in new tab)
nxc for credential reuse testing across SSH, SMB, and other services