🕵️
VeryLazyTech
📜 Medium🛒 My Shop👾 Github📩 Telegram 📺 YouTube✖ Twitter
  • 🕵️Welcome!
    • VeryLazyTech
    • Support VeryLazyTech
      • 👾 GitHub
      • 📜 Medium
      • ☕ My Shop
      • 📺 YouTube
      • ✖ Twitter
      • 📩 Telegram
  • 🛡️ Vulnerabilities and Exploits
    • CVE - POC
      • Unauthenticated RCE Flaw in Rejetto HTTP File Server - CVE-2024-23692
      • POC - CVE-2024–4956 - Nexus Repository Manager 3 Unauthenticated Path Traversal
      • POC - CVE-2024-45241: Path Traversal in CentralSquare's CryWolf
      • Telerik Auth Bypass CVE-2024-4358
      • Check Point Security Gateways Information Disclosure - CVE-2024-24919
      • CVE-2024-23897 - Jenkins File Read Vulnerability
      • CVE-2024–10914- Command Injection Vulnerability in name parameter for D-Link NAS
      • POC - CVE-2024-21534 Jsonpath-plus vulnerable to Remote Code Execution (RCE)
      • CVE-2024-9935 - PDF Generator Addon for Elementor Page Builder <= 1.7.5 - Unauthenticated Arbitrary
      • CVE-2024-50623- Cleo Unrestricted file upload and download
      • POC - WordPress File Upload plugin, in the wfu_file_downloader.php file before version <= 4.24.11
      • POC - Remote and unauthenticated attacker can send crafted HTTP requests to RCE - cve-2025-3248
      • POC - CVE-2025–2539 File Away <= 3.9.9.0.1 - Missing Authorization to Unauthenticated Arbitrary File
      • POC - CVE-2025-29306 FOXCMS /images/index.html Code Execution Vulnerability
  • 🕵️‍♂️Dorks
    • GitHub Dorks
    • Google Dork Online Tool
  • 📚 Resources
    • Top Hacking Books for 2024: FREE and Paid
    • How to Study for OSCP with the PWK Book PDF
    • Top 20 phishing tools to use in 2024
    • Top 8 Bug Bounty Books for 2025: Must-Reads for Ethical Hackers
    • Top Hacking Tools and Skills You Need to Learn in 2025
    • Offensive Cloud
    • Penetration Testing & Hacking Tools List
    • Top Cybersecurity Books by Topic
  • The Ultimate Penetration Testing Methodology (2025 Edition)
  • 🕸️Pentesting Web
    • Client Side Template Injection (CSTI)
    • Identify a Server’s Origin IP
    • 2FA/MFA/OTP Bypass
  • IDOR
  • Open Redirect
  • Subdomain Takeover
  • Penetration Testing WiFi Networks
  • Client-Side Path Traversal
  • Clickjacking
  • Command Injection
  • JWT Vulnerabilities
  • Bypass rating limit
  • CORS - Misconfigurations & Bypass
  • LDAP Injection
  • File upload vulnerabilities
  • Content Security Policy (CSP) bypass
  • 🐧Linux
    • Practical Linux Commands
    • Bypassing Bash Restrictions - Rbash
    • Privilege escalation - Linux
  • Linux Environment Variables
  • 🪟Windows
    • Active Directory Methodology
  • 🌐Network Pentesting
    • FTP - Port 21
    • SSH- Port 22
    • Telnet - Port 23
    • SMTP/s - Port 25,465,587
    • WHOIS - Port 43
    • TACACS+ - Port 49
    • DNS - Port 53
    • TFTP/Bittorrent-tracker - Port 69/UDP
    • Finger - Port 79
    • Web - Port 80,443
    • Kerberos - Port 88
    • POP - Port 110/995
    • Portmapper - Port 111/TCP/UDP
    • Ident - Port 113
    • NTP - Port 123/UDP
    • MSRPC - Port 135, 539
    • NetBios - Port 137,138,139
    • SMB - Port 139 445
    • IMAP - Port 143, 993
    • SNMP - Ports 161, 162, 10161, and 10162/UDP
    • IRC - Ports 194,6667,6660-7000
    • Check Point Firewall - Port 264
    • LDAP - Ports 389, 636, 3268, 3269
    • IPsec/IKE VPN - Port 500/UDP
    • Modbus - Port 502
    • Rexec - Port 512
    • Rlogin - Port 513
    • Rsh - Port 514
    • Line Printer Daemon (LPD) - Port 515
    • Apple Filing Protocol (AFP) - PORT 548
    • RTSP - Port 554, 8554
    • IPMI - Port 623/UDP/TCP
    • Internet Printing Protocol (IPP) - Port 631
    • EPP - Port 700
    • Rsync - Port 873
    • Rusersd Service - Port 1026
    • Socks - Port 1080
    • Java RMI - RMI-IIOP - Port 1098/1099/1050
    • MSSQL (Microsoft SQL Server) - Port 1433
    • Oracle TNS Listener - Port 1521,1522-1529
  • PPTP - Port 1723
  • MQTT (Message Queuing Telemetry Transport) - Port 1883
  • Compaq HP Insight Manager - Port 2301, 2381
  • NFS Service - Port 2049
  • Docker - Port 2375,2376
  • Squid - Port 3128
  • iScsi - Port 3260
  • SAPRouter - Port 3299
  • 😎Post-exploitation
    • File Transfer Cheatsheet: Windows and Linux
  • 🧑‍🔧Technical guides
    • Kali Linux - Installation
