# ToolsRus

This box's purpose is to use different tools to enumerate the server, gather information and take over the machine.

The tools required for this task are:

* Dirbuster
* Hydra
* Nmap
* Nikto
* Metasploit

We start this box running an nmap scan.

![](https://3889206050-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M6DIEHtstePxj4NCmCC%2F-MDzQeMG6AsAoxRrTN8y%2F-MDzRty-pLSGQJJvWlRq%2Fimage.png?alt=media\&token=240ba3c2-26f4-4383-a244-c09b9e7e7b9a)

The nmap scan shows us the typical port 22 for ssh open, apache on port 80 and Tomcat on poet 1234. It also tells us that the target machine is running Ubuntu.

Navigating to the default webpage on port 80 doesn't show us anything useful.

![](https://3889206050-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M6DIEHtstePxj4NCmCC%2F-MDzQeMG6AsAoxRrTN8y%2F-MDzSLQqlxxTA44cVN0b%2Fimage.png?alt=media\&token=1b8f4ce3-a8bb-4745-b6de-f0908a1a0e12)

The first questions of the box asks us about the webpage's directories, so we can run dirbuster or any other directory bruteforce scanner to find about that.

![](https://3889206050-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M6DIEHtstePxj4NCmCC%2F-MDzQeMG6AsAoxRrTN8y%2F-MDzSq2xH_dznvfJQXw0%2Fimage.png?alt=media\&token=08111acb-296d-4161-be03-928f9d9944c6)

This scan shows us two directories `guidelines` and `protected`

With this we can answer the first question, and by navigating to the /guidelines directory we can answer the second.

![](https://3889206050-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M6DIEHtstePxj4NCmCC%2F-MDzQeMG6AsAoxRrTN8y%2F-MDzTY6fXMWcJLD_rSUV%2Fimage.png?alt=media\&token=0c401391-3546-4c02-98c5-c59364a968f5)

By navigating to the /protected directory we also get the answer to the third question.

![](https://3889206050-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M6DIEHtstePxj4NCmCC%2F-MDzQeMG6AsAoxRrTN8y%2F-MDzTwkQ7yTlICfCQONh%2Fimage.png?alt=media\&token=24de860c-d978-4cfe-bf4a-89bfa1aaa035)

The forth question asks whats bob's password, so we can try to find it by executing a bruteforce attack with hydra.

![](https://3889206050-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M6DIEHtstePxj4NCmCC%2F-MDzQeMG6AsAoxRrTN8y%2F-MDzVJavwOlNZcTqANB7%2Fimage.png?alt=media\&token=48d32df7-64c9-4b30-9096-1b961304605f)

Logging in as bob gets us to this page.

![](https://3889206050-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M6DIEHtstePxj4NCmCC%2F-MDzQeMG6AsAoxRrTN8y%2F-MDzV_4_Z_7vJmxk7fAW%2Fimage.png?alt=media\&token=0682b34e-2a27-4b50-ae08-34d4632cd8e8)



This probably means we need to inspect that apache server on port 1234.&#x20;

The next questions are about the port and service running the other webservice, which can be answered with the previous nmap scan.

The box asks us to exploit the Apache TomCat server with metasploit, but instead I will do it with a reverse shell and netcat listener.

Using msfvenom we originate a war shell.

![](https://3889206050-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M6DIEHtstePxj4NCmCC%2F-MDzQeMG6AsAoxRrTN8y%2F-MDzb-sROg_dfeU6MjsM%2Fimage.png?alt=media\&token=4bcddbd7-30e9-4b9c-9c59-80e7cae144fe)

Which we upload in the tomcat server as user bob.

![](https://3889206050-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M6DIEHtstePxj4NCmCC%2F-MDzQeMG6AsAoxRrTN8y%2F-MDzb8dAO2lCNVnPjffQ%2Fimage.png?alt=media\&token=1061f0e5-9014-4499-a3dd-0b79d77679a8)

We then start a netcat listener.

![](https://3889206050-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M6DIEHtstePxj4NCmCC%2F-MDzQeMG6AsAoxRrTN8y%2F-MDzbLCUA9f5nJNFGofg%2Fimage.png?alt=media\&token=f41081db-cc99-4fcf-9601-40a94a5262e9)

And open the shell directory that will give is a shell with root access to the server.

![](https://3889206050-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M6DIEHtstePxj4NCmCC%2F-MDzQeMG6AsAoxRrTN8y%2F-MDzbjIfJchwH5H6qfy6%2Fimage.png?alt=media\&token=1165ed0b-8bb4-4c25-ad2e-de835e451c8f)

![](https://3889206050-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M6DIEHtstePxj4NCmCC%2F-MDzQeMG6AsAoxRrTN8y%2F-MDzbptwmOAGu_AgMBOY%2Fimage.png?alt=media\&token=cc001bbc-00a0-4449-866d-f9f44e7c31ff)

Then we can find the flag.txt in the root directory to solve the box.





