StartUp
Room Covers:
Discovery
Exploitation
Privilege Escalation (horizontal + vertical)
Target Details
IP: 10.10.115.38
Service and Content Discovery
Scan Machine with Nmap
nmap -sC -sV -Pn -oN nmap.txt 10.10.115.38 Nmap scan report for 10.10.115.38 Host is up (0.38s latency). Not shown: 996 closed tcp ports (conn-refused) PORT STATE SERVICE VERSION 21/tcp open ftp vsftpd 3.0.3 | ftp-anon: Anonymous FTP login allowed (FTP code 230) | drwxrwxrwx 2 65534 65534 4096 Nov 12 2020 ftp [NSE: writeable] | -rw-r--r-- 1 0 0 251631 Nov 12 2020 important.jpg |_-rw-r--r-- 1 0 0 208 Nov 12 2020 notice.txt | ftp-syst: | STAT: | FTP server status: | Connected to 10.x.x.x | 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 | At session startup, client count was 2 | vsFTPd 3.0.3 - secure, fast, stable |_End of status 22/tcp open ssh OpenSSH 7.2p2 Ubuntu 4ubuntu2.10 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 2048 b9:a6:0b:84:1d:22:01:a4:01:30:48:43:61:2b:ab:94 (RSA) | 256 ec:13:25:8c:18:20:36:e6:ce:91:0e:16:26:eb:a2:be (ECDSA) |_ 256 a2:ff:2a:72:81:aa:a2:9f:55:a4:dc:92:23:e6:b4:3f (ED25519) 80/tcp open http Apache httpd 2.4.18 ((Ubuntu)) |_http-title: Maintenance |_http-server-header: Apache/2.4.18 (Ubuntu) 1131/tcp filtered caspssl Service Info: OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . # Nmap done at Sat Jul 2 13:34:28 2022 -- 1 IP address (1 host up) scanned in 64.99 secondsWe can login anonymously on FTP and we can write data anonymously in
ftpdirectoryServices Discovered
ServicePortVersionFTP
21
vsftpd 3.0.3
SSH
22
OpenSSH 7.2p2
HTTP
80
Apache httpd 2.4.18
Visiting HTTP website doesn't provide much information
Finding directories using gobuster
gobuster dir -u http://10.10.115.38 -w /usr/share/wordlists/SecLists/Discovery/Web-Content/directory-list-2.3-small.txt -t 30 --no-error -o web-dirs.txtDirectories Found
DirectoryLinkfiles
/files
On visitng
/fileswe get few files along with notice directory
Accessing FTP
Login anonymously
Logged in successfully
list files
files are of web directory
/files
Get Reverse Shell from Target Machine
Download php reverse shell
In reverse shell, change IP to TryHackMe VPN IP. default port is 1234
Start Netcat listener
Upload via FTP anonymously
From browser visit
/files/ftp/directory and click on reverse shell file to get reverse shell on attacker's terminal
Search for First Flag
Find files
Read
recipe.txtfileWe need to escalate privileges to read files
Privilege Escalation
Finding files with sticky bits
Couldn't find something important
Checking for Python to get shell with tty
Spawn TTY terminal to use sudo/su
from
/incidentsdirectory found a pcap fileTo analzye this file in WireShark, we need to first download the file, let's copy this file in
ftpdirectory, then we can download it from web serverDownload the file from
http://10.10.115.38/files/ftp/suspicious.pcapngLoad the file in WireShark, right click on TCP packet number around 200 and choose follow -> TCP Stream, a list of commands will pop up in a new window, from where we can find the password
From pcap file: use follow lennie password
c4ntg3txxxxxxxxxxxNow, we can log into lennie's account with the password
We've successfully escalated privileges horiztontally
Get User Flag
Finding Flag
Read
user.txtfile
Escalating Privileges Vertically
finding executables with sticky bits
let's try sudo
get sudo executables list
We cannot use
sudocommandThere was scripts folder in the home directory
planner.shscript belongs torootuserRead
planner.shscriptscripts calls another script
/etc/print.shwith root privilegesLet's analyze
print.shscriptThis script belongs to lennie, hence we can write it and create a reverse shell with root access
Overwrite file contents
Start netcat listener on attacker's machine on port 9999
Execute
planner.shscriptGet Reverse Shell
We've successfully got root privileges machine
Get Root Flag
List files
Read
root.txtfile
Last updated
Was this helpful?