Powered by GitBook
On this page
  • Checklist for FTP Pentesting
  • Common FTP Commands​
  • Download all files from FTP
  • Enumeration of FTP
  • Service Discovery
  • Anonymous Login
  • Banner Grabbing
  • Directory Traversal Vulnerability
  • Exploitation
  • Brute Force Attack
  • Exploiting Weak Permissions
  • Misconfigurations and Default Credentials
  • Vulnerable Software Versions
  • Privilege Escalation and Post-Exploitation
  • Escalation via FTP Misconfigurations
  • Using Local Exploits
  • Capturing Credentials
  • Bypassing Firewalls and Filters
  • Active vs Passive Mode
  • Tunneling FTP Traffic
  • Tools for FTP Penetration Testing

Was this helpful?

  1. Network Pentesting

FTP - Port 21

PreviousActive Directory MethodologyNextSSH- Port 22

Last updated 6 months ago

Was this helpful?

  • Become VeryLazyTech ! 🎁

  • Follow us on:

    • ✖ Twitter .

    • 👾 Github .

    • 📜 Medium .

  • Visit our for e-books and courses. 📚

  • Support us and . ☕

Penetration testing (pentesting) of FTP (File Transfer Protocol) involves assessing and exploiting vulnerabilities within an FTP server to gain unauthorized access or escalate privileges. To effectively pentest FTP services, you'll need to understand FTP operations, common misconfigurations, and weaknesses. Below is a comprehensive guide covering enumeration, exploitation, and various tricks you can use.

Understanding FTP Basics

FTP is a protocol used to transfer files over a network. It operates on two primary ports:

  • Port 21 (Command): Handles the command/control connections.

  • Port 20 (Data): Used for data transfer in Active Mode.

Checklist for FTP Pentesting

  1. Enumerate the FTP service:

    • Use Nmap and banner grabbing. Service Discovery

    • Check for anonymous login. Anonymous Login

    • Explore FTP directories.

  2. Test for common vulnerabilities:

    • Brute force credentials. Brute Force Attack

    • Upload malicious files. Exploiting Weak Permissions

    • Look for directory traversal vulnerabilities. Directory Traversal Vulnerability

  3. Search for known exploits:

    • Identify software version. Vulnerable Software Versions

    • Use exploit-db or Metasploit. Vulnerable Software Versions

  4. Escalate privileges: Escalation via FTP Misconfigurations

    • Search for sensitive files.

    • Use local exploits.

  5. Post-exploitation:

    • Capture credentials.

    • Look for pivoting opportunities. Tunneling FTP Traffic

Command
Description
Usage

lcd

Change local directory.

lcd /path/to/directory

cd

Change server directory.

cd /path/to/directory

ls

List server directory files.

ls

get

Download file from server.

get filename.txt

mget

Download multiple files.

mget *.txt

put

Upload file to server.

put filename.txt

mput

Upload multiple files.

mput *.txt

bin

Set binary transfer mode.

bin

ascii

Set ASCII transfer mode.

ascii

quit

Exit FTP client.

quit

Download all files from FTP

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

If your user/password has special characters:

wget -r --user="USERNAME" --password="PASSWORD" ftp://Victim_IP/

Enumeration of FTP

Service Discovery

The first step in penetration testing FTP is identifying if the service is running on the target machine. You can use network scanning tools like Nmap to detect FTP services.

nmap -p 21 -sV <target-ip>
  • -p 21 scans port 21 where FTP is typically running.

  • -sV detects the version of the FTP service.

Nmap Script for FTP Enumeration: Nmap has several useful scripts for FTP enumeration:

nmap --script "ftp*" -p 21 <target-ip>

This command runs all FTP-related scripts against the target.

Anonymous Login

FTP servers often allow anonymous login, which could lead to unauthorized access.

