<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Ellipsis: Tag ethereal</title>
    <link>http://typo.pburkholder.com/articles/tag/ethereal?tag=ethereal</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>...</description>
    <item>
      <title>Debugging Internet Explorer SSL issues with VmWare, IEAutomation and Wireshark</title>
      <description>&lt;p&gt;This week I happened upon a client who was eager  to solve a persistent problem with Microsoft&amp;#8217;s Internet Explorer bombing when trying to &lt;span class="caps"&gt;POST&lt;/span&gt; content over &lt;span class="caps"&gt;HTTPS&lt;/span&gt; to a custom web application.  The client sent me the thread from the trouble tracking system, and it was clear that they were already aware of the &lt;a href="http://httpd.apache.org/docs/2.0/ssl/ssl_faq.html#msie"&gt;magic Apache mod_ssl incantation&lt;/a&gt; to address some of &lt;span class="caps"&gt;MSIE&lt;/span&gt;&amp;#8217;s non-compliant behavior.  Since they were already barking up that tree, I decided that they needed a better test bed to help confirm whether the problem was truly being addressed by whatever remedies they were hauling out.  To put it another way, we couldn&amp;#8217;t really apply any scientific method unless we could have a control case and an experimental case.&lt;/p&gt;


	&lt;p&gt;Since the problem was &lt;span class="caps"&gt;MSIE&lt;/span&gt; specific, I first needed a way to drive &lt;span class="caps"&gt;MSIE&lt;/span&gt; through some test cases and evaluate the results.&lt;/p&gt;


	&lt;h1&gt;Getting a flawed version of &lt;span class="caps"&gt;MSIE&lt;/span&gt;&lt;/h1&gt;


	&lt;p&gt;First, I had to get a sufficiently old version of &lt;span class="caps"&gt;MSIE&lt;/span&gt;, since late versions of &lt;span class="caps"&gt;IE6&lt;/span&gt; and &lt;span class="caps"&gt;IE7&lt;/span&gt; are all okay.  To do this all safely and reproducibly, I&amp;#8217;m running Windows under an instance of VmWare Server on a Linux host.  To get things set up, I took care of the following:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Install Windows 2000 Professional from CD (apply no security patches)&lt;/li&gt;
		&lt;li&gt;Install Windows 2000 &lt;span class="caps"&gt;SP2&lt;/span&gt; &lt;a href="http://www.microsoft.com/windows2000/downloads/servicepacks/sp2/sp2en.mspx"&gt;http://www.microsoft.com/windows2000/downloads/servicepacks/sp2/sp2en.mspx&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;Install Microsoft Internet Explorer &lt;span class="caps"&gt;SP1&lt;/span&gt; &lt;a href="http://www.microsoft.com/windows/ie/ie6/downloads/critical/ie6sp1/default.mspx"&gt;http://www.microsoft.com/windows/ie/ie6/downloads/critical/ie6sp1/default.mspx&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;(if you have WinXP CD, start there, since &lt;span class="caps"&gt;IE 6&lt;/span&gt; first came out with Win XP)&lt;/p&gt;


	&lt;p&gt;That will give you &lt;span class="caps"&gt;MSIE 6&lt;/span&gt;.00.2800.1106, which failed miserably when I ran it through it&amp;#8217;s paces to &lt;span class="caps"&gt;POST&lt;/span&gt; content over &lt;span class="caps"&gt;HTTPS&lt;/span&gt;.&lt;/p&gt;


	&lt;h1&gt;Automating &lt;span class="caps"&gt;MSIE&lt;/span&gt; with Perl Win32::IEAutomation&lt;/h1&gt;


	&lt;p&gt;Next, I needed to automate testing with &lt;span class="caps"&gt;MSIE&lt;/span&gt;, and to the rescue comes Prashant Shewale&amp;#8217;s Perl module &lt;a href="http://search.cpan.org/~prashant/Win32-IEAutomation-0.5/"&gt;Win32::IEAutomation&lt;/a&gt;.   To run the module, I did the following on my Win2k System&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Download and install ActiveState&amp;#8217;s Active Perl 5.8.X:  &lt;a href="http://www.activestate.com/Products/Download/Download.plex?id=ActivePerl"&gt;http://www.activestate.com/Products/Download/Download.plex?id=ActivePerl&lt;/a&gt;  (Providing contact details are optional)&lt;/li&gt;
	&lt;/ul&gt;


	&lt;ul&gt;
	&lt;li&gt;Download and install Microsoft&amp;#8217;s nmake.exe.  See their &lt;a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q132084"&gt;Microsoft Knowledge Base, article 132084&lt;/a&gt;, and follow link to nmake15.exe.  Then run the downloaded file,  and move nmake.exe and nmake.err to c:\perl\bin.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;ul&gt;
	&lt;li&gt;Run &amp;#8216;cpan -i Win32::IEAutomation&amp;#8217; from the command line&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;At this point, I also installed CygWin and some decent editors to so some sane development and testing on the system, but that&amp;#8217;s beyond the scope of this article.&lt;/p&gt;


	&lt;p&gt;Last, I wrote a variant on the following script to drive IE:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;

    use Win32::IEAutomation;

    # Set up variables
    $server_base="https://www.example.com";
    $wait=$ARGV[0];
    $now=localtime(time);
    $upload="C:\Documents and Settings\Peter Burkholder\My Documents\TextDoc.txt";
    $user="username\@email.com";
    $pass="password";
    $title="PeterB Test for $wait sec at $now";

    # Create new instance of Internet Explorer
    my $ie = Win32::IEAutomation-&amp;gt;new( visible =&amp;gt; 1, maximize =&amp;gt; 1);

    # Goto Login page and Login
    $ie-&amp;gt;gotoURL('https://example.com');

    $ie-&amp;gt;getTextBox('name:', "username")-&amp;gt;SetValue($user);

    $ie-&amp;gt;getTextBox('name:', "password")-&amp;gt;SetValue($pass);

    $ie-&amp;gt;getButton('caption:', "Login")-&amp;gt;Click;

    # Navigate to the add content page
    $ie-&amp;gt;gotoURL('https://example.com/home/content.php');

    $ie-&amp;gt;getButton('caption:', "Create new")-&amp;gt;Click;

    ## Fill in Content Page
    $ie-&amp;gt;getTextBox('name:', "name")-&amp;gt;SetValue($title);
    $ie-&amp;gt;getSelectList('name:', "company_id")-&amp;gt;SelectItem("ACA");

    # IE fails on 6.00.2800.1106 whether or not a file is uploaded
    # Replace the
    # $ie-&amp;gt;getTextBox('name:', "filename")-&amp;gt;SetValue($upload);
    $ie-&amp;gt;getTextArea('name:', "note")-&amp;gt;SetValue("Sample comment on the upload");

    # Now we sleep to see at least 30 seconds to get the Post error, then click the "Save" button
    sleep($wait);
    $ie-&amp;gt;getButton('caption:', "Save")-&amp;gt;Click;

    # Summarize the output and quit IE so we always start from a known state
    $output=substr($ie-&amp;gt;PageText(),0,40);
    print $output;

    $ie-&amp;gt;closeIE();
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;The code starts up IE and walks it through the first few panes of the application until the point where the error has been known to occur.  It&amp;#8217;s evoked as, say:
    perl ieautomate.pl 5
