<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Tunneling on LEIKAH</title><link>https://leikah.haoyingcao.xyz/en/tags/tunneling/</link><description>Recent content in Tunneling on LEIKAH</description><generator>Hugo</generator><language>en</language><atom:link href="https://leikah.haoyingcao.xyz/en/tags/tunneling/index.xml" rel="self" type="application/rss+xml"/><item><title>Port Forwarding &amp; Tunneling</title><link>https://leikah.haoyingcao.xyz/en/docs/tunneling/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://leikah.haoyingcao.xyz/en/docs/tunneling/</guid><description>&lt;p&gt;Many enterprise networks are separated into the &lt;strong&gt;Demilitarized Zone (DMZ)&lt;/strong&gt; and one or more internal networks. The DMZ is often used to host public-facing services, such as the organization&amp;rsquo;s website, VPN servers, and etc., while internal networks are what office workstations and internal servers are connected to. This separation helps minimize the impact of the compromise of one or more public-facing service from spreading into the internal network.&lt;/p&gt;
&lt;p&gt;However, there are also machines that serve as &lt;strong&gt;jump hosts&lt;/strong&gt; that can be used to manage hosts on other networks. If such host is compromised in the DMZ, it can facilitate the attack to pivot into the internal networks. Techniques such as SSH/Socat Port Forwarding, SOCKS Tunneling and others may be used to achieve this end.&lt;/p&gt;</description></item><item><title>Port Forwarding with SSH</title><link>https://leikah.haoyingcao.xyz/en/docs/tunneling/ssh_port_forward/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://leikah.haoyingcao.xyz/en/docs/tunneling/ssh_port_forward/</guid><description>&lt;h2 id="what-is-port-forwarding"&gt;What is port forwarding?&lt;a class="td-heading-self-link" href="#what-is-port-forwarding" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Port forwarding is a technique that allows communication requests to be redirected from one port to another. This can be for ports on the same machine, or different machines on the same network.&lt;/p&gt;
&lt;p&gt;SSH, in addition to providing secure remote shell for management, also provides secure port forwarding tunnel connections. It can be used to create three types of port forwarding:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Local&lt;/strong&gt;: Forward one specified port the pivot host has access to one local port of the local host, as if a remote service is running directly on the local host.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Dynamic&lt;/strong&gt;: Create SOCKS proxy on local host, and route all traffic to a specific network through the pivot host.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Reverse&lt;/strong&gt;: Forward one specified port on the local machine to the pivot host, allowing machines on an internal network access a service on the local machine through the pivot host.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="local-port-forwarding"&gt;Local Port Forwarding&lt;a class="td-heading-self-link" href="#local-port-forwarding" aria-label="Heading self-link"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Suppose we have access to a web server via SSH that is also running a MySQL database server on &lt;code&gt;localhost:3306&lt;/code&gt;. We can leverage our SSH access to have it create a listener on our local machine (port 1234/TCP), which forwards traffic to the SSH server, which then forwards the traffic to &lt;code&gt;localhost:3306&lt;/code&gt; of the web server. We can then communicate to thislistener as if we are communicating to the MySQL server directly.&lt;/p&gt;</description></item></channel></rss>