> 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/fr/writeups-ctf/hackthebox/linux-easy/greenhorn-hackthebox-writeup.md).

# Compte rendu HackTheBox de Greenhorn

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

{% hint style="warning" %}
**Compétences :**

* Découverte de mots de passe intégrés dans des dépôts Git
* Mots de passe SHA-512 non hachés
* Exploitation de Pluck
* Déchiffrement de mots de passe pixellisés (avec DEPIX)
  {% endhint %}

## Reconnaissance <a href="#reconnaissance" id="reconnaissance"></a>

**Configuration de l'espace de travail :**

Configurez l'espace de travail en créant trois dossiers pour stocker le contenu important, les exploits et les résultats de reconnaissance Nmap.

<figure><img src="/files/34552015427202fd0ccd8a57ca58a51b6813f207" alt="" width="563"><figcaption></figcaption></figure>

**Vérification de la connectivité VPN**

Vérifiez la connectivité VPN pour assurer une communication stable avec la machine cible.

<figure><img src="/files/828bd40bf862691ab6cb6483846669728c8fcb9e" alt="" width="563"><figcaption></figcaption></figure>

**Découverte des ports ouverts avec Nmap :**

Énumérez les ports ouverts et exportez les résultats dans le fichier "allPorts" du répertoire Nmap :

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

<figure><img src="/files/23f2348af6d44868b97ce4c2146e5088cb12e4d1" alt=""><figcaption></figcaption></figure>

**Analyse des ports ouverts avec extractPorts :**

Utilisez la fonction extractPorts pour afficher les ports ouverts dans un format concis et les copier dans le presse-papiers (22,80,3000)

<figure><img src="/files/8db964d62fb8b274cb8df4bec2b5b83b92b01196" alt="" width="563"><figcaption></figcaption></figure>

**Scan de version des ports avec Nmap :**

Utilisez Nmap pour analyser les versions des services et enregistrer la sortie dans le fichier "targeted" :

```bash
nmap -sCV -p80,22,3000 10.10.11.25 -oN targeted
```

<figure><img src="/files/1e12c0aa935b551ae8c01b2bad50ce059037a11e" alt=""><figcaption></figcaption></figure>

Pour résoudre les noms de domaine en adresses IP via DNS, insérez le nom de domaine associé à son adresse IP dans le `/etc/hosts` .

<figure><img src="/files/831a39ffc6ba3ef3f3e449797576df2fedcf5a0f" alt="" width="563"><figcaption></figcaption></figure>

### **Découverte du mot de passe :**

Sur le port 3000, nous trouvons un service exposé de type Git, similaire à GitHub, mais destiné à un usage interne en entreprise

<figure><img src="/files/81a52a45285e286b3aae4e969eba431f712f8f58" alt=""><figcaption></figcaption></figure>

Nous procédons à la création d'un compte

<figure><img src="/files/539868c4003d8408e9a39e34f411cad173c93779" alt=""><figcaption></figcaption></figure>

Parmi les fichiers du projet, nous trouvons un fichier contenant un mot de passe dans "`pass.php`":

<figure><img src="/files/69f5dee3c41e1d0f0674167d0c1f2aa5103d3c71" alt=""><figcaption></figcaption></figure>

```
d5443aef1b64544f3685bf112f6c405218c573c7279a831b1fe9612e3a4d770486743c5580556c0d838b51749de15530f87fb793afdcc689b6b39024d7790163
```

<figure><img src="/files/96bf8d3fe1a6c2d3d943eebcd061ebb879085d49" alt=""><figcaption></figcaption></figure>

Ce hachage est en SHA512. Après déchiffrement, nous obtenons le mot de passe **`iloveyou1`**.

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

<figure><img src="/files/40f363162c5e24ab262f4168fc13c4fa0732b769" alt=""><figcaption></figcaption></figure>

## Vulnérabilité de Pluck CMS

Sur le port 80, nous trouvons un service web Pluck.

<figure><img src="/files/f1a8573ede25d03a459d414b9bae076d8f792b72" alt=""><figcaption></figcaption></figure>

Le `login.php` Le fichier nécessite un mot de passe pour accéder à l'interface d'administration.

