<?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>His Deeds Are Dust &#187; firebug</title>
	<atom:link href="http://hisdeedsaredust.com/tag/firebug/feed/" rel="self" type="application/rss+xml" />
	<link>http://hisdeedsaredust.com</link>
	<description>surveying sub-optimal solutions</description>
	<lastBuildDate>Wed, 02 May 2012 13:16:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Security through perversity</title>
		<link>http://hisdeedsaredust.com/2009/12/security-through-perversity/</link>
		<comments>http://hisdeedsaredust.com/2009/12/security-through-perversity/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 08:00:31 +0000</pubDate>
		<dc:creator>Paul Flo Williams</dc:creator>
				<category><![CDATA[Poor choices]]></category>
		<category><![CDATA[firebug]]></category>
		<category><![CDATA[greasemonkey]]></category>
		<category><![CDATA[intranet]]></category>

		<guid isPermaLink="false">http://hisdeedsaredust.com/?p=126</guid>
		<description><![CDATA[The corporate Information Services overlords have recently introduced a single sign-on solution for our intranet applications, CA SiteMinder. Somewhere along the lines, a discussion must have taken place about a feature of that pesky Mozilla Firefox, helpfully remembering passwords. Although we have to sign on to even access our internal network, there must have been [...]]]></description>
			<content:encoded><![CDATA[<p>The corporate Information Services overlords have recently introduced a single sign-on solution for our intranet applications, <cite>CA SiteMinder</cite>. Somewhere along the lines, a discussion must have taken place about a feature of that pesky Mozilla Firefox, helpfully remembering passwords. Although we have to sign on to even access our internal network, there must have been raised eyebrows that Firefox could automatically sign us on to intranet applications as well. I&#8217;ll show you how our webgrunts &#8220;solved&#8221; the problem. I have no idea whether this is part of SiteMinder, or simply a local perversion.</p>
<p>Firstly, I&#8217;ll tell you what I&#8217;m <em>not</em> showing you.</p>
<ul>
<li>I&#8217;m not showing you that this claims to be an XHTML page, despite the invalid element nesting that makes Firebug mark many of the elements of the DOM in its faded &#8220;what the hell?&#8221; style</li>
<li>I&#8217;m not showing you that the same JavaScript function is included twice, for no useful purpose.</li>
</ul>
<p>In fact, I&#8217;m showing you a cleaned-up snippet that demonstrates the behaviour of the login form while sparing you some of the worst syntax of the original.</p>
<h3>The login form</h3>
<p>The login form appears on the page as two text fields, for username and password, and a &#8220;Connect&#8221; button, as you&#8217;d expect. What is not apparent until you examine the source, is that the username and password are in different forms, which I believe is the key to this trick.</p>
<pre>
 &lt;form name="login"
       action="sm_login.fcc"
       method="post"
       onsubmit="connect(); return false;">
    &lt;input type=hidden name=SMAUTHREASON value="0">
    &lt;input type=hidden name=SMAGENTNAME value="IoqEFNY64K">
    &lt;input type=hidden name=POSTPRESERVATIONDATA value="">
    &lt;input type=hidden name="SMENC" value="ISO-8859-1">
    &lt;input type=hidden name="SMLOCALE" value="US-EN">
    &lt;input type="hidden" name="PASSWORD" value="">
    &lt;input type="hidden" name="lang" value="">
    Username: &lt;input type="text" name="USER" maxlength="8" size="23">
  &lt;/form>
  &lt;form name="pwd"
       onsubmit="connect(); return false;"
       method="post"
       action="">
    Password: &lt;input type="password" name="tpep" size="23">
  &lt;/form>
  &lt;input type="button" value="&nbsp;Connect&nbsp;" onclick="javascript:connect()">
</pre>
<p>So here we have two forms. One is the real login form, <var>login</var>, but what should have been a password text field has been made hidden. A second form, called <var>pwd</var>, has been used to hold a new password text field. The &#8220;Connect&#8221; button doesn&#8217;t belong to either form, but calls a global <code>connect()</code> function, just as the other two forms do.</p>
<h3><code>connect()</code> function</h3>
<p>Both forms run submissions through a piece of JavaScript:</p>
<pre>
function connect() {
  if (document.login.USER.value == "") {
    alert('Enter your user name');
    document.login.USER.focus();
  } else {
    if (document.pwd.tpep.value == "") {
      document.pwd.tpep.focus();
    } else {
      document.login.PASSWORD.value = document.pwd.tpep.value;
      document.login.lang.value = document.pwd.lang.value;
      document.pwd.tpep.value='';
      document.login.submit();
    }
  }
}
</pre>
<p>This little beauty does some standard checking that neither the username or password are blank, but then it copies the password field that we typed into the other form&#8217;s hidden field, blanks the visible password, and then forces submission of the login form.</p>
<p>This function can&#8217;t just return <tt>true</tt> or <tt>false</tt> to allow or stop the normal submission event, because it might have been invoked from the second form, &#8220;pwd&#8221;, if I pressed Enter after typing my password.</p>
<h3>Greasemonkeying this baby</h3>
<p>I routinely use <a href="http://www.greasespot.net">Greasemonkey</a> to make our intranet even vaguely usable, which for me means making sure that text isn&#8217;t too small for me to read, correcting structural defects that Internet Explorer ignores but which break the layout on Firefox, and adding functionality to applications.</p>
<p>Unfortunately, the structure of the real page that contains this snippet is ugly enough that I&#8217;ve so far failed to fix it. What I need to do is to defang the <tt>connect()</tt> function and put the password field in the first form, but I&#8217;m going to have to rewrite quite a chunk of the login page to achieve this.</p>
<p>While considering how to do it, however, I was playing around in <a href="http://getfirebug.com">Firebug</a>, and quite by accident managed to rewrite the form enough to get Firefox to remember the password, and then insert it in the real thing. Bizarre, but satisfying <img src='http://hisdeedsaredust.com/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://hisdeedsaredust.com/2009/12/security-through-perversity/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