Test for anonymous login:

ftp <target-ip>

Try logging in with the username anonymous and an empty password or any random string. If successful, it means the server allows anonymous access, which can be used to browse, upload, and download files depending on permissions.

Banner Grabbing

Banner grabbing helps identify the software version running on the server. Once identified, you can look for specific exploits related to that version.

telnet <target-ip> 21

Look for version information in the banner. If the banner is hidden, tools like Netcat can also be used:

nc -v <target-ip> 21

Directory Traversal Vulnerability

FTP misconfigurations may allow you to navigate outside the intended directory. Try moving up directories using cd ... If you can navigate to system files like /etc/passwd, it indicates a directory traversal vulnerability.

Exploitation

Once you’ve gathered information from enumeration, the next step is exploitation. Below are some common FTP vulnerabilities that you can exploit.

Brute Force Attack

If anonymous access is not allowed, you can attempt a brute force attack to guess the FTP credentials. Hydra is a popular tool for this:

hydra -l <username> -P /path/to/password/list.txt ftp://<target-ip>
  • -l specifies the username.

  • -P specifies the wordlist file.

Make sure to limit the number of attempts to avoid detection by the target.

Exploiting Weak Permissions

If the FTP server allows you to upload files and execute them, you can upload malicious scripts or binaries (e.g., PHP, Python) to gain access to the system.

Steps:

  1. Upload a reverse shell to the FTP server.

  2. Set up a listener on your machine to catch the connection.

  3. Execute the shell script from the FTP directory (if allowed).

For example, using Netcat:

nc -lvnp 4444

Upload a reverse shell script to the server and execute it to gain a connection.

Misconfigurations and Default Credentials

Check if the FTP server is using default credentials. Many FTP services come with default usernames and passwords. Refer to lists of default credentials for popular FTP software like ProFTPD, vsftpd, or FileZilla.

Vulnerable Software Versions

Once you have identified the software version of the FTP server, search for known vulnerabilities and exploits. Exploit-DB is a great resource for this. Look for CVEs related to the FTP server software and version.

For example, vsftpd 2.3.4 has a famous backdoor vulnerability (CVE-2011-2523).

Search for available exploits:

searchsploit vsftpd 2.3.4

This will provide potential exploit paths, like uploading a backdoored file or leveraging default credentials.

Privilege Escalation and Post-Exploitation

Once you gain access, the next step is privilege escalation, where you aim to increase your privileges on the system to become an administrator or root.

Escalation via FTP Misconfigurations

If you can access sensitive system files like /etc/passwd through FTP, you may be able to escalate your privileges by modifying files, creating new users, or gathering valuable information like password hashes.

Using Local Exploits

If the FTP service allows file uploads, you can upload local privilege escalation scripts to the server. Look for kernel exploits that match the target system’s version.

Example:

  1. Upload a local exploit to the FTP server.

  2. Use the exploit to elevate privileges once executed.

Capturing Credentials

If the FTP server logs user activity, you might be able to retrieve plaintext credentials from log files. Search for logs related to authentication or session data.

Use grep to search for specific strings in log files:

grep -i "user" /var/log/auth.log

Look for stored passwords or session tokens that can be used for further access.

Bypassing Firewalls and Filters

Some FTP servers are configured with firewalls or filters that prevent direct exploitation. Here are some techniques to bypass them:

Active vs Passive Mode

FTP operates in two modes: Active and Passive. If one mode is blocked by a firewall, you can try switching modes.

  • Active Mode: Client opens a port for the server to connect.

  • Passive Mode: Server opens a port for the client to connect.

Use the passive command in FTP clients if the active mode is blocked.

Tunneling FTP Traffic

You can tunnel FTP traffic through SSH or use proxy servers to bypass firewalls. This is useful when dealing with secure environments.

Example of tunneling FTP through SSH:

ssh -L 2121:<target-ip>:21 user@<ssh-server-ip>

This command forwards your local port 2121 to the target server's port 21, allowing you to bypass network restrictions.

Tools for FTP Penetration Testing

Here is a list of tools commonly used for FTP pentesting:

  • Nmap: For port scanning and service enumeration.

  • Hydra: For brute force attacks on FTP credentials.

  • Metasploit: Contains modules for FTP exploitation.

  • Netcat: For banner grabbing and reverse shells.

  • Searchsploit: For finding available exploits.

  • Wireshark: For capturing and analyzing FTP traffic.

  • Burp Suite: Can be used to intercept FTP traffic if using proxies.

Common FTP Commands

🌐
member
@VeryLazyTech
@VeryLazyTech
@VeryLazyTech
shop
buy me a coffee
​