<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.technet.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Neil Carpenter's Blog : Networking</title><link>http://blogs.technet.com/neilcar/archive/tags/Networking/default.aspx</link><description>Tags: Networking</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Detecting ARP Spoofing Attacks</title><link>http://blogs.technet.com/neilcar/archive/2007/07/05/detecting-arp-spoofing-attacks.aspx</link><pubDate>Fri, 06 Jul 2007 00:20:58 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:1449172</guid><dc:creator>neilcar</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.technet.com/neilcar/comments/1449172.aspx</comments><wfw:commentRss>http://blogs.technet.com/neilcar/commentrss.aspx?PostID=1449172</wfw:commentRss><description>&lt;p&gt;After investigating &lt;a href="http://blogs.technet.com/neilcar/archive/2007/06/28/arp-cache-poisoning-incident.aspx" target="_blank"&gt;an ARP spoofing incident&lt;/a&gt; recently, I started thinking of how we could easily ferret out this sort of information when responding to a potential incident.&lt;/p&gt; &lt;p&gt;In this particular case, there were two important parts of the attack:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;ARP spoofing forced all traffic bound for the default gateway to be funneled through the infected machine, and  &lt;li&gt;HTTP proxying allowed for the injection of malicious code in HTML documents.&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;ARP spoofing would be easy to detect and/or rule out if you happen to know the MAC address of the default gateway off the top of your head as you could just look at the local ARP cache ("arp -a" at a command prompt) to make sure you had the right one; however, I'd suspect that most people wouldn't have that information easily at hand.&amp;nbsp; &lt;/p&gt; &lt;p&gt;Another approach that might work is to:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Start a network capture.  &lt;li&gt;Clear the ARP cache of any entries for the default gateway ("arp -d 192.168.0.1").  &lt;li&gt;Initiate a connection to something on the other side of the default gateway ("ping microsoft.com").  &lt;li&gt;Stop the capture and look to see if you got more than one ARP response when you ARP'd for the default gateway.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;This approach is messy and it makes the assumption that the malware responds to ARP requests rather than just spamming the hosts on the subnet with gratuitous ARPs.&amp;nbsp; &amp;nbsp;The remaining approach would be to do what we did in this incident -- take a network trace of general network traffic and look for the excessive gratuitous ARPs coming from the infected machine.&amp;nbsp; (I'd also suspect that most IDS systems would catch this -- if you were feeling lazy, you could probably take the network trace and feed it through &lt;a href="http://snort.org" target="_blank"&gt;Snort&lt;/a&gt; in offline mode...)&lt;/p&gt; &lt;p&gt;I had an epiphany about the second part, detection injection of malicious code in HTML docs, while I was having a romantic dinner over the weekend.&amp;nbsp; Fortunately, my significant other is used to this sort of behavior and she didn't even roll her eyes when I asked if she had a pen and paper so I could write it down...&lt;/p&gt; &lt;p&gt;The epiphany was that the best way to find injected code was to compare a suspicious document with a known-good document.&amp;nbsp; Of course, the problem is finding a known-good doc to compare to but, with a bit of thought, I came up with an additional insight -- an attacker couldn't inject a payload into a doc downloaded over SSL.&amp;nbsp; So, I think the following would work nicely:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;wget &lt;a href="http://www.microsoft.com/default.aspx"&gt;http://www.microsoft.com/default.aspx&lt;/a&gt; (possibly not the _best_ test page, but it'll do for our example)  &lt;li&gt;wget &lt;a href="https://www.microsoft.com/default.aspx"&gt;https://www.microsoft.com/default.aspx&lt;/a&gt;  &lt;li&gt;Diff the two documents and look for obviously injected code.&amp;nbsp; &lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Unfortunately, the two copies of default.aspx, in this example, will have minor differences but nothing so obvious as an &amp;lt;iframe&amp;gt; pointing somewhere else.&lt;/p&gt; &lt;p&gt;I'm open to other approaches, though, and I'd love to hear from folks who have other ideas.&lt;/p&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=1449172" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/neilcar/archive/tags/Networking/default.aspx">Networking</category><category domain="http://blogs.technet.com/neilcar/archive/tags/Security/default.aspx">Security</category><category domain="http://blogs.technet.com/neilcar/archive/tags/Incident+Response/default.aspx">Incident Response</category></item><item><title>ARP Cache Poisoning Incident</title><link>http://blogs.technet.com/neilcar/archive/2007/06/28/arp-cache-poisoning-incident.aspx</link><pubDate>Thu, 28 Jun 2007 16:53:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:1385097</guid><dc:creator>neilcar</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.technet.com/neilcar/comments/1385097.aspx</comments><wfw:commentRss>http://blogs.technet.com/neilcar/commentrss.aspx?PostID=1385097</wfw:commentRss><description>&lt;P&gt;I recently worked on an interesting incident response with several of my colleagues.&amp;nbsp; The problem, as defined by the customer, is that the following code is being injected into some websites (both external and internal to his environment) that his users are surfing: 
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&amp;lt;iframe src=http://&amp;lt;redacted&amp;gt;/ 123.htm width=0 height=0&amp;gt;&amp;lt;/iframe&amp;gt;&amp;nbsp; &lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The page referenced (123.htm) includes a link to a .jpg file that exploits the animated cursor vulnerability in MS07-017 and some additional obfuscated javascript.&amp;nbsp; The effect of this is that an unpatched machine surfing to &lt;I&gt;any&lt;/I&gt; website (cnn.com, for example) would load the specially crafted .jpg file and execute code of the attacker’s choice.&amp;nbsp; 
&lt;P&gt;At first, we thought this was being injected by a browser helper object or something similar on the client machine.&amp;nbsp; There was no indication of anything malicious running on the client machine based on the data we looked at.&amp;nbsp; We took a network trace from the client machine and saw that the iframe was being returned across the network.&amp;nbsp; This would indicate that either the attack was originating in an NDIS driver of some sort (*) or that it was originating on his network. &amp;nbsp; 
&lt;P&gt;Fortunately, the customer was able to mirror the client machine’s port on his switch and run a network trace from the mirrored port.&amp;nbsp; In that trace, we _&lt;I&gt;also&lt;/I&gt;_ see the iframe being returned across the network, apparently from the web server.&amp;nbsp; This was a firm indication that the attack was originating on his network. 
&lt;P&gt;Looking back at the network trace, we saw a large number of gratuitous arp packets for the IP address of the default gateway.&amp;nbsp;&amp;nbsp;The MAC address that is being returned as corresponding to the default gateway is for a Compaq NIC(**); however, the default gateway is a Cisco device with a different MAC address.&amp;nbsp; &amp;nbsp;Based on this, we determined that this machine was mounting an ARP cache poisoning attack (***) to perform a man-in-the-middle attack and inserting the iframe into HTTP communications where the response was an html doc. 
&lt;P&gt;When we took this one machine off the network, everything returned to normal.&amp;nbsp; This was a good sign that we were headed in the right direction. 
&lt;P&gt;We gathered further data off of the compromised machine.&amp;nbsp; Based on that data, we can see that the machine has had winpcap and other software installed.&amp;nbsp; Winpcap and the other software allows the attacker to perform the ARP spoofing, routing all the traffic destined for their default gateway through this machine first, and to insert the iframe into HTTP responses that include HTML documents.&amp;nbsp; 
&lt;P&gt;This incident is very interesting to me because it marks the first time I've seen ARP spoofing used in an automated way like this.&amp;nbsp; Apparently, there are at least a few worms on the loose that do this (Worm.Delf.fs, specifically) but, so far, they have had low volume.&amp;nbsp; This type of attack definitely ratchets up the importance of installing the latest security updates -- in this case, an unpatched machine could have been compromised even by surfing to an internal website. 
&lt;HR&gt;

