β΄οΈNode
Node is a medium level boot2root challenge, originally created for HackTheBox. There are two flags to find (user and root flags) and multiple different technologies to play with.
1. Reconnaissance
Scanning the network to find vulnerable machine's IP
arp-scan -l
Interface: enp0s3, type: EN10MB, MAC: 08:00:27:9c:9d:c8, IPv4: 192.168.10.25
Starting arp-scan 1.9.7 with 256 hosts (https://github.com/royhills/arp-scan)
192.168.10.1 52:54:00:12:35:00 QEMU
192.168.10.2 52:54:00:12:35:00 QEMU
192.168.10.3 08:00:27:ec:f5:6b PCS Systemtechnik GmbH
192.168.10.27 08:00:27:9e:3e:6f PCS Systemtechnik GmbH
4 packets received by filter, 0 packets dropped by kernel
Ending arp-scan 1.9.7: 256 hosts scanned in 2.291 seconds (111.74 hosts/sec). 4 respondedWe find the IP of the vulnerable machine to be
192.168.10.27
2. Scanning
2.1 Nmap
Using
nmapto find the open ports and their services
We find 2 open ports, tcp ports
22and3000with a ssh and a web server with apache hadoop running respectively
:3000
:3000Visiting the webpage at
:3000, we are greeted with a welcome page

Exploring the source code of the homepage, we can see a number of javascript files.

As we check out each of them, we see a very interesting endpoint referenced in
/assets/js/app/controllers/home.jswhich points to/api/users/latest

Navigating to the endpoint
/api/users/latest, we see the usernames and passwords of the newest members who were shown in the homepage who are normal users.
Navigating up to
/api/users, we get admin credentials
Trying to decode the password hash
dffc504aa55359b9265cbebe1e4032fe600b64475ae3fd29c07d23223334d0afusing crackstation

We find that it is a common word and can be cracked. We get the admin credentials
myP14ceAdm1nAcc0uNT : manchester
Login in with the credentials from the hompage

We are greeted with a minimal admin page with an option to download backup

Downloading the backup
myplace.backupand examining the file type
We can see that although its file type is ASCII text, we we view the file, we can see that it is base64 encoded.
Decoding the file and saving it to
decopde_backup
Now if we examine the decoded file, we can see that it is a zip file which is password protected
2.2 Brute-Forcing zip password
We can use
fcrackzipto bruteforce the password
Using the password
magicword, we can extract the zip file.Extracting it, we find out that it contains the copy of the
vardirectory of the target.After further examination we find the credentials of user
markin/var/www/myplace/app.jsfile
mark : 5AYRft73VtFpc84k
3. Initial Foothold
3.1 SSH
We can log in via ssh as user mark with the password.
We find the
user.txtflag in the home directory of usertomwhich cannot be accessed by usermark
3.2 Lateral Movement
Sidenote: We are moving to the next step, as that was the intended way of solving the box when it was released. After its release, a kernel exploit was found which can directly give us root access. We use this kernel exploit to gain root access once we get the
user.txtusing the original intended method. You can totally bypass the next few steps and directly use the exploit to get root. Personally, I felt that solving the box this way helped me to learn some moreIn order to change to user
tomwe can first find out if they are running any processes currently.
We see an interesting process run by
tomat/var/scheduler/app.jswhich has a similar structure as our backup files.Viewing
app.js
Here, we see that after very 30 seconds, the user
tomlogs in asmarkto the database (MongoDB) and checks if there are anytasks. If there are, he executes the task withdoc.cmdand then deletes them.We can modify this to spawn us a shell.
Logging in as
markto the database.
We can modify the command to include a
netcatreverse shell from pentestmonkey
Starting an
nclistener, capturing and stabilizing the shell
Reading
user.txt
4. Privilege Escalation
The kernel version of the machine is outdated and vulnerable to
CVE-2017-16995
Downloading the exploit (44298)from ExploitDB to the
tmpdirectory of our target and renaming it as 44298.c
Compiling it to
exploitand executing it.
We are
rootReading the contents of
root.txt
Last updated