# Deathnote: BOOT2ROOT CTF VULNHUB WRITEUP

Welcome back to my writeup! Today, I’ll show you how I solved the **Deathnote** challenge from **Vulnhub**. It’s a simple Boot2Root, and I’ll walk you through each step, the tools I used, and the techniques that made it straightforward to complete. Let's start!!!

**Reconnaissance**

First, we’ll use **Nmap** to identify open ports that could serve as potential attack vectors.

```
nmap -A -T5 172.29.160.38
```

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FNID4PNPNWtmYSxk0P0tZ%2FScreenshot%20(674).png?alt=media&#x26;token=3b8b57ea-d9af-4539-b69b-0d2bb698f2be" alt=""><figcaption></figcaption></figure>

From the **Nmap** scan results, we can see that both port 22 (commonly used for **SSH**) and port 80 (used for **HTTP**) are open on the target machine. This tells us that the system is running services on these ports, which could potentially be leveraged for further enumeration and exploitation.

Let's visit the website.

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2Fr9VGbIZBFz3sIdvaK1Hq%2FScreenshot%20(676).png?alt=media&#x26;token=8dc888c8-e30c-4f3c-b41b-49b20314d915" alt=""><figcaption></figcaption></figure>

The reason it didn’t work is because the service relies on a specific domain name. If you look closely at the URL, you’ll notice it uses a domain instead of just an IP address. To access it properly, we need to add that domain to our `/etc/hosts` file so the system can resolve it correctly.

After adding the entry to our `/etc/hosts` file, we simply refresh the page, and we’re now able to access the site properly

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FNbmxnrrv1KR3P9Kijp18%2FScreenshot%20(678).png?alt=media&#x26;token=00f70a6e-ccfc-4990-a42b-b05ad2e738b8" alt=""><figcaption></figcaption></figure>

Woah, Kira!!! Let's take a look at the **HINT**.

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2F51lq1FkfCfpMO6AuxAYK%2FScreenshot%20(682).png?alt=media&#x26;token=e2012b6a-4e65-48bb-8adc-a5dfd0e924df" alt=""><figcaption></figcaption></figure>

It mentions that there’s a file called *notes.txt* somewhere on the server—but where exactly? Let’s broaden our enumeration to find out.

While going through the site, I noticed that it’s actually running **WordPress**. With that in mind, using **WPScan** seems like a logical next step to gather more information and potentially uncover vulnerabilities.

```
wpscan --url 172.29.160.38
```

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2ForzPk5T2AWqPzwwEJP4X%2FScreenshot%20(685).png?alt=media&#x26;token=92f7a6ad-a9a8-4046-a692-2a5d2793f0df" alt=""><figcaption></figcaption></figure>

I quickly noticed the *uploads* directory. In most WordPress assessments, this is one of the first locations you should inspect, since it often contains user-uploaded files that might reveal useful information or even lead to potential footholds.

Let's visit it.

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2Fok6AP5RMjamP9d1yHWbU%2FScreenshot%20(687).png?alt=media&#x26;token=647f79da-3201-4c2b-a072-409547c6f1bc" alt=""><figcaption></figcaption></figure>

After digging around, I finally found the file mentioned in the earlier hint, located inside the `2021/07/` directory.

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FEIRwWrpkHUDIJHXOVG7j%2FScreenshot%20(688).png?alt=media&#x26;token=4777a58f-8b36-460a-8b0e-ad14de9210b6" alt=""><figcaption></figcaption></figure>

At the bottom, I found two text files, and one of them matched the hint we saw earlier. I simply used `wget` to download both files onto my machine.

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2Fy9Stp90N9mm4ZLHv0su3%2FScreenshot%20(689).png?alt=media&#x26;token=717196d8-82fa-4b9f-8c85-04b7c7aa3c71" alt=""><figcaption></figcaption></figure>

With both files in our hands, the next step is to inspect what’s inside them.

Here's the `notes.txt`

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2F4286CfNQw5E7XaoVTZo0%2FScreenshot%20(690).png?alt=media&#x26;token=a656a106-d433-4430-b572-e20c7056740c" alt=""><figcaption></figcaption></figure>

And here's the `user.txt`&#x20;

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FacALb1gvcvNMYP3kc6or%2FScreenshot%20(691).png?alt=media&#x26;token=c3d235b0-90bc-493d-b0c1-aef5a24551d1" alt=""><figcaption></figcaption></figure>

This looks like a wordlist. If my assumption is right, it might contain the credentials for SSH. So, let’s use these two lists and try brute-forcing SSH with **Hydra**.

In this case, we’ll brute-force both the username and the password. This is manageable because `user.txt` contains only a handful of usernames, and `note.txt` provides just a few potential passwords or phrases.

```
hydra -L user.txt -P notes.txt 172.29.160.38 ssh -t 20
```

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FTce2gp0IuA1GzqUCocly%2FScreenshot%20(692).png?alt=media&#x26;token=3091ffee-df42-449d-9872-9f00d7055eba" alt=""><figcaption></figcaption></figure>

After some time, we've successfully got the SSH credential for user `l` . Now let's login to SSH as user `l` .

```
ssh l@172.29.160.38
```

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FVBrPIj4Xl5jX8JxAOsBn%2FScreenshot%20(694).png?alt=media&#x26;token=aca3dfe5-673c-4cfb-9cfd-281c903c91fd" alt=""><figcaption></figcaption></figure>