<figure><img src="/files/dc8c68bffc750baa6eed3c0b7303794c608ca77a" alt=""><figcaption></figcaption></figure>

Le gestionnaire de contenu a une version `4.7.18`, vulnérable à l'exécution de code à distance (RCE).

<figure><img src="/files/13f4e678a00e8956eb9a2c80b4c5adf065c8abb9" alt=""><figcaption></figcaption></figure>

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

### Phase d'exploitation:

1. Clonez le dépôt contenant le script d'exploitation :

```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. Nous modifions le `poc.py` script avec l'adresse IP du serveur et le mot de passe "*iloveyou1*".

<figure><img src="/files/adb85a779ea92bc819257a2a3dc0254c905bcf2e" alt=""><figcaption></figcaption></figure>

2. Ensuite, créez un `payload.zip` fichier contenant la charge utile malveillante, avec les `<your_ip>` et les champs du port ajustés pour correspondre à notre écouteur.

<figure><img src="/files/46489a13e4a6061a1e3ca560a9e88801e83d5447" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="/files/298bbe113032756a3262ad443dae8dac6858420d" alt="" width="512"><figcaption></figcaption></figure>

5. Nous exécutons le script d'exploitation :

```bash
python poc.py

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

<figure><img src="/files/56316c52de753f32dbe6f1c4d172870231bac57b" alt=""><figcaption></figcaption></figure>

En même temps, nous ouvrons une session d'écoute sur le port `4444` avec Netcat et obtenons l'accès au serveur en tant qu'utilisateur `www-data`.

<figure><img src="/files/1c3f4a6bb3f7a504779fe1cf4a7b46152372e802" alt=""><figcaption></figcaption></figure>

En inspectant le `/etc/passwd` fichier, nous découvrons l'utilisateur "junior". Nous parvenons à nous connecter avec le mot de passe **iloveyou1**:

<figure><img src="/files/c33ece82942b427bd7bdb989dbf51bd5a6540ae4" alt=""><figcaption></figcaption></figure>

### Drapeau user.txt obtenu :

<figure><img src="/files/986637740cfce706db9482b5047ea4dee3a4ec1e" alt="" width="563"><figcaption></figcaption></figure>

## Élévation de privilèges

1. Nous localisons le fichier PDF : `En utilisant OpenVAS.pdf`.
2. Transférez le fichier à l'aide de Python 3 en exécutant :

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

<figure><img src="/files/5ad86f4e8ef09c24369ed8b8c0ffdf307b037cc6" alt="" width="563"><figcaption></figcaption></figure>

3. Nous téléchargeons le fichier PDF avec la commande suivante :

<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="/files/b05054cb0825c33018f3439494a0df4b66cdc2b7" alt=""><figcaption></figcaption></figure>

En ouvrant ce fichier, nous découvrons le mot de passe pixelisé du compte administrateur

<figure><img src="/files/4c4b819066f6a873e1ae9d57a7dea51d605a68c4" alt=""><figcaption></figcaption></figure>

### Déchiffrement du mot de passe :

Pour craquer le mot de passe caché, nous utilisons le logiciel Depix :

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

<figure><img src="/files/9bd9c87e96e348253f7df58ac7c02ad48c0e5f6b" alt=""><figcaption></figcaption></figure>

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

Ensuite, nous exécutons la commande suivante :

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

<figure><img src="/files/82b86875996d48635edd3f5fe04aaf8bf1edecc1" alt=""><figcaption></figcaption></figure>

Le mot de passe déchiffré est :

<figure><img src="/files/35a22e829001f58224cd38021e9b8f5f81c5f133" alt=""><figcaption></figcaption></figure>

`sidefromsidetheothersidesidefromsidetheotherside`

Nous nous connectons en tant qu'utilisateur root avec ce mot de passe.

<figure><img src="/files/0e0e31cb36dca4f107301aa916217d6ea5bea371" alt="" width="554"><figcaption></figcaption></figure>

### Flag root :)

<figure><img src="/files/50d271bf1bb90c393b99e9834cd3f6595848bc17" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/1fa6641315be0a0734951bf6a50af34aa5806e37" 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://hacking-notes.jord4n.pro/fr/writeups-ctf/hackthebox/linux-easy/greenhorn-hackthebox-writeup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
