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

# Greenhorn HackTheBox Writeup

Writeup zur HackTheBox-Easy-Linux-Maschine Greenhorn mit Abdeckung von versteckten Passwörtern in Git-Repositories, ungehashten SHA-512-Passwörtern, Pluck-Ausnutzung, Entschlüsselung verpixelter Passwörter (mit DEPIX

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

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

* Eingebettete Passwörter in Git-Repositories entdecken
* SHA-512-Passwörter ohne Hash
* Pluck-Ausnutzung
* Verpixelte Passwörter entschlüsseln (mit DEPIX)
  {% endhint %}

## Aufklärung <a href="#reconnaissance" id="reconnaissance"></a>

**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-ad09c46bef316df08a6baefff7357a9a91f4c4f4%2Fimage%20(1433).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-f011d4a60b1d3b6f4f10236e0cc265058df159f1%2Fimage%20(1434).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 --min-rate 5000 -vvv -n -Pn 10.10.11.25 -oG allPorts
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2524ad68a1cdb5d08561994f37e55d367a038963%2Fimage%20(1435).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 sie in die Zwischenablage zu kopieren (22,80,3000)

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

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

Um Domänennamen per DNS in IP-Adressen aufzulösen, fügen Sie den Domänennamen, der mit seiner IP-Adresse verknüpft ist, in das `/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-fcb96ca516a74df19f9fe69edf49a5e3a80b196d%2Fimage%20(1438).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

### **Passwortsuche:**

Auf Port 3000 finden wir einen Git-ähnlichen freigelegten Dienst, ähnlich wie GitHub, aber für den internen Unternehmenseinsatz gedacht

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

Wir legen ein Konto an

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

Unter den Projektdateien finden wir eine Datei mit einem Passwort in "`pass.php`":

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

```
d5443aef1b64544f3685bf112f6c405218c573c7279a831b1fe9612e3a4d770486743c5580556c0d838b51749de15530f87fb793afdcc689b6b39024d7790163
```

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

Dieser Hash liegt in SHA512 vor. Nach der Entschlüsselung erhalten wir das Passwort **`iloveyou1`**.

{% embed url="<https://10015.io/tools/sha512-encrypt-decrypt>" %}

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

## Pluck-CMS-Schwachstelle

Auf Port 80 finden wir einen Pluck-Webdienst.

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

Das `login.php` Die Datei erfordert ein Passwort, um auf die Manager-Oberfläche zuzugreifen.

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

Der Content-Manager hat eine Version `4.7.18`, anfällig für Remote Code Execution (RCE).

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

{% embed url="<https://github.com/Rai2en/CVE-2023-50564_Pluck-v4.7.18_PoC>" %}

### Ausnutzungsphase:

1. Klonen Sie das Repository, das das Exploit-Skript enthält:

```bash
git clone https://github.com/Rai2en/CVE-2023-50564_Pluck-v4.7.18_PoC.git
cd CVE-2023-50564_Pluck-v4.7.18_PoC
```

2. Wir ändern das `poc.py` Skript mit der IP-Adresse des Servers und dem Passwort "*iloveyou1*".

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

2. Als Nächstes erstellen Sie eine `payload.zip` Datei mit der schädlichen Nutzlast, mit den `<your_ip>` und den Portfeldern, die an unseren Listener angepasst sind.

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

5. Wir führen das Exploit-Skript aus:

```bash
python poc.py

/home/jordan/......./payload.zip
```

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

Gleichzeitig öffnen wir eine lauschende Sitzung auf Port `4444` mit Netcat und erhalten Zugriff auf den Server als Benutzer `www-data`.

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

Durch das Überprüfen der `/etc/passwd` Datei entdecken wir den Benutzer "junior". Wir schaffen es, uns mit dem Passwort zu verbinden **iloveyou1**:

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

### user.txt-Flag erhalten:

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

## Privilegieneskalation

1. Wir lokalisieren die PDF-Datei: `Mit OpenVAS.pdf`.
2. Übertragen Sie die Datei mit Python 3, indem Sie Folgendes ausführen:

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

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

3. Wir laden die PDF-Datei mit dem folgenden Befehl herunter:

<pre class="language-bash"><code class="lang-bash"><strong>wget http://10.10.11.25:1234/Using%20OpenVAS.pdf
</strong></code></pre>

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

Beim Öffnen dieser Datei entdecken wir das verpixelte Passwort für das Administratorkonto

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

### Entschlüsselung des Passworts:

Um das verborgene Passwort zu knacken, verwenden wir die Depix-Software:

{% embed url="<https://github.com/spipm/Depix>" %}

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

```bash
git clone https://github.com/spipm/Depix
cd Depix
```

Als Nächstes führen wir den Befehl aus:

```bash
python3 depix.py /
    -p pixel.png /
    -s images/searchimages/debruinseq_notepad_Windows10_closeAndSpaced.png /
    -o /home/jordan/Desktop/password.png
```

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

Das entschlüsselte Passwort lautet:

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

`sidefromsidetheothersidesidefromsidetheotherside`

Wir melden uns mit diesem Passwort als Root-Benutzer an.

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

### Flag root :)

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3851a82e92446fb53e44e2ccb4036f9d60d0faa4%2Fimage%20(2263).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-2d5fe1ed09ec259167b595fb44f9b90edf2b142b%2Fimage%20(1418).png?alt=media" alt="" width="563"><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/greenhorn-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.