We’re in! Inside the user `l` account, there’s a `user.txt` file that contains a **Brainfuck** code.

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FNQc5qD5gQBD7A6kRyVb8%2FScreenshot%20(695).png?alt=media&#x26;token=a1b7b7b6-0575-4e43-aa6a-48a5f31c06f8" alt=""><figcaption></figcaption></figure>

When I decode it using [Dcode](https://www.dcode.fr/brainfuck-language), this is the result:

`i think u got the shell, but you won't be able to kill me -kira`&#x20;

It seems that `l`  is not alone here, maybe there's another user named `kira` .

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FuhkaOejxlW4iSNzY7zEd%2FScreenshot%20(698).png?alt=media&#x26;token=944db038-ede0-424d-a34d-57b056d21c51" alt=""><figcaption></figcaption></figure>

There it is! `kira` is here! Now let's take a look!

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FGbaCB4WILd4oit83ZC7w%2FScreenshot%20(699).png?alt=media&#x26;token=8933dafe-f3ca-48e9-947e-2739c772d8f0" alt=""><figcaption></figcaption></figure>

As you can see, there’s a file called `kira.txt`. However, if you look closely at its permissions, it’s readable only by the user `kira`. Since we’re currently logged in as user *l*, we don’t have access to it. This means we’ll need to switch from user `l` to user `kira` in order to read the file. But the question is, how? Since we don't know the password of `kira` .

Looking more closely, you’ll notice an `.ssh` directory, and inside it there’s an `authorized_keys` file and we can read it!!&#x20;

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2Fmr07V1MR6JRBBt8XVhRO%2FScreenshot%20(703).png?alt=media&#x26;token=60755a7c-590e-4eb5-b0fe-0dde23d2458d" alt=""><figcaption></figcaption></figure>

Given this setup, you’ll notice that the `authorized_keys` file is owned by user `l`, which is our current account. Because of that, we can SSH into the `kira` account without needing a password.

But how? Let me explain how SSH authentication logic works.

When you connect to a Linux system using SSH, the authentication process relies on a **public–private key pair**. The flow is simple:

* The **public key** goes into the target user’s `~/.ssh/authorized_keys`
* The **private key** stays with the attacker/user who wants to authenticate

During login, SSH checks:

"Does the client’s private key match any of the public keys in this user’s `authorized_keys`?"

If **yes**, access is granted.\
If **no**, authentication fails.

To switch to `kira`, we'll just use ssh

```
ssh kira@172.29.160.38
```

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2Fd6KbOAZjnAlUUjQMMVu1%2FScreenshot%20(700).png?alt=media&#x26;token=39ef56b2-db5e-4ec5-a6a1-4cef271ba03c" alt=""><figcaption></figcaption></figure>

We're now `kira` ! Now let's check the `kira.txt` .

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FWz6oVE5jUZMrFuAGpgIK%2FScreenshot%20(705).png?alt=media&#x26;token=4d2df9f8-5b1f-4ad7-926b-4a6400ecfd91" alt=""><figcaption></figcaption></figure>

It's a **Base64** encoded string, if we decode it, this is the result:

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FbVdywyxmwoOrdlhvQA65%2FScreenshot%20(706).png?alt=media&#x26;token=1d5dd75f-a8b9-4062-bd24-a57f15498e18" alt=""><figcaption></figcaption></figure>

Looks like there's a folder hidden inside `/opt` and `/var` . Let's visit `L` in `/opt` first.

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2F6MM5NimAowOV9KULvrel%2FScreenshot%20(707).png?alt=media&#x26;token=6dc81202-499a-4df4-a35e-e790bb2f5d27" alt=""><figcaption></figcaption></figure>

Now, let's visit the `fake-notebook-rule` directory first.

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FN46RWgrqDx3viAQZpUQ6%2FScreenshot%20(708).png?alt=media&#x26;token=383115c9-ad86-440d-914b-d79262d12957" alt=""><figcaption></figcaption></figure>

That `case.wav` looks like a wav file but when I attempt to listen to it, it's said that it's not in correct format and when I take a look at its content, it's a hex string!

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FhQ90jF4HBQaNOFUyhe8v%2FScreenshot%20(711).png?alt=media&#x26;token=0d2b6c77-4f20-4e5c-99ab-ae60fd603248" alt=""><figcaption></figcaption></figure>

Decode it and this is the result:

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FjB5N3hjIqytsKrKuHrvk%2FScreenshot%20(712).png?alt=media&#x26;token=b7c78cec-4945-4f86-befe-8ce0eee34b7f" alt=""><figcaption></figcaption></figure>

It's a Base64 string, decode it and this is the result:

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FosnFbnvCS4aOKHrerhu4%2FScreenshot%20(713).png?alt=media&#x26;token=8aa2e918-d337-44aa-87d8-df208e2ad55f" alt=""><figcaption></figcaption></figure>

So it's a password! Let's try to use this to switch to **root**.

```
sudo su
```

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FOAjVpWxvECzDVS5eKu40%2FScreenshot%20(714).png?alt=media&#x26;token=9ed2bf4e-6335-4064-b6e1-8ecd8d708452" alt=""><figcaption></figcaption></figure>

We're finally root!!&#x20;

<figure><img src="https://271954773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYsivTjPn2jLXI0ZgVqeF%2Fuploads%2FtFKbfFp2MnJf0c8gRq5r%2FScreenshot%20(715).png?alt=media&#x26;token=06409134-78d7-4875-80d5-c8070365b524" alt=""><figcaption></figcaption></figure>

We've successfully solved Deathnote!!!
