Post

HTB Linux Medium: Surveillance

Surveillance is a Medium rated Linux machine on HTB.

HTB Linux Medium: Surveillance

Nmap

Pasted image 20240714205848.png

Add the surveillance.htb domain to the hosts file. Pasted image 20240714205841.png

Initial Foothold

Enumerate HTTP (Port 80)

Webpage. Pasted image 20240714205836.png

The website uses craft CMS (Possible CVE). Pasted image 20240714205830.png

Dir busting. Pasted image 20240714205825.png

Craft CMS exploit (run PHP code). Pasted image 20240714205821.png

Shell

Use the Python script to gain shell access (remove proxy to localhost). Pasted image 20240714205817.png

Lateral Movement

Upgrade to meterpreter session

Generate payload using msfvenom. Pasted image 20240714205807.png

Upload the payload to the box. Pasted image 20240714205812.png

Set up listener in Metasploit Pasted image 20240714205804.png

Make the ELF file payload executable, then execute it to trigger the reverse shell in Metasploit. Pasted image 20240714205755.png

Improved shell. Pasted image 20240714205748.png

Enumerate filesystem

Whilst enumerating the filesystem we come across an SQL backup ZIP file. Pasted image 20240714205744.png

Download the file and check out its contents to reveal a password hash for the admin user. Pasted image 20240714205741.png

Shell as matthew

We can use crackstation.net to bruteforce the password matthew:starcraft122490. Pasted image 20240714205736.png

SSH into the box as the matthew user Pasted image 20240714205731.png

Enumerate as matthew

Using the www-data user we find that port 8080 is only listening on the localhost, we can use ssh port forwarding to access this page. Pasted image 20240714205727.png

Webpage. Pasted image 20240714205722.png

Zoneminder has Metasploit modules. Pasted image 20240714205719.png

Select and configure the exploit. Pasted image 20240714205714.png

Priv Esc

Enumerate as zoneminder

Sudo -l output. Pasted image 20240714205711.png

Become root

Create rev.sh payload in the /tmp directory. Pasted image 20240714205708.png

Run the following command. Pasted image 20240714205700.png

You should now have a root shell. Pasted image 20240714205656.png

User.txt

Pasted image 20240714205650.png

Root.txt

Pasted image 20240714205642.png

You have PWNED

Pasted image 20240714205636.png

Sources

This post is licensed under CC BY 4.0 by the author.