KB-VULN: 2 - Walkthrough [Vulnhub]

Here's my solution for KB-VULN:2.
The machine can be downloaded from here.

Nmap
Scanning for all TCP ports.
$ nmap -sC -sV -p- 192.168.1.108


 

We find 5 ports open.

Enumeration
From nmap's output we see ports 139 and 445 (SMB) are open, we enumerate smb shares.
$ smbmap -H 192.168.1.108



We have access to share named as- Anonymous, so lets get the smb shell.
$ smbclient //192.168.1.108/Anonymous
and download the file- backup.zip.

After unzipping, we get a file named as- remember_me.txt and a folder named as- wordpress.

On viewing the contents of file- remember_me.txt, seems to be a credential.
$ cat remember_.txt
We keep this information, which can be used in further stage.


Browsing the web, and checking the source did not reveal any hint.


Using dirb to scan the directories.
$ dirb http://192.168.1.108 -r


Browsing /wordpress.


 
Checking the page source.

We map the ip to host name- kb.vuln, by editing the /etc/hosts file.


Browsing /wordpress/wp-login.php, here we enter the credential we found in file- remember_me.txt
Username: admin
Password: MachineBoy141

Since we are successfully logged in, we can upload/write and run the payload in order to get reverse shell. 

To do so, we can navigate to Appearance>Theme Editor, select the theme as- Twenty Nineteen and select the theme file as- 404.php to place php reverse shell payload.

Getting Access
To execute the payload we browse- /wordpress/wp-content/themes/twentynineteen/404.php
and on the other hand we start the netcat listener.


Privilege Escalation
From www-data>kbadmin.
We find a file- read_ME.txt, located under /var/www/html, which gives hint as the user- kbadmin. 

We can verify it by looking the /etc/passwd file.

 

Switching to user- kbadmin.
The password is same which we have found in file- remember_me.txt
$ su kbadmin
Password: MachineBoy141

User Flag.



We check the file- note.txt, which gives a hint to use docker for next privilege escalation.


We can also see that the user is a member of docker group.



From kbadmin>root



Root Flag.

 

Comments

Popular posts from this blog

Sunset:Noontide - Walkthrough [Vulnhub]

CyberSploit:2 - Walkthrough [Vulnhub]