HTB - Tabby

Overview

Short description to include any strange things to be dealt with

TODO: Finish writeup and clean up

Useful Skills and Tools

Useful thing 1

  • description with generic example

Useful thing 2

  • description with generic example

Enumeration

Nmap scan

I started my enumeration with an nmap scan of 10.10.10.194. The options I regularly use are: -p-, which is a shortcut which tells nmap to scan all ports, -sC is the equivalent to --script=default and runs a collection of nmap enumeration scripts against the target, -sV does a service scan, and -oA <name> saves the output with a filename of <name>.

/var/lib/tomcat9/webapps/ROOT/index.html

added megahosting.htb to hosts file

We have recently upgraded several services. Our servers are now more secure than ever. Read our statement on recovering from the data breach

http://megahosting.htb/news.php?file=statement

recently had a breach of some sort http://megahosting.htb/news.php?file=statement replaced 'statement' with ../../../../etc/passwd and got the file

found username ash

Next decided to check out the HTTP site hosted on port 8080

When I navigated to port 8080 I was greeted by a basic authentication prompt that said "Tomcat Manager Application". This sounded promising, but I needed to find some credentials first.

Putting in bad credentials redirected me to a very verbose 401 Unauthorized page. http://10.10.10.194:8080/docs/host-manager-howto.html

<user username="tomcat" password="$3cureP4s5w0rd123!" roles="admin-gui,manager-script"> </user>

how to use curl to send package to server

https://www.certilience.fr/2019/03/tomcat-exploit-variant-host-manager/

in msfconsole

started my handler in msfconsole

upload did not work as in the Windows example, kept reading in the documentation, and found a way to deploy directly, without adding first

http://10.10.10.194:8080/docs/manager-howto.html#Deploy_A_New_Application_Archive_(WAR)_Remotely

In order to send the file

I checked the man page for the correct options and found -T

after troubleshooting...I realized that my payload was set to be run in the context of a linux machine, however, this was being run as a java file (after the .war was unpacked, running on the web server) so I changed my payload and tried again

next I uploaded the new version (had to change the name since the old one still existed)

Then I activated my reverse shell by curling the

[make sure to put the trailing /, it looks like it is doing something, but will give no output and wont work without it!!]

Initial Foothold

I got a shell back on my nc listener, and attempted to upgrade my shell using python

setting stty raw -echo broke my nc shell, so I switched to msfconsole (I think I may have had this problem with zsh before, will have to try with bash and see if it works properly)

Road to User

Further enumeration

shsjks

I got annoyed at the lack of tab completion and other niceties so I tried backing out and starting my nc listener from bash, and was able to set raw stty with no problem

in the /var/www/html/files folder I found some backup files

exfiltrated the backup zip to my machine and tried to open it, but it was password protected

I tried using zip2john to extract the zip hash for cracking, and got a message that some of the files might not be encrypted\

checked hashcat's help to see which filetype to use

it took only a few secs to crack the password, which was admin@it

The index.php file seems nearly identical to the one currently hosted...except for the email address sales@digitallandscape.com and other references to the name Digital Landscapes. It seems like the company did some rebranding recently.

URLFinding user creds

User.txt

The zip file seemed to be a dead-end, so I decided to try to use the password I had found on the only user I knew, ash, and was able to su over to that user!

Path to Power (Gaining Administrator Access)

Enumeration as User ash

wierd error while trying to check sudo permissions

plugdev and lxd sound interesting

Getting a shell

https://shenaniganslabs.io/2019/05/21/LXD-LPE.html

apparently I was not the only one working one this particular machine...

Root.txt

https://www.hackingarticles.in/lxd-privilege-escalation/

Even though I had the root flag, I was not convinced that I had actually owned the machine,

so I tried to add my public key and ssh in

now I was happy and satisfied that I had truly owned the machine. I was still not entirely happy with how easy the root privesc was, but it was a good learning experience to know to secure members of the lxd group!

Thanks to egre55 for something interesting or useful about this machine.

If you like this content and would like to see more, please consider buying me a coffee!

Last updated

Was this helpful?