<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>mitm &#8211; PT ESC</title>
	<atom:link href="https://ptesc.tech/en/tag/mitm/feed/" rel="self" type="application/rss+xml" />
	<link>https://ptesc.tech/en/</link>
	<description></description>
	<lastBuildDate>Mon, 05 Oct 2026 12:11:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.4</generator>

<image>
	<url>https://ptesc.tech/wp-content/uploads/2026/09/cropped-cropped-large_icon-32x32.png</url>
	<title>mitm &#8211; PT ESC</title>
	<link>https://ptesc.tech/en/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>🦈 Looking under the hood of secure connections in Wireshark. Part 3.1: MITM attack on SSL/TLS connections</title>
		<link>https://ptesc.tech/en/looking-under-the-hood-of-secure-connections-in-wireshark-part-3-1-mitm-attack-on-ssl-tls/</link>
		
		<dc:creator><![CDATA[oUth0R]]></dc:creator>
		<pubDate>Wed, 22 Oct 2025 12:13:01 +0000</pubDate>
				<category><![CDATA[Incident Response]]></category>
		<category><![CDATA[dfir]]></category>
		<category><![CDATA[mitm]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tls]]></category>
		<guid isPermaLink="false">http://localhost:8080/%d1%81%d0%bc%d0%be%d1%82%d1%80%d0%b8%d0%bc-%d0%bf%d0%be%d0%b4-%d0%ba%d0%b0%d0%bf%d0%be%d1%82-%d0%b7%d0%b0%d1%89%d0%b8%d1%89%d0%b5%d0%bd%d0%bd%d1%8b%d1%85-%d1%81%d0%be%d0%b5%d0%b4%d0%b8%d0%bd%d0%b5-3/</guid>

					<description><![CDATA[&#160; In addition to the previous post we are looking at additional tools for decrypting network traffic. Let's look at an alternative to PolarProxy that is not proprietary. SSLproxy is a tool that is essentially a continuation of sslsplit…]]></description>
										<content:encoded><![CDATA[<p>&nbsp;</p>
<p><em>In addition </em><a href="https://t.me/ptescalator/522" target="_blank" rel="noopener">to the previous post</a><em> we are looking at additional tools for decrypting network traffic.</em></p>
<p>Let&#8217;s look at an alternative to <em>PolarProxy</em> that is not proprietary. <a href="https://github.com/sonertari/SSLproxy" target="_blank" rel="noopener">SSLproxy</a> is a tool that is essentially a continuation of <em>sslsplit</em>, but has a number of other advantages, in particular — writing decrypted data to a PCAP file. This project is used in <a href="https://sonertari.github.io/" target="_blank" rel="noopener">UTMFW.</a> First, let&#8217;s configure the host as in the case of <em>sslsplit</em>, except here traffic will be redirected to a single port 8443.</p>

<pre class="wp-block-code"><span><code lang="plaintext" class="hljs language-plaintext language-plaintext">sslproxy -k ca.key -c ca.crt -P https 0.0.0.0 8443 -X sslproxy.pcap</code></span></pre>

<p>Let&#8217;s form a request specifying the pre-generated certificate in the <code>--cacert</code> option.</p>

<pre class="wp-block-code"><span><code lang="bash" class="hljs language-bash language-bash">curl --cacert ca.crt --tlsv1.3 https://ptsecurity.com/</code></span></pre>

<p>Unlike the previously described tools, here a PCAP file with decrypted data is generated, so it can be parsed using Zeek, Suricata and other DPI. But the tool has a drawback similar to <em>sslsplit</em> — the file with master keys is generated incorrectly for TLSv1.3.</p>
<p>To sum up on the <em>PolarProxy</em> and <em>SSLProxy</em> tools: they are excellent analogues of <em>sslsplit</em>, which can also be used in one or another automated service, for example in an application analysis system or NGFW.</p>
<p>All the tools mentioned above have one key drawback — they do not have the ability to generate, or fully generate, a file with master keys of SSL/TLS sessions. Let&#8217;s look at a tool that solves specifically this problem.</p>
<p>❕ <strong>mitmproxy</strong> — an interactive open-source tool. It has the ability to use a web UI (<em>mitmweb</em>). Unlike the previous analogues, this tool does not have the ability to write decrypted data to a PCAP file, but it is capable of working with master keys most effectively. This tool is contained in many repositories, including PyPI.</p>
<p><strong>To capture network traffic in real time using mitmproxy, you can use the following command:<br />
</strong></p>

<pre class="wp-block-code"><span><code lang="bash" class="hljs language-bash language-bash">SSLKEYLOGFILE=<span class="hljs-string">"<span class="hljs-variable">$PWD</span>/.mitmproxy/sslkeylogfile.txt"</span> mitmproxy --<span class="hljs-built_in">set</span> confdir=.mitmproxy/ --listen-host 0.0.0.0 -p 8080</code></span></pre>

<p>In the working directory where <em>mitmproxy</em> was launched, a directory with configuration files <em>.mitmproxy</em> will be created, which will contain <a href="https://docs.mitmproxy.org/stable/concepts/certificates/" rel="noopener" target="_blank">these certificates.</a> Subsequently, they can be used when implementing a MITM attack on SSL/TLS.</p>
<p><strong>Let&#8217;s try to make an HTTP/2 request through the running proxy, while specifying the CA (certificate authority).<br />
</strong></p>

<pre class="wp-block-code"><span><code lang="bash" class="hljs language-bash language-bash">curl --proxy 127.0.0.1:8080 --cacert ~/.mitmproxy/mitmproxy-ca-cert.pem https://www.ptsecurity.com/</code></span></pre>

<p>Since the data arrives in decrypted form, we can interactively observe the request headers (<em>screenshot 4</em>) and response headers (<em>screenshot 5</em>). The obtained keys <em>sslkeylogfile.txt</em>, which we specified in the environment variable <em>SSLKEYLOGFILE</em>, we can use later for our purposes, including in Wireshark. At the same time, the keys of TLSv1.3 sessions will have the correct format, unlike the previous tools. <em>mitmproxy</em> also has transparent proxy functionality, if the <code>--mode transparent</code> option is added.</p>
<p>Thus, among the advantages of <em>mitmproxy</em> we can note the speed of deployment, interactivity (including web UI), relevance (the tool is regularly updated and improved), as well as the ability to generate working master keys for TLSv1.3.</p>
<p>💬 To sum up, I would like to note that there are many tools for carrying out MITM attacks on SSL/TLS connections. Each of these tools has its own pros and cons and is suitable for different tasks.</p>
<figure class="wp-block-image"><img decoding="async" width="1024" height="561" src="https://ptesc.tech/wp-content/uploads/2025/10/photo_407@22-10-2025_12-13-01-1024x561.jpg" class="attachment-large size-large" alt="" loading="lazy" /></figure>
<p><span class="hashtag">#dfir</span> <span class="hashtag">#tip</span> <span class="hashtag">#mitm</span> <span class="hashtag">#ssl</span> <span class="hashtag">#tls</span><br />
<a href="https://t.me/ptescalator" rel="noopener" target="_blank">@ptescalator</a></p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>🦈 Looking under the hood of secure connections in Wireshark. Part 3: MITM attack on SSL/TLS connections</title>
		<link>https://ptesc.tech/en/looking-under-the-hood-of-secure-connections-in-wireshark-part-3-mitm-attack-on-ssl-tls/</link>
		
		<dc:creator><![CDATA[oUth0R]]></dc:creator>
		<pubDate>Wed, 22 Oct 2025 12:12:00 +0000</pubDate>
				<category><![CDATA[Incident Response]]></category>
		<category><![CDATA[dfir]]></category>
		<category><![CDATA[mitm]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tls]]></category>
		<guid isPermaLink="false">http://localhost:8080/%d1%81%d0%bc%d0%be%d1%82%d1%80%d0%b8%d0%bc-%d0%bf%d0%be%d0%b4-%d0%ba%d0%b0%d0%bf%d0%be%d1%82-%d0%b7%d0%b0%d1%89%d0%b8%d1%89%d0%b5%d0%bd%d0%bd%d1%8b%d1%85-%d1%81%d0%be%d0%b5%d0%b4%d0%b8%d0%bd%d0%b5-2/</guid>

					<description><![CDATA[&#160; MITM attack is a fairly popular feature of various sandboxes and application analysis systems. Typically, tools that enable MITM attacks are a proxy server that allows flexible processing of incoming traffic and interception of SSL/T…]]></description>
										<content:encoded><![CDATA[<p>&nbsp;</p>
<p>MITM attack is a fairly popular feature of various sandboxes and application analysis systems. Typically, tools that enable MITM attacks are a proxy server that allows flexible processing of incoming traffic and interception of SSL/TLS sessions, extraction of master keys, and much more. In this case, we need to specify this proxy server in the application or service that is planned to be MITM-attacked. Depending on the flexibility of the tool, it may also have a built-in transparent proxy mode, which, unlike a classic proxy, usually requires traffic to be redirected by network rules (e.g., using iptables) to a specific machine.</p>
<p>👀 <strong>Let&#8217;s look at </strong><a href="https://github.com/droe/sslsplit" target="_blank" rel="noopener">sslsplit</a> — an open-source tool that allows decrypting SSL/TLS connections transparently. <br />Let&#8217;s configure a Debian-based gateway using the <a href="https://github.com/infokek/network-configuration-scripts/blob/main/make_gateway.sh" target="_blank" rel="noopener">make_gateway.sh</a><a href="https://vk.com/s/v1/doc/GIsHZtSTl8HAoAx9a6-S3vC-ulL7a9RT_OyNjSrjhIJtTWU1dT0" target="_blank" rel="noopener">.</a> script as an example.</p>
<p><strong>First, let&#8217;s generate certificates for the subsequent operation of the transparent proxy.<br /></strong></p>

<pre class="wp-block-code"><span><code lang="plaintext" class="hljs language-plaintext language-plaintext">openssl genrsa -out ca.key 2048
openssl req -new -x509 -days 365 -key ca.key -out ca.crt</code></span></pre>

<p><strong>Let&#8217;s launch sslsplit with the specified parameters.</strong></p>

<pre class="wp-block-code"><span><code lang="plaintext" class="hljs language-plaintext language-plaintext">sslsplit -M keys.log -D -l connections.log -j sslsplit/ -S logdir/ -k ca.key -c ca.crt ssl 0.0.0.0 8443 tcp 0.0.0.0 8080</code></span></pre>

<p>From another machine, let&#8217;s make a request without specifying any proxy parameters, since here the proxy is transparent for us and traffic is redirected to the gateway from the client machine, and then SSL/TLS from port 443 is redirected to the running transparent proxy on port 8443, while there are no traffic redirection rules on the client.</p>

<pre class="wp-block-code"><span><code lang="bash" class="hljs language-bash language-bash">curl --cacert ca.crt --tlsv1.3 https://www.ptsecurity.com/</code></span></pre>

<p>The tool&#8217;s log outputs information that the request passed through the proxy, even though we did not specify it directly (<em>screenshot 1</em>). In the <em>logdir</em> directory that we specified in the tool, a file appears containing the decrypted stream (<em>screenshot 2</em>). At the same time, the <em>keys.log</em> file records SSL/TLS master keys, and subsequently these keys can be used, for example, in Wireshark, if we first capture all the traffic that needs to be decrypted. We talked about this <a href="https://t.me/ptescalator/508" rel="noopener" target="_blank">in the first part of the posts about Wireshark.</a> It is worth noting a shortcoming of this tool — SSLKEYLOGFILE for TLSv1.3 sessions is generated incorrectly, and as a result, when opening a PCAP file in Wireshark, there will be no access to the decrypted data.</p>
<p>But what if we want to generate a PCAP file with decrypted data?</p>
<p>🐻<a href="https://www.netresec.com/?page=PolarProxy" rel="noopener" target="_blank"> </a><a href="https://www.netresec.com/?page=PolarProxy" rel="noopener" target="_blank">PolarProxy</a> — unlike the tool mentioned above, PolarProxy allows generating a PCAP file with decrypted data, but its main drawback is that it is proprietary.</p>
<p><strong>Let&#8217;s launch SOCKS in PolarProxy and specify recording directly to a PCAP file.</strong><br />
At the same time, PolarProxy has a built-in certificate web host; let&#8217;s launch it on port 10080.</p>

<pre class="wp-block-code"><span><code lang="bash" class="hljs language-bash language-bash">sudo ./PolarProxy -v --certhttp 10080 --socks 1080 -w polarproxy.pcap</code></span></pre>

<p><strong>Let&#8217;s download the certificate</strong></p>

<pre class="wp-block-code"><span><code lang="bash" class="hljs language-bash language-bash">wget http://127.0.0.1:10080/polarproxy.crt</code></span></pre>

<p><strong>Let&#8217;s form a request through the launched proxy.<br />
</strong>First, specify the certificate in the <code>--cacert</code> option.</p>

<pre class="wp-block-code"><span><code lang="bash" class="hljs language-bash language-bash">curl --cacert polarproxy.crt --proxy socks5://127.0.0.1:1080 https://ptsecurity.com/</code></span></pre>

<p>After <em>PolarProxy</em> finishes running, we get the recorded PCAP file <em>polarproxy.pcap</em>. In it, we can view this decrypted request through Wireshark (<em>screenshot 3</em>). Unlike the previously described tools, here a decrypted PCAP file is generated in its pure form, so this file can be parsed using Zeek, Suricata, and other DPI tools. </p>
<p>The tool has the ability to use the transparent proxy option, for example:</p>

<pre class="wp-block-code"><span><code lang="bash" class="hljs language-bash language-bash">sudo ./PolarProxy -v -p 0.0.0.0,10443,80,443 -w polarproxy.pcap</code></span></pre>

<p>Then PolarProxy will be launched transparently on port 10443 and will process traffic from the client machine from ports 80, 443 on all interfaces.</p>
<p>Continued in the post below 👇</p>
<figure class="wp-block-image"><img decoding="async" width="1024" height="577" src="https://ptesc.tech/wp-content/uploads/2025/10/photo_404@22-10-2025_12-12-00-1024x577.jpg" class="attachment-large size-large" alt="" loading="lazy" /></figure>
<figure class="wp-block-image"><img decoding="async" width="1024" height="646" src="https://ptesc.tech/wp-content/uploads/2025/10/photo_405@22-10-2025_12-12-00-1024x646.jpg" class="attachment-large size-large" alt="" loading="lazy" /></figure>
<p><span class="hashtag">#dfir</span> <span class="hashtag">#tip</span> <span class="hashtag">#mitm</span> <span class="hashtag">#ssl</span> <span class="hashtag">#tls</span><br />
<a href="https://t.me/ptescalator" rel="noopener" target="_blank">@ptescalator</a></p>]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
