Posts Hack The Box: Celestial write-up

Hack The Box: Celestial write-up

Hack The Box: Celestial machine write-up

This was my first experience in Hack The Box, and so I decided to start on the easiest machine of all: Celestial, running with ip


First of all, I started enumerating open ports in order to see the services that were active in the machine. I ran the following:

$ nmap -sV -sC

After a minute or less, I got that the only port open was 3000 with a Node.js Express Framework. Hence, I know where the vulnerability is.

Result of nmap scan



After accessing the machine with the port ( on Firefox, I am greeted with the following:

Welcome message


By inspecting the request with Burp Suite, I find a weird cookie named profile. It is encoded first with url-encoding and then with base64, so I decode the value and obtain a json:

Burp intercept of the request


Decoding of cookie


The first interesting thing here to notice is that by modifying the last parameter we can change the welcome message.

Modification of the json results in other message


Therefore, the code must decode the cookie, read the last value and then use it as an argument to print the message. However, if we try something that is not an integer, we get an error.

Error message


This was a really important clue, as it told me that a deserialization from the node-serialize module was taking place. It could be the vulnerability, so I started reading up on node deserialization.

I found this After reading the first article (, I was almost sure that was the vulnerability I was looking for.

Exploit (User access)

As it was explained in the tutorial, the exploit was based on passing a function on the json parameter, so that it gets executed and we get a reverse tcp shell.

First of all, I ran ifconfig to get my local ip address, which was Than, I call from the tutorial with my ip and a port (for example 1337) as arguments.

Then I copy the eval() returned by the script and insert it in the brackets in _$$ND_FUNC$$_function (){}() Afterwards, I replace the “2” in the json by the function expression and encode it all back again. Then, after intercepting the request with Burp and changing the cookie, I get “Hey Dummy, Undefined + Undefined is NaN”. we succeeded in the exploit, as listening with netcat opens up a shell:

Netcat opens with reverse shell


Then we just have to find the hash inside Documents/user.txt:


Exploit (Root access)

To escalate privileges and get from normal user to root I used the dirty cow exploit, which was compatible with the Linux running in the machine (cat /etc/*-release). In order to see the options I went to, where I chose the second link, as I want to get permanent root.

However, as I couldn’t use wget to download the cowroot.c script when I was logged in to the machine (dunno why), I set up a SimpleHTTPServer with python and wget’ed my local machine. Then I compiled the cowroot.c script in gcc and launched the executable. Now I am root and can see the hash inside /root.

Escalation of privileges and hash


Diego Bernal Adelantado

This post is licensed under CC BY 4.0 by the author.