HackTheBox – Traverxec – Writeup
User
- port and version enumeration:
nmap -sV -sC -oA traverxec.htb 10.10.10.165
- We see that the http server being used is
nostromo 1.9.6
. This is a vulnerable service as seen by https://www.exploit-db.com/exploits/47573 - We can run the metasploit module as per rapid7.
- This gives a shell with
www-data
. - Running
LinEnum.sh
provides some interesting data, namely that we have a.htpasswd
hash available. - This hash is a
md5crypt
hash. We will use johnhtpasswd --list=/usr/wordlist/rockyou.txt
to crack this. - After cracking this hash, we need to find the http directory where we can use this password.
- Browsing
/home/david/public_www
we can find a protected area. The password cracked earlier works! - Download the tar.gz file and extract using
gunzip
. - We have some ssh key backups. The most important file here is
id_rsa
. - Use
ssh -i <key file>
to try and connect to david@traverxec.htb. - We need a passphrase. Let's try using
ssh2john
and pass it tojohn
to brute force. We will userockyou.txt
once again. - Passphrase found! Use this to connect via ssh.
- id = david
cat user.txt
Root
- Use the shell script in home directory and see the commands being issued. Namely the use of
sudo
withjournalctl
. - Copy the file elsewhere and execute. It still works.
- Add a
&&
operator and issue/bin/sh
at the end of the shell script. - Run the script and you should be able to use
!/bin/sh
to get a shell vialess
withuid=0
- cat root.txt