where the last argument is the number of seconds to wait before the ultimate submit.  When run with a short wait, like 5 seconds, the content is successfully posted.  With a wait of 30 or 40 seconds, the submit fails.&lt;/p&gt;


	&lt;p&gt;Running this is really cool, like some poltergeist has taken over the machine.  I can&amp;#8217;t wait to use Win32::IEAutomation to check airline ticket prices, etc.&lt;/p&gt;


	&lt;h1&gt;Diagnosing the &lt;span class="caps"&gt;SSL&lt;/span&gt; problems&lt;/h1&gt;


	&lt;p&gt;This breaks down into two steps,  a) getting VmWare host-only  networking set up to route through the host so we can then b) run sslsniff on the traffic and look inside the packets.&lt;/p&gt;


	&lt;h2&gt;A) Getting VmWare routing set up&lt;/h2&gt;


	&lt;p&gt;Thanks to the folks at &lt;a href="http://www.cyberciti.biz/tips/setup-vmware-host-as-router-for-solaris-linux-freebsd-and-windows-xp-guest-os.html"&gt;Cyberciti.biz&lt;/a&gt; for getting me on the right track. Their post on the matter is largely correct except that:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;You need to run: &lt;code&gt;echo 1 &amp;gt; /proc/sys/net/ipv4/ip_forward&lt;/code&gt; and add that config to /etc/sysctl.conf&lt;/li&gt;
	&lt;/ul&gt;


