<?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>சுதர்சன் சாந்தியப்பன் &#187; msnp</title>
	<atom:link href="http://sudarsun.in/blog/tag/msnp/feed/" rel="self" type="application/rss+xml" />
	<link>http://sudarsun.in/blog</link>
	<description>Dream of the Impossible™</description>
	<lastBuildDate>Sun, 20 May 2012 17:23:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Restrict MSN file transfer</title>
		<link>http://sudarsun.in/blog/2009/11/restrict-msn-file-transfer/</link>
		<comments>http://sudarsun.in/blog/2009/11/restrict-msn-file-transfer/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 17:37:54 +0000</pubDate>
		<dc:creator>sudarsun</dc:creator>
				<category><![CDATA[Hacks]]></category>
		<category><![CDATA[KnowHow]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[1863]]></category>
		<category><![CDATA[file-transfer]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[msn]]></category>
		<category><![CDATA[msnp]]></category>

		<guid isPermaLink="false">http://sudarsun.in/blog/2009/11/restrict-msn-file-transfer/</guid>
		<description><![CDATA[MSN uses port 1863 to transmit messages and for file transfer. Lot of people have said that the file-transfer using MSN happens via port range 6891-6900.&#160; But when I experimented, I found that MSN is using same 1863 port.&#160; Linux machines are able to identify this port as &#8220;msnp&#8221;.&#160; I used &#8220;tcpdump&#8221; to verify this.&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>MSN uses port 1863 to transmit messages and for file transfer.</p>
<div align="justify">Lot of people have said that the file-transfer using MSN happens via port range 6891-6900.&nbsp; But when I experimented, I found that MSN is using same 1863 port.&nbsp; Linux machines are able to identify this port as &#8220;msnp&#8221;.&nbsp; I used &#8220;tcpdump&#8221; to verify this.&nbsp; Whenever MSN attempts to send a file across the Internet, I creates several smaller packets (typically in the range of 536-1350 bytes) and sends them one after the other.&nbsp; During the file transfer process, if there are messages (text or IM) to be transmitted, the message data block is piggy-backed on the file-transfer packets and sent across.</div>
<p>
<div align="justify">I was desperately looking for filtering the MSN based file-transfer for some official purposes and wrote some iptables rules based on the Internet literature that said file transfers happen via 6891-6900 by TCP.&nbsp; Then, to validate the rules, I used tcpdump again on the gateway machine to monitor the packets that are originated from my machine.&nbsp; </div>
<blockquote><div align="center"><font face="Courier New">tcpdump src host dev02 -i eth1 -vvv</font></div>
</blockquote>
<div align="justify">To my surprise, the file transfer was still happening also the ports are blocked.&nbsp; Then I made an &#8220;iptables&#8221; rule to drop all the packets other than 1863 and repeated the experiment.&nbsp; Still the file-transfer was happening.&nbsp; I could see using tcpdump that the packet transfer is happening via port 1863.</div>
<blockquote><div align="center"><font face="Courier New">tcpdump src host dev02 and dst port 1863 -i eth1 -vvv</font></div>
</blockquote>
<div align="justify">So, it became apparant that the file-transfer and the text messaging are all happening via port 1863 instead of the port range 6891-6900.&nbsp; I then decided to write an iptables rule to filter the packets using the packet size constraint.&nbsp; A rule was written to drop packets that are more then 600 bytes assuming that the IM packets shall never reach the limit.</div>
<blockquote><p><font face="Courier New">iptables -A FORWARD -i eth1 -m length -p tcp &#8211;length 600:65535 &#8211;dport 1863 -j DROP</font><br /><font face="Courier New">iptables -A FORWARD -i eth1 -p tcp &#8211;dport 1863 -j ACCEPT</font><br /><font face="Courier New">iptables -A FORWARD -i eth1 -p tcp -j DROP</font></p></blockquote>
<div align="justify">I did see that the packet size is around 1350 bytes when files are transferred and that&#8217;s why I chose 600 bytes as the limit.&nbsp; When I monitoring using the &#8220;tcpdump&#8221; command as before, I was surprise to see that the protocol adjusted the packet size automatically to 560 bytes to continue the transmission.&nbsp; It tried with 1350 bytes for 3 times and as the acknowledgments were not received, it&#8217;s flow control mechanism reduced the packet size to 560 bytes and finished the transfer.&nbsp; So, I had to redo the iptables rule:-</div>
<blockquote><p><font face="Courier New">iptables -A FORWARD -i eth1 -m length -p tcp &#8211;length <strike>600</strike> 512:65535 &#8211;dport 1863 -j DROP</font></p></blockquote>
<p>It worked like charm.</p>
<div align="justify">The happiness did not last long.&nbsp; When people logout and tried logging in, they were not able to login at all.&nbsp; When I investigated the cause of this problem, I could see that the packets that are exchanged during the login process is more than 512 bytes (typically 1350 bytes).&nbsp; So, I had to relax the rule for a brief time to let people login to MSN messenger service.&nbsp; I enabled the file-transfer restriction after everybody logged in by enabling the iptables rule.</div>
<div align="justify">
<blockquote>NOTE: iptables based filtering shall work only for packets that travel across the network.&nbsp; If the MSN file-transfer happens inside the LAN, MSN cleverly does the file-transfer using P2P where the gateway is not involved at all.</p></blockquote>
</div>
<p>Although, this is not a very good solution, it is definitely worth knowing about!<br />Happy firewalling!.</p>
<p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=7befccce-08f4-8c71-9a93-504e9f255fac" /></div>
]]></content:encoded>
			<wfw:commentRss>http://sudarsun.in/blog/2009/11/restrict-msn-file-transfer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  sudarsun.in/blog/tag/msnp/feed/ ) in 0.29064 seconds, on May 22nd, 2012 at 8:21 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on May 22nd, 2012 at 9:21 pm UTC -->