&lt;P&gt;(*)&amp;nbsp; My reasoning here is that Netmon plugs into the network stack fairly low.&amp;nbsp; In general terms, it looks like this: 
&lt;P&gt;IE&amp;nbsp;--&amp;gt; Winsock&amp;nbsp;--&amp;gt; TDI&amp;nbsp;--&amp;gt; TCPIP.SYS&amp;nbsp;--&amp;gt; NDIS&amp;nbsp;--&amp;gt; Hardware 
&lt;P&gt;The Netmon Agent sits between TCPIP.SYS and NDIS on NDIS’s upper edge.&amp;nbsp; For something to show up in a network capture, it would have to originate either in NDIS or on the network. 
&lt;P&gt;(**) Ethernet MAC addresses are divided into two parts.&amp;nbsp; The first three octets (00:50:8b in this case) are identifiers for particular manufacturers (Compaq in this case) and the last three octets are a unique identifier.&amp;nbsp; The list of vendor identifiers can be found here -- &lt;A href="http://standards.ieee.org/regauth/oui/index.shtml" mce_href="http://standards.ieee.org/regauth/oui/index.shtml"&gt;http://standards.ieee.org/regauth/oui/index.shtml&lt;/A&gt;. 
&lt;P&gt;(***) ARP cache poisoning references: 
&lt;P&gt;&lt;A href="http://en.wikipedia.org/wiki/ARP_spoofing" mce_href="http://en.wikipedia.org/wiki/ARP_spoofing"&gt;http://en.wikipedia.org/wiki/ARP_spoofing&lt;/A&gt; 
&lt;P&gt;&lt;A href="http://www.watchguard.com/infocenter/editorial/135324.asp" mce_href="http://www.watchguard.com/infocenter/editorial/135324.asp"&gt;http://www.watchguard.com/infocenter/editorial/135324.asp&lt;/A&gt; 
&lt;P&gt;&lt;A href="http://www.grc.com/nat/arp.htm" mce_href="http://www.grc.com/nat/arp.htm"&gt;http://www.grc.com/nat/arp.htm&lt;/A&gt; 
&lt;P&gt;As noted in the Wikipedia article, we could have used static ARP entries as mitigation if we hadn’t been able to quickly identify the machine that was staging the attack.&lt;/P&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=1385097" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/neilcar/archive/tags/Networking/default.aspx">Networking</category><category domain="http://blogs.technet.com/neilcar/archive/tags/Security/default.aspx">Security</category><category domain="http://blogs.technet.com/neilcar/archive/tags/Incident+Response/default.aspx">Incident Response</category></item><item><title>SMB Perf articles</title><link>http://blogs.technet.com/neilcar/archive/2004/10/26/247907.aspx</link><pubDate>Tue, 26 Oct 2004 18:13:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:247907</guid><dc:creator>neilcar</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.technet.com/neilcar/comments/247907.aspx</comments><wfw:commentRss>http://blogs.technet.com/neilcar/commentrss.aspx?PostID=247907</wfw:commentRss><description>I've been working a lot with file sharing performance, and I'm trying to write a few essays on those experiences.&amp;nbsp; The first, on &lt;A href="http://blogs.msdn.com/neilcar/articles/247903.aspx"&gt;SMB Performance&lt;/a&gt;, is up now.&amp;nbsp; When I have some more time, I'm going to write a bit on the impact of packet loss on SMB connections on a WAN link...&lt;br /&gt; &lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=247907" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/neilcar/archive/tags/Networking/default.aspx">Networking</category></item><item><title>Quick Figuring Optimal TCP Window Size</title><link>http://blogs.technet.com/neilcar/archive/2004/10/26/247886.aspx</link><pubDate>Tue, 26 Oct 2004 17:40:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:247886</guid><dc:creator>neilcar</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.technet.com/neilcar/comments/247886.aspx</comments><wfw:commentRss>http://blogs.technet.com/neilcar/commentrss.aspx?PostID=247886</wfw:commentRss><description>There generally isn't a single correct way to figure out the optimal TCP window for an interface since you're probably connecting to different hosts across different links at different latencies; however, you can roughly guess what the optimal window would be if you're only primarily worried about your communication with one other host (or, perhaps, one other site).&amp;nbsp; First, you'll need to know the latency and the throughput available between you &amp;amp; the remote host.&amp;nbsp; To get the latency, ping the remote host and take the average response time.&amp;nbsp; For the throughput, take the slowest link between you &amp;amp; the remote host (ie, you might both be connected to 100Mb/s Ethernet, but there is a 1.5Mb/s WAN link between).&amp;nbsp; If the slowest link is asymmetrical, use the faster of the two speeds -- for example, on an ADSL connection that was rated as 1.5Mb/s down and 384Kb/s up, use the 1.5Mb/s speed.&amp;nbsp; (If both ends are on DSL, use the lower speed as this will always be the limiting factor.)&lt;br /&gt; &lt;br /&gt; Once we've got these two numbers, the normal formula used to calculate optimal TCP window is &lt;font face="Courier New"&gt;bandwidth * latency = window&lt;/font&gt;.&amp;nbsp; Remember that throughput is measured in &lt;i&gt;bits&lt;/i&gt; per second whereas our TCP window is going to be configured in &lt;i&gt;bytes&lt;/i&gt; per second.&amp;nbsp; Divide the throughput by 8 to convert bits per second to bytes per second.&lt;br /&gt; &lt;br /&gt; So, if we were using a 1.5Mb/s ADSL link with 70ms of latency, our calculation would look something like this:&lt;br /&gt; &lt;blockquote&gt;&lt;font face="Courier New"&gt;(1.5*1024*1024/8)bytes/second&amp;nbsp; *&amp;nbsp; .07seconds = ~13763bytes&lt;br /&gt; &lt;/font&gt;&lt;/blockquote&gt; So, on this link, a 13KB TCP window would work well.&amp;nbsp; Since the default TCP window for Windows 2000/XP/2003 is 16K (or more), there would be no need to change the window on this client; however, if either the throughput or the latency was higher, we would probably benefit from a change.&lt;br /&gt; &lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=247886" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/neilcar/archive/tags/Networking/default.aspx">Networking</category></item><item><title>Finding Retransmits in Ethereal</title><link>http://blogs.technet.com/neilcar/archive/2004/06/02/146869.aspx</link><pubDate>Wed, 02 Jun 2004 20:30:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:146869</guid><dc:creator>neilcar</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.technet.com/neilcar/comments/146869.aspx</comments><wfw:commentRss>http://blogs.technet.com/neilcar/commentrss.aspx?PostID=146869</wfw:commentRss><description>&lt;P&gt;With the full version of Netmon, it's relatively easy to find retransmitted packets with the expert; however, in Ethereal, it's not quite as clear...&lt;/P&gt;
&lt;P&gt;&lt;A title=Ethereal href="http://www.ethereal.com/" target=_blank&gt;Ethereal&lt;/A&gt; supports analysis of TCP sequence numbers to find retransmits &amp;amp; do other neat things; however, the default is to turn this off (because, I would guess, it will increase load times on captures).&amp;nbsp; To turn it on, go to Preferences, then find the TCP protocol &amp;amp; put a checkbox in the &lt;A href="http://notserio.us/gallery/image/5.aspx"&gt;&amp;#8220;Analyze TCP sequence numbers&amp;#8221;&lt;/A&gt; box.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;After this is done, &lt;A title=Ethereal href="http://www.ethereal.com/" target=_blank&gt;Ethereal&lt;/A&gt; will display [SEQ/ACK analysis] under TCP for frames where meaningful analysis is possible.&amp;nbsp; To filter for retransmits, use 'tcp.analysis.retransmission' for a filter.&amp;nbsp; There are some other nice attributes here -- for example, to find packets where the delta between the data &amp;amp; the ACK is 180ms or greater (possibly indicating a delayed ACK), try a filter of 'tcp.analysis.ack_rtt&amp;gt;.18'.&amp;nbsp; To find zero-window issues, filter on 'tcp.analysis.zero_window'.&lt;/P&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=146869" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/neilcar/archive/tags/Networking/default.aspx">Networking</category></item><item><title>Network Sniffing Tools</title><link>http://blogs.technet.com/neilcar/archive/2004/06/01/145800.aspx</link><pubDate>Tue, 01 Jun 2004 23:51:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:145800</guid><dc:creator>neilcar</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.technet.com/neilcar/comments/145800.aspx</comments><wfw:commentRss>http://blogs.technet.com/neilcar/commentrss.aspx?PostID=145800</wfw:commentRss><description>Posted on &lt;A href="http://weblogs.asp.net/neilcar/articles/145799.aspx"&gt;my favorite network sniffing tools&lt;/A&gt;.&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=145800" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/neilcar/archive/tags/Networking/default.aspx">Networking</category></item><item><title>Categorizing Packet Loss</title><link>http://blogs.technet.com/neilcar/archive/2004/06/01/145616.aspx</link><pubDate>Tue, 01 Jun 2004 20:45:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:145616</guid><dc:creator>neilcar</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.technet.com/neilcar/comments/145616.aspx</comments><wfw:commentRss>http://blogs.technet.com/neilcar/commentrss.aspx?PostID=145616</wfw:commentRss><description>&lt;P&gt;I've quite frequently run into situations where I've been asked to diagnose packet loss based only on a network trace.&amp;nbsp; While it is almost impossible to find an exact answer, a network trace can provide some valuable clues about the cause of the packet loss.&lt;/P&gt;
&lt;P&gt;The first step, if possible, is to get network traces from both endpoints in the conversation (and...if it's your lucky day...from any intermediate points where a trace can be run).&amp;nbsp; Once you have these, find a retransmitted packet in one of the traces, then filter all the traces to just that packet.&amp;nbsp; (In Ethereal, try a filter of tcp.seq==&lt;SEQ# retransmit of&gt; on all of your traces.)&amp;nbsp; Compare at each point to see whether particular packets are present or absent -- based on this, you can start to build some idea of where the packet might be lost.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The next step is to examine the frequency of the packet loss.&amp;nbsp; In my experience, there are two frequencies that you will see most often -- a fairly random distribution of retransmissions through the entire conversation, or retransmissions only on certain packets (usually leading up to the end of the connection as the packet is retransmitted up to tcpmaxretransmits).&lt;/P&gt;
&lt;P&gt;In the first case, the most common cause is a network segment or device that is either over-capacity or losing packets for another reason (noisy dial-up link, for example).&amp;nbsp; Finding the correct link and/or device becomes a matter of either taking traces at each possible hop or, alternately, employing a process of elimination by using different endpoints to test each hop.&amp;nbsp; Depending on the situation, the pathping command may also show at which hop the loss begins.&lt;/P&gt;
&lt;P&gt;In the second case, you will usually see a session that runs fine until a certain packet is transmitted.&amp;nbsp; At this point, that packet is never received by the other endpoint and, after a number of retransmissions, the connection errors out.&amp;nbsp; The things to look for here are:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Size of the packet.&amp;nbsp; If all of the preceeding packets in the connection have been smaller and the first full packet is dropped, then you are probably looking at an issue with&amp;nbsp;&lt;A href="http://support.microsoft.com/default.aspx?scid=kb;en-us;314825"&gt;&lt;FONT color=#cc0000&gt;a black-hole router&lt;/FONT&gt;&lt;/A&gt;.&amp;nbsp; 
&lt;LI&gt;Data in the packet.&amp;nbsp; In a number of cases, I've seen heuristic scanners (usually anti-virus software implemented as filter drivers) that believe they recognize an objectionable pattern in a packet and, therefore, silently discard it.&amp;nbsp; Try removing anti-virus software, as well as any other 3rd party filter drivers.&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;This posting is provided "AS IS" with no warranties, and confers no rights. &lt;/P&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=145616" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/neilcar/archive/tags/Networking/default.aspx">Networking</category></item></channel></rss>