* You would probably want to edit &lt;code&gt;/etc/vmware/vmnet1/dhcp/dhcpd.conf&lt;/code&gt; to include:
&lt;pre&gt;&lt;code&gt;
    option routers 192.128.2.1;
    option nameserver (_real ip of nameserver_)

&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;&lt;strong&gt;It turns out this step is totally unnecessary.&lt;/strong&gt;  I&amp;#8217;d intended to use the routing from the host&amp;#8217;s eth0 interface to the guest&amp;#8217;s vmnet1 subnet to run Mike Benham&amp;#8217;s &lt;a href="http://www.thoughtcrime.org/ie.html"&gt;sslsniff&lt;/a&gt;.  While SSLSniff works great in such a setup, if sufficently munges up the &lt;span class="caps"&gt;SSL&lt;/span&gt; traffic that it doesn&amp;#8217;t aid in addressing the &lt;span class="caps"&gt;MSIE&lt;/span&gt; problem, in fact, it pretty well makes it go away.&lt;/p&gt;


	&lt;h2&gt;B) Analyzing traffic with Ethereal/Wireshark&lt;/h2&gt;


	&lt;p&gt;Ack,  I&amp;#8217;m getting tired so sorry this last part is so lame.  What it comes down to is that three test cases were sufficient to reveal the crux of the problem.&lt;/p&gt;


	&lt;ol&gt;
	&lt;li&gt;Firefox &lt;span class="caps"&gt;SSL POST&lt;/span&gt;&amp;#8212;when using Firefox and taking about 30 seconds to fill out the form that gets POSTed, one can see &amp;#8216;Encrypted Alerts&amp;#8217; coming down from the server about every ten seconds.  The alerts are probably change_cipher_spec or more likely a close_notify.  When the &lt;span class="caps"&gt;POST&lt;/span&gt; is sent, Firefox starts with an &lt;span class="caps"&gt;SSL&lt;/span&gt; ClientHello and sets up a whole new &lt;span class="caps"&gt;SSL&lt;/span&gt; session&lt;/li&gt;
	&lt;/ol&gt;


	&lt;ol&gt;
	&lt;li&gt;Automated &lt;span class="caps"&gt;MSIE&lt;/span&gt; post with no delays&amp;#8212;when POSTing the form from the robot with no waits, everything works just great.&lt;/li&gt;
	&lt;/ol&gt;


	&lt;ol&gt;
	&lt;li&gt;Automated &lt;span class="caps"&gt;MSIE&lt;/span&gt; post with a 30s delay&amp;#8212;while the robot is waiting to &lt;span class="caps"&gt;POST&lt;/span&gt; the form, the same Encrypted Alerts come down from the server, and the client responds with ACKs.  But when the form is POSTed the client is trying to re-use the same &lt;span class="caps"&gt;SSL&lt;/span&gt; connection.  The server simply replys with &lt;span class="caps"&gt;ACKS&lt;/span&gt;, and &lt;span class="caps"&gt;MSIE&lt;/span&gt; barfs&lt;/li&gt;
	&lt;/ol&gt;


	&lt;p&gt;In case number 3 it&amp;#8217;s pretty clear that the Magic Apache mod_SSL Incantation is not working, as close_notify messages are still getting sent from  the server.&lt;/p&gt;


	&lt;p&gt;Over and out.&lt;/p&gt;</description>
      <pubDate>Fri, 08 Dec 2006 21:38:00 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:3a70d901-9636-424e-b6e7-91986364bf9e</guid>
      <author>Peter Burkholder</author>
      <link>http://typo.pburkholder.com/articles/2006/12/08/debugging-internet-explorer-ssl-issues</link>
      <category>Web Development</category>
      <category>Security</category>
      <category>msie</category>
      <category>internet</category>
      <category>explorer</category>
      <category>ssl</category>
      <category>ethereal</category>
      <category>vmware</category>
      <category>host</category>
      <category>only</category>
      <category>routing</category>
      <trackback:ping>http://typo.pburkholder.com/articles/trackback/3905</trackback:ping>
    </item>
  </channel>
</rss>
