# Takeover

## Overview

Greetings everyone,

In this write-up, we will tackle PC from TryHackMe.

Machine link: [Takeover](https://tryhackme.com/room/takeover)

Difficulty Level: Easy

Let's Begin 🙌

Firstly, connect to the THM server using the OpenVPN configuration file generated by THM. [Click Here](https://tryhackme.com/r/access) to learn more about how to connect to VPN and access the boxes.

Once connected to the VPN service, click on "Start 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

### Rustscan

`rustscan -a 10.10.89.215`

<figure><img src="https://3987209575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCrNVqJHUzhf98WDK3DMl%2Fuploads%2FEhPQ4mRmZVNhqSee66Gv%2FUntitled%201.png?alt=media&#x26;token=9a6727e9-5596-4cda-b92a-c507538452f9" alt=""><figcaption></figcaption></figure>

### Results

The Target machine has three services running:

| Port | Service |
| ---- | ------- |
| 22   | SSH     |
| 80   | HTTP    |
| 443  | HTTPS   |

***

## Information Gathering - futurevera.thm

Add the Machines’s IP address to `/etc/hosts` file in your attack box with reference to `futurevera.thm` and save it.

<figure><img src="https://3987209575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCrNVqJHUzhf98WDK3DMl%2Fuploads%2Fkt2uHcPcwgYY0f9RumPm%2FUntitled.png?alt=media&#x26;token=c9834d69-f6bd-45bb-b53d-67ef8862b04d" alt=""><figcaption></figcaption></figure>

Now lets check the HTTP website running on port 80. It was a simple landing page. Nothing interesting found.

<figure><img src="https://3987209575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCrNVqJHUzhf98WDK3DMl%2Fuploads%2FFiDyMxeZ8paPeZ85liju%2FUntitled%202.png?alt=media&#x26;token=cebb23d5-8997-43a4-be2b-a6ce3e5e419a" alt=""><figcaption></figcaption></figure>

***

## Enumeration - futurevera.thm

Next I started enumeration. I tried directory enumeration, but didn’t get anything.

### Subdomain Enumeration

So next I tried subdomain enumeration on the target.

I used `ffuf` for this task.

{% code overflow="wrap" %}

```bash
ffuf -u [http://futurevera.thm/](http://futurevera.thm/) -w /usr/share/wordlists/SecLists/Discovery/DNS/subdomains-top1million-20000.txt -H "HOST:FUZZ.futurevera.thm"
```

{% endcode %}

<figure><img src="https://3987209575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCrNVqJHUzhf98WDK3DMl%2Fuploads%2FhShTL1KXkGF7fU9hwk9M%2FUntitled%203.png?alt=media&#x26;token=00fd2df5-79cd-49c2-a53e-d7af7cfe0326" alt=""><figcaption></figcaption></figure>

The result had a lots of `302` response. So this time I filtered out all the response with a status code `302` and ran the command again.

{% code overflow="wrap" %}

```bash
ffuf -u http://<target_ip>/ -w /usr/share/wordlists/SecLists/Discovery/DNS/subdomains-top1million-20000.txt -H "HOST:FUZZ.futurevera.thm" -fc 302
```

{% endcode %}

<figure><img src="https://3987209575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCrNVqJHUzhf98WDK3DMl%2Fuploads%2FyGE8aAfctK7Vpp3G8ENk%2FUntitled%204.png?alt=media&#x26;token=5cab18db-03e2-4fff-9e67-cff4b32cef5f" alt=""><figcaption></figcaption></figure>

And this time found two subdomains. Now make sure to add these subdomains to the `/etc/hosts` file. You have to append the subdomains with the full url \[ Eg: `portal.futurevera.thm` ] to the previously add host separated by a space:

<figure><img src="https://3987209575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCrNVqJHUzhf98WDK3DMl%2Fuploads%2Fs17e4hha7KLKgxLIvLK8%2FUntitled%205.png?alt=media&#x26;token=60fc73df-4239-41a0-aa67-4db2d43c433d" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Remember to add all the subdomains to the `/etc/hosts` file to the respective IP address to access those subdomains.
{% endhint %}

Now I checked the `portal.futurevera.thm` subdomain.

<figure><img src="https://3987209575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCrNVqJHUzhf98WDK3DMl%2Fuploads%2FOVMFSHrHhFpwR8MxtFaU%2FUntitled%206.png?alt=media&#x26;token=331222dd-7a4d-4fe4-807a-16f422eba15e" alt=""><figcaption></figcaption></figure>

It wasn’t accessible. So next I checked `payroll.futurevera.thm` subdomain.

<figure><img src="https://3987209575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCrNVqJHUzhf98WDK3DMl%2Fuploads%2FFuh4dvxOgbJLsgz7KT2S%2FUntitled%207.png?alt=media&#x26;token=f8211c73-8a2f-4043-9605-2d4194b5cfe9" alt=""><figcaption></figcaption></figure>

That was also not accessible.

Now we can check the HTTPS website:

<figure><img src="https://3987209575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCrNVqJHUzhf98WDK3DMl%2Fuploads%2Fx3n7uvT6a7EHHiBugEia%2FUntitled%208.png?alt=media&#x26;token=9e1d8558-d089-407f-a270-06ed719caa86" alt=""><figcaption></figcaption></figure>

It resulted in the same landing page.

Next run `ffuf` on the HTTPS service to find the subdomains running via HTTPS.

{% code overflow="wrap" %}

```bash
ffuf -u https://<target_ip>/ -w /usr/share/wordlists/SecLists/Discovery/DNS/subdomains-top1million-20000.txt -H "HOST:FUZZ.futurevera.thm" -fc 302
```

{% endcode %}

<figure><img src="https://3987209575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCrNVqJHUzhf98WDK3DMl%2Fuploads%2FvjixsEqU7g6AncKfWmDo%2FUntitled%209.png?alt=media&#x26;token=100d53e4-1128-4942-9e57-209082f38e5b" alt=""><figcaption></figcaption></figure>

Since all the request has a response with a status code of 200, our filter for code 302 didn’t work. So this time I tried to filter using size, since all the response sizes are `4605`.

{% code overflow="wrap" %}

```bash
ffuf -u https://<target_ip>/ -w /usr/share/wordlists/SecLists/Discovery/DNS/subdomains-top1million-20000.txt -H "HOST:FUZZ.futurevera.thm" -fs 4605
```

{% endcode %}

<figure><img src="https://3987209575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCrNVqJHUzhf98WDK3DMl%2Fuploads%2FuDAepcykb3Y9wKcUaBop%2FUntitled%2010.png?alt=media&#x26;token=bfb9b69d-0d76-4c39-bd13-549c924ad1d0" alt=""><figcaption></figcaption></figure>

And found two new subdomains. Now append these subdomains to the `/etc/hosts` file.

<figure><img src="https://3987209575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCrNVqJHUzhf98WDK3DMl%2Fuploads%2FGjYFyQp8gamtR568k90p%2FUntitled%2011.png?alt=media&#x26;token=7cac4476-3475-4462-90a1-6a74cdfca368" alt=""><figcaption></figcaption></figure>

Navigate to `https://blog.futurevera.thm/`.

<figure><img src="https://3987209575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCrNVqJHUzhf98WDK3DMl%2Fuploads%2FpWuPW7x9GVoubNeShUQ6%2FUntitled%2012.png?alt=media&#x26;token=0f21155f-27fc-4d7a-8312-7fe8bc2a0c08" alt=""><figcaption></figcaption></figure>

Nothing serious found in this website.

Next I checked the `https://support.futurevera.thm/`

<figure><img src="https://3987209575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCrNVqJHUzhf98WDK3DMl%2Fuploads%2FfP7to7VVjKT2hRtc6kbz%2FUntitled%2013.png?alt=media&#x26;token=cb7a1f6f-42d4-434d-b86c-80a10dc34f22" alt=""><figcaption></figcaption></figure>

It has also nothing.

## Getting the Flag

So next I started to look for the certificates in all of the above subdomains.

You can view the certificate of a website as shown in the video below:

{% file src="<https://3987209575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCrNVqJHUzhf98WDK3DMl%2Fuploads%2Fm7w2foYM1wePIoXNgpTZ%2FViewing_certificate_in_Browser.webm?alt=media&token=8d0d8343-1265-49f9-b1b9-acb9a1cf882a>" %}

First I checked the certificate of `blog.futurevera.thm`. Didn’t found anything interesting.

Next I checked the certificate of `support.futurevera.thm`.

<figure><img src="https://3987209575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCrNVqJHUzhf98WDK3DMl%2Fuploads%2FUEvTbIcCvamBCE7WtuDp%2FUntitled%2014.png?alt=media&#x26;token=1472ef6f-e50d-46bc-98cb-b651b3cb5246" alt=""><figcaption></figcaption></figure>

We can see that the value of `DNS Name` property is referring to `secrethelpdesk934752.support.futurevera.thm`.

Now append this domain to the `/etc/hosts` file.

<figure><img src="https://3987209575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCrNVqJHUzhf98WDK3DMl%2Fuploads%2FgiRdJqokmxSOzUjrvnDD%2FUntitled%2015.png?alt=media&#x26;token=57c9f9d5-c4fe-49a3-b0fa-b2b90ca4ae44" alt=""><figcaption></figcaption></figure>

If we navigate to `secrethelpdesk934752.support.futurevera.thm`, we can see a server not found error.

<figure><img src="https://3987209575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCrNVqJHUzhf98WDK3DMl%2Fuploads%2F04CtKC90HmFElvL6s1O5%2FUntitled%2016.png?alt=media&#x26;token=d3cc1b12-37cc-4b6c-9d98-350a9581c503" alt=""><figcaption></figcaption></figure>

But if you take a look at the error, you can see the server url, which contains the flag.

We have successfully found the flag.

Thank You …..
