<?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>Neural Core Dump &#187; Security</title>
	<atom:link href="http://www.jeffdarlington.com/category/technology/security/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jeffdarlington.com</link>
	<description>The personal blog of Jeffrey T. Darlington, creator of General Protection Fault</description>
	<lastBuildDate>Sat, 24 Jul 2010 19:00:00 +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>Cryptnos 1.0 for .NET 2.0</title>
		<link>http://www.jeffdarlington.com/2010/03/23/cryptnos-1-0-for-net-2-0/</link>
		<comments>http://www.jeffdarlington.com/2010/03/23/cryptnos-1-0-for-net-2-0/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 19:36:27 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Cryptnos]]></category>
		<category><![CDATA[WinHasher]]></category>

		<guid isPermaLink="false">http://www.jeffdarlington.com/?p=364</guid>
		<description><![CDATA[In the ongoing spirit of releasing pointless Open Source software, I semi-proudly announce the release of Cryptnos 1.0 for Microsoft .NET 2.0. So what is it? Cryptnos is a secure password generator. By now, I&#8217;m sure many of you have heard of various programs, especially browser plug-ins, that let you generate unique passwords for all [...]]]></description>
			<content:encoded><![CDATA[<p>In the ongoing spirit of releasing pointless Open Source software, I semi-proudly announce the release of <a title="Cryptnos for .NET" href="http://www.gpf-comics.com/dl/cryptnos/dotnet.php">Cryptnos 1.0 for Microsoft .NET 2.0</a>.</p>
<p>So what is it? Cryptnos is a secure password generator. By now, I&#8217;m sure many of you have heard of various programs, especially browser plug-ins, that let you generate unique passwords for all your various online logins. They usually do this by combining the domain name of the site with a master password you supply, then run those inputs through an MD5 hash to give you a &#8220;strong&#8221; password that is unique for that site. Many of these applets also search the page you&#8217;re currently on for the login form and attempt to pre-populate the password box for you. Well, Cryptnos is kind of like that. Only it&#8217;s not.</p>
<p>Like these other apps, Cryptnos generates a password from your master password and from some mnemonic or &#8220;site token&#8221; that you supply. But that&#8217;s where the similarities end. First of all, Cryptnos does not live in your browser, so it can be used for any application where you need a strong password. As a corollary, the mnemonic does not have to be a domain name, although it certainly can be; it can be whatever you want it to be, so long as it is unique and it helps you remember what the password is used for. Next, Cryptnos gives you unparalleled flexibility in how your password is generated. You&#8217;re not stuck using just MD5, a broken cryptographic hash that is horribly out of date and which should no longer be used. You can select from a number of hashing algorithms, as well as how many times the hash should be applied. Crytpnos also uses Base64 rather than hexadecimal to encode the output, meaning your generated passwords can have up to 64 possible options per character instead of 16, making it stronger per character than the other guys. You can further tweak your generated password by limiting the types of characters used (for those times where a site requires you to only use letters and numbers) and the length of your password. Best of all, Cryptnos remembers all of these options for you, storing them in an encrypted state that is nearly impossible to crack. Your master password is <em><strong>NEVER</strong></em> stored, nor are your generated passwords; your passwords are generated on the fly, as you need them, and cleared from memory once the application closes.</p>
<p>Cryptnos originally sprang from the &#8220;Hash Text&#8221; function of <a title="WinHasher" href="http://www.gpf-comics.com/dl/winhasher/">WinHasher</a>, which I used to generate passwords in a similar fashion for a long time. I quickly ran into limitations in using WinHasher this way, especially when it came to sites where I had to tweak the password after it was generated. I thought to myself, &#8220;I&#8217;ll never be able to remember all these tweaks for all these passwords. Why can&#8217;t I just rip this function out of WinHasher and wrap a program around it to let the computer do all the work for me?&#8221; And that&#8217;s exactly what I did. I&#8217;ve been using Cryptnos to generate and &#8220;store&#8221; my passwords for months now and I finally decided it was stable enough to release it to the world at large.</p>
<p>Right now, <a title="Cryptnos" href="http://www.gpf-comics.com/dl/cryptnos/">Cryptnos</a> is only available for Microsoft .NET 2.0, which means by default it runs on Windows. However, I&#8217;m also working on a <a title="Cryptnos for Android" href="http://www.gpf-comics.com/dl/cryptnos/android.php">Google Android version</a>, which means a pure Java implementation should be simple to extract after that. I&#8217;ve even been pursuing a PHP and/or JavaScript implementation that does everything except storing the parameter data. I&#8217;m not sure when any of these will escape from my hard drive, but anyone interested in them can drop me an e-mail and I&#8217;ll happily open a dialog.</p>
<p>Oh, and the name? Um, well, I wanted a better one, but that&#8217;s the only thing I could find that sounded &#8220;passwordy&#8221; that didn&#8217;t have a lot of hits on Google.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jeffdarlington.com/2010/03/23/cryptnos-1-0-for-net-2-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WinHasher 1.6</title>
		<link>http://www.jeffdarlington.com/2010/02/08/winhasher-1-6/</link>
		<comments>http://www.jeffdarlington.com/2010/02/08/winhasher-1-6/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 16:57:21 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[WinHasher]]></category>

		<guid isPermaLink="false">http://www.jeffdarlington.com/?p=356</guid>
		<description><![CDATA[Wow! A non-Twitter digest post! Amazing! This is a quickie to let you guys now I&#8217;ve just released WinHasher 1.6. This is a minor release containing a few cosmetic and minor functional changes, so there&#8217;s no need to upgrade unless the features or bug fixes listed below seem worth the effort. Added a progress indication [...]]]></description>
			<content:encoded><![CDATA[<p>Wow! A non-Twitter digest post! Amazing!</p>
<p>This is a quickie to let you guys now I&#8217;ve just released <a title="WinHasher" href="http://www.gpf-comics.com/dl/winhasher/">WinHasher</a> 1.6. This is a minor release containing a few cosmetic and minor functional changes, so there&#8217;s no need to upgrade unless the features or bug fixes listed below seem worth the effort.</p>
<ul>
<li>Added a progress indication message for all the console applications. Previously, these programs simply went off into lala land when you kicked them off, kind of like the original GUI version did, giving you no indication how far along things have come.  Now the program displays what it&#8217;s doing (&#8220;Computing SHA-1 of&#8230;&#8221;) and then a percentage complete as it works.  Once complete, it displays the resulting hash as it did before. I thought about making the progress indicator &#8220;graphical&#8221; with little periods, hyphens, or equal signs, but the percentage was a lot easier to do (and I&#8217;m lazy).</li>
<li>Added a &#8220;case kludge&#8221; for comparing computed hashes against reference hashes (i.e. digests copied from a website). Typically, most sites will display hashes as a lower-case hexadecimal string, which is why I made that the default. However, I and other users have run into occasions where a download site presents the hash as upper-case hexadecimal. Unfortunately, if you paste this value into the comparison field on either the main WinHasher form or the &#8220;Send To&#8221; result dialog, the comparison will fail simply because the case does not match, even if the actual hash values do. Technically, you can tweak the command line of the &#8220;Send To&#8221; shortcut or change the output type on the main form, but either can be a pain when you know what you expect to see. So I&#8217;ve added a little bit of code that looks at what the comparison expects (i.e. &#8220;I&#8217;m looking for a lower-case hex string&#8221;) and adjusts the case of the comparison field if necessary. This means lower-case hex and Bubble Babble comparisons are forced to lower-case, while upper-case hex is forced to upper-case, no matter what case the original pasted-in string was. In the case of Base64, which includes mixed case characters, the comparison string is compared unaltered. After any case adjustment, the hash comparison occurs as previously designed.</li>
<li>Fixed a bug that wasn&#8217;t displaying the icon correctly within the application itself. Oopsy.</li>
</ul>
<p>For those who don&#8217;t know, WinHasher is a cryptographic hash generator for Microsoft .NET. It is roughly analogous to digest programs on other platforms (such as &#8220;openssl dgst&#8221; from OpenSSL) but designed for Windows and other .NET platforms. It lets you verify the integrity of downloads and determine whether changes have been made to files. It does <em><strong>NOT</strong></em> guarantee the authenticity of a file; for that, use cryptographic signatures such those produced by PGP or GnuPG. It also lets you create hashes of arbitrary text, which is handy for generating strong &#8220;passwords&#8221;, although I&#8217;m working on a different project that will do a much better job of this particular task. [Looks around shifty-eyed.]</p>]]></content:encoded>
			<wfw:commentRss>http://www.jeffdarlington.com/2010/02/08/winhasher-1-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Need help: Removing old certificate revocation lists in Windows</title>
		<link>http://www.jeffdarlington.com/2009/07/09/need-help-removing-old-certificate-revocation-lists-in-windows/</link>
		<comments>http://www.jeffdarlington.com/2009/07/09/need-help-removing-old-certificate-revocation-lists-in-windows/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 18:50:45 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[client certificate]]></category>
		<category><![CDATA[CRL]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.jeffdarlington.com/?p=260</guid>
		<description><![CDATA[I have a bit of a quandary that&#8217;s got me effectively stuck on a task at my day job. Thus far, Google and every other resource I&#8217;ve searched have been little help. In the unlikely event somebody out there that reads this blog (or at least gets the update notices via RSS, Twitter, or the [...]]]></description>
			<content:encoded><![CDATA[<p>I have a bit of a quandary that&#8217;s got me effectively stuck on a task at my day job. Thus far, Google and every other resource I&#8217;ve searched have been little help. In the unlikely event somebody out there that reads this blog (or at least gets the update notices via RSS, Twitter, or the other various feeds) can help me, I&#8217;m going throw this out and hope it garners some feedback.</p>
<p>I&#8217;ll try to keep this as short as possible. Our production Web site, built in ASP.NET and C# and running in IIS on Windows Server 2003, recently added authentication via client certificates stored on users&#8217; smart cards. We allow users to attach their smart card certificates to their existing account, then authenticate them by verifying their certificate, looking up the user account by that certificate&#8217;s fingerprint, and loading their profile. These certificates are signed by a trusted third-party certificate authority (CA) owned by the client and every morning we download the latest certificate revocation lists (CRLs) so we can reject certificates as they are revoked by the CA. My download process is working fine and dandy, so that&#8217;s not the problem; neither is the actual import process, as I know the command line options for Microsoft&#8217;s <code>certutil</code> command that will import the CRLs.</p>
<p>My problem stems from removing the <em>old</em> CRLs, which so far I haven&#8217;t been able to accomplish without going into the Microsoft Management Console and clicking through the GUI. We&#8217;ve had problems with the size of the certificate store, as the CRLs tend to be very large and we have to remove the old ones before the new ones can be imported. I&#8217;ve tried the few suggestions I&#8217;ve found online that haven&#8217;t seemed to work, such as a command-line switch for <code>certutil</code> that&#8217;s supposed to overwrite the old CRL with the new one (it just imports the new one and leaves the old one in place). We want to automate this process into a scheduled task, so it can run early in the morning when our users aren&#8217;t on the system and without human intervention.</p>
<p>Here are the tools available to me:</p>
<ul>
<li>As previously stated, <code>certutil</code> (part of Microsoft&#8217;s Certificate Services package);</li>
<li>Windows PowerShell;</li>
<li>Anything I can throw into a .NET assembly and build an executable out of (preferably C# code);</li>
<li>Good old fashioned batch files.</li>
</ul>
<p>I&#8217;ll tell you, I&#8217;m pretty frustrated and exhausted by this task. It&#8217;s not that I can&#8217;t do the research and figure it out for myself; I <em>have</em> done the research, and everything I&#8217;ve read applies to certificates and not CRLs, and they&#8217;re not exactly a direct swap in usage. I&#8217;d prefer not to provide much more detail than this for security reasons.</p>
<p>For the time being, I&#8217;ve been manually removing the old CRLs through MMC and then running a batch script to do the import every morning as my first task. That&#8217;s working fine for now, when I&#8217;m in the office every morning, but I&#8217;ll be taking some vacation time soon that will start to cause problems. I swear, if this was OpenSSL and Apache on Linux, I&#8217;d have this solved in a heartbeat (or at least an afternoon). If you have any suggestions, please feel to post a comment or shoot me a direct e-mail at the usual address.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jeffdarlington.com/2009/07/09/need-help-removing-old-certificate-revocation-lists-in-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Look, Ma! I&#8217;m on Security Now!</title>
		<link>http://www.jeffdarlington.com/2008/07/14/look-ma-im-on-security-now/</link>
		<comments>http://www.jeffdarlington.com/2008/07/14/look-ma-im-on-security-now/#comments</comments>
		<pubDate>Mon, 14 Jul 2008 14:54:52 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[cookie]]></category>
		<category><![CDATA[DoubleClick]]></category>
		<category><![CDATA[podcast]]></category>
		<category><![CDATA[Security Now]]></category>
		<category><![CDATA[Steve Gibson]]></category>
		<category><![CDATA[TWiT]]></category>

		<guid isPermaLink="false">http://www.jeffdarlington.com/?p=148</guid>
		<description><![CDATA[I hope to post more on this when there&#8217;s more data to post, but I thought I&#8217;d throw up a quick note stating that the latest episode of the Security Now! &#8220;netcast&#8221; features a question posed by yours truly. (The best part was listening to Leo Laporte stumble over my long-winded rambling. ) The high-quality [...]]]></description>
			<content:encoded><![CDATA[<p>I hope to post more on this when there&#8217;s more data to post, but I thought I&#8217;d throw up a quick note stating that the <a title="Security Now! #152 (TWiT.tv)" href="http://twit.tv/sn152">latest episode of the Security Now! &#8220;netcast&#8221;</a> features a question posed by yours truly. (The best part was listening to Leo Laporte stumble over my long-winded rambling. <img src='http://www.jeffdarlington.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ) The high-quality version of the show can be found at the previous link; a low-bandwidth version as well as a text-only transcript can be found at the <a title="Security Now! #152 (GRC.com)" href="http://www.grc.com/sn/sn-152.htm">corresponding page at GRC.com</a>. A search in the transcript for &#8220;Darlington&#8221; will take you to the beginning of my question; in the netcast, it starts around 38 minutes, 22 seconds in. (Of course, I encourage everyone to read/listen to the entire thing.)</p>
<p>For the full effect, though, you&#8217;ll also need to listen to/read the previous two non-Q&amp;A episodes of the show, <a title="Security Now! #149 (TWiT.tv)" href="http://twit.tv/sn149">#149</a> and <a title="Security Now! #151 (TWiT.tv)" href="http://twit.tv/sn151">#151</a>. (Low-bandwidth and trascriptions can be found <a title="Security Now! #149 (GRC.com)" href="http://www.grc.com/sn/sn-149.htm">here</a> and <a title="Security Now! #151 (GRC.com)" href="http://www.grc.com/sn/sn-151.htm">here</a>.) The entire dialog concerns the recent trend of <a title="Internet service provider article on Wikipedia" href="http://en.wikipedia.org/wiki/Internet_service_provider">ISPs</a> selling out their customers to allow third-party advertisers to come in and install hardware at the ISP to facilitate tracking the ISPs&#8217; customers&#8217; surfing habits across sites. While the ad companies in question claim to not be recording personally identifyable information about the ISPs&#8217; customers, the capability is there and the possibilities for abuse are enormous. It brings back many shades of the <a title="DoubleClick article on Wikipedia" href="http://en.wikipedia.org/wiki/DoubleClick">DoubleClick</a> controversies of the late 1990s-early 2000s, only much more ominous. I provided a unqiue standpoint to the discussion: that of a Web developer hosting a site and encountering similiar mysterious &#8220;first party&#8221; cookies set for my domain but not set by me.</p>
<p>The full body my question is present, but I&#8217;m not completely satisfied with the answer. <img src='http://www.jeffdarlington.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  Let&#8217;s just say I think Steve Gibson made an assumption about the <a title="General Protection Fault" href="http://www.gpf-comics.com/">GPF</a> site that&#8217;s not 100% true. I&#8217;ve replied to his response with additional information. I don&#8217;t necessarily expect another response (he does, after all, have his own agenda to follow on <em>his</em> show), and even if he does it will likely be in episode #154, the next scheduled Q&amp;A episode. If anyone is interested, I&#8217;ll post updates if and when this occurs. If I don&#8217;t get a response, I&#8217;ll post my response here, especially since it contains some disturbing observations about &#8220;first party&#8221; cookies that have mildly paranoid folks like me nervous. (I&#8217;d hate to see what it does to <em>really</em> paranoid people.)</p>]]></content:encoded>
			<wfw:commentRss>http://www.jeffdarlington.com/2008/07/14/look-ma-im-on-security-now/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Cookie cunundrum</title>
		<link>http://www.jeffdarlington.com/2008/02/06/cookie-cunundrum/</link>
		<comments>http://www.jeffdarlington.com/2008/02/06/cookie-cunundrum/#comments</comments>
		<pubDate>Wed, 06 Feb 2008 15:07:20 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[GPF]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[cookies]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[HTTPS]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.jeffdarlington.com/2008/02/06/cookie-cunundrum/</guid>
		<description><![CDATA[By now, I&#8217;m assuming most of you have read Mondays GPF News item. (If you haven&#8217;t, shame on you.) GPF is leaving Keenspot, and I&#8217;m neck-deep in unit testing the new site with hopes of releasing it to beta testers soon. If you&#8217;re interested in beta testing, you can volunteer in this thread on the [...]]]></description>
			<content:encoded><![CDATA[<p>By now, I&#8217;m assuming most of you have read <a href="http://www.gpf-comics.com/news/d/20080204.html" title="GPF News: Monday, February 4, 2008">Mondays GPF News item</a>. (If you haven&#8217;t, shame on you.) <a href="http://www.gpf-comics.com/" title="General Protection Fault">GPF</a> is leaving <a href="http://www.keenspot.com/" title="Keenspot">Keenspot</a>, and I&#8217;m neck-deep in unit testing the new site with hopes of releasing it to beta testers soon. If you&#8217;re interested in beta testing, you can volunteer in <a href="http://forums.keenspot.com/viewtopic.php?t=100407" title="Keenspot Forums: Volunteering for beta-testing new site location">this thread on the old forum</a>.</p>
<p>However, I&#8217;ve hit upon one little programming snag, so I thought I&#8217;d put out an appeal for help. I thought the blog would be more appropriate venue for this than the forum; that assumption could be wrong, but I&#8217;ll go with it anyway. For those of you with some Web-based programming knowledge, especially in the areas of <a href="http://www.php.net/" title="PHP">PHP</a> and <a href="http://en.wikipedia.org/wiki/HTTP_cookie" title="HTTP cookie article on Wikipedia">cookies</a>, please put on your thinking caps.</p>
<p>As part of the new site, I&#8217;m implementing my own version of Keenspot&#8217;s PREMIUM service, reusing the old relabeling of GPF Premium. Keenspot PREMIUM is going away (for several reasons I won&#8217;t go into here), but as the service&#8217;s biggest proponent and largest beneficiary, I&#8217;d hate to lose that functionality. So the new site will launch with its own independent Premium functionality including all the old service&#8217;s features (optional ad-free surfing, weekly archives, High-Def archives, tons of exclusives like Jeff&#8217;s Sketchbook, etc.) plus a few new features that I&#8217;ve been wanting to implement but haven&#8217;t had the time or technological hoop-jumping expertise to work on at Keen.</p>
<p>For security reasons, I want to secure Premium sign-ups and account management via secure <a href="http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol" title="Hypertext Transfer Protocol article on Wikipedia">HTTP</a> (<a href="http://en.wikipedia.org/wiki/Https" title="HTTPS article on Wikipedia">HTTPS</a>). The benefits should be obvious. By encrypting account creation &amp; management pages, you eliminate <a href="http://en.wikipedia.org/wiki/Packet_sniffer" title="Packet sniffer article on Wikipedia">sniffing attacks</a> and protect user privacy. While these pages may still be susceptible to other forms of attacks (and I&#8217;ve coded them to be as resilient as I know how), encrypting the traffic end-to-end can go a long way to cutting off those vectors of attack.</p>
<p>However, I seem to have hit a brick wall when it comes to setting the Premium authentication cookie. Like Keenspot&#8217;s implementation, the subscriber&#8217;s browser will be &#8220;enabled&#8221; by &#8220;branding&#8221; it with a cookie, which will be read and authenticated each time the page is loaded. If valid, Premium features for that page will be turned on; if invalid, the page will default to a non-enabled state, which could be a simple as showing all ads or as complex as denying access to the content within. Unlike Keenspot&#8217;s implementation, which was <a href="http://en.wikipedia.org/wiki/JavaScript" title="JavaScript article on Wikipedia">JavaScript</a> based, mine is scripted server-side in PHP, meaning it should be more accessible to a wider range of browsers and in theory more secure (no Premium content is sent at all if Premium is not enabled, rather than letting the client browser decide). My implementation has been thoroughly tested and appears to work pretty much flawlessly&#8230; with one hitch.</p>
<p>The problem occurs when I set the cookie over the encrypted HTTPS connection, then try to read it over unencrypted HTTP. I appears that none of my test browsers send the cookie back when the encryption state changes. The reverse is the same; if I change the URL and set the cookie over HTTP, then try to access a page via HTTPS, the encrypted page can&#8217;t see the cookie either. It works like an either-or situation, when what I really want is both. If I set a cookie over HTTPS, I want to see it in both HTTP and HTTPS mode.</p>
<p>PHP&#8217;s primary cookie interface is the <a href="http://www.php.net/manual/en/function.setcookie.php" title="PHP Manual: setcookie"><code>setcookie()</code></a> method (for setting) and the <a href="http://www.php.net/manual/en/reserved.variables.php" title="PHP Manual: Predefined Variables"><code>$_COOKIE</code> array</a> (for reading). <code>setcookie()</code> includes a <a href="http://en.wikipedia.org/wiki/Boolean_logic" title="Boolean logic article on Wikipedia">boolean</a> parameter for secure cookies, i.e. cookies that will only be sent via HTTPS. What&#8217;s annoying is that even when I set this flag to false to force it to be insecure, the scripts continue to exhibit the same behavior: cookies set via HTTP can only be read via HTTP and vice versa. I&#8217;ve also tried setting the same cookie both ways&#8211;first in one protocol, then the other, without erasing the first cookie&#8211;but that didn&#8217;t seem to work. The second cookie overwrites the first one, effectively turning it off.</p>
<p>I had heard that <a href="http://en.wikipedia.org/wiki/Internet_Explorer" title="Internet Explorer article on Wikipedia">IE</a> 6 exhibited this behavior as a bug. However, I tried the exact same tests in <a href="http://www.mozilla.com/en-US/firefox/" title="Firefox">Firefox</a> 2.0.0.11, <a href="http://www.opera.com/" title="Opera">Opera</a> 9.24, and <a href="http://www.apple.com/safari/download/" title="Safari">Safari</a> 3.0.4 (all on <a href="http://en.wikipedia.org/wiki/Microsoft_Windows" title="Microsoft Windows article on Wikipedia">Windows</a>) as well as IE 7, and all reacted the same way. Cookies set over HTTP could not be read over HTTPS and vice versa. It&#8217;s a bit frustrating. Obviously, I don&#8217;t want my Premium folks to be forced to use the new site in encrypted mode all the time, as this would slow down all the pages and put a significant extra load on the server as the number of subscribers increases. But I want to protect my users&#8217; privacy and settings (and one of my important revenue streams) by encrypting their account access.</p>
<p>So I guess I&#8217;m looking for answers to two questions:</p>
<ol>
<li>Is this some new standard of behavior that I&#8217;m missing? I was operating under the assumption that secure cookies (those set with the boolean secure flag) were restricted to HTTPS, but otherwise all other cookies should be sent regardless of whether it was encrypted or not. When I use the awesome Firefox <a href="http://chrispederick.com/work/web-developer/" title="Web Developer">Web Developer plugin</a>, it tells me that the cookie <em>should</em> be there regardless of the encrypted state. Yet it still doesn&#8217;t get sent. But am I asking too much? Am I not understanding the specifications, or has something changed that I wasn&#8217;t aware of? Can I not have my cake and eat it too?</li>
<li>
<ol style="list-style-type: lower-alpha">
<li>If I&#8217;m right and this <em>should</em> be working, what am I doing wrong? Is there a feature of PHP I should be use other than setcookie() to do this? Is it a bug, either in PHP or the browsers?</li>
<li>If I&#8217;m wrong and this behavior is expected, is there a workaround I can use to let the same Premium features work over both HTTP and HTTPS? Or should I just give up on the encrypted account management and assume my stuff isn&#8217;t worth stealing enough to bother?</li>
</ol>
</li>
</ol>
<p>Any responses via e-mail or (preferred) comments below will be appreciated.</p>
<p><em>Update March 5, 2008:</em> Thanks to the input of many commentors below, it looks like I&#8217;ve got a solution. The problem, as usual, was somewhere between the chair and the keyboard and the faulty component has been sufficiently flogged with a wet noodle. Immense thanks to everyone who provided feedback and suggestions.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jeffdarlington.com/2008/02/06/cookie-cunundrum/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Disturbing: PayPal in cahoots with DoubleClick?</title>
		<link>http://www.jeffdarlington.com/2007/11/27/disturbing-paypal-in-cahoots-with-doubleclick/</link>
		<comments>http://www.jeffdarlington.com/2007/11/27/disturbing-paypal-in-cahoots-with-doubleclick/#comments</comments>
		<pubDate>Tue, 27 Nov 2007 16:52:57 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[cookie]]></category>
		<category><![CDATA[DoubleClick]]></category>
		<category><![CDATA[PayPal]]></category>
		<category><![CDATA[Security Now]]></category>
		<category><![CDATA[Steve Gibson]]></category>
		<category><![CDATA[TWiT]]></category>

		<guid isPermaLink="false">http://www.jeffdarlington.com/2007/11/27/disturbing-paypal-in-cahoots-with-doubleclick/</guid>
		<description><![CDATA[I don&#8217;t usually do link-and-run posts (I prefer to have actual content in a blog), but I thought this was disturbing enough to disseminate. I&#8217;ll probably add my own blathering commentary which will make it more than a link-and-run post anyway. (After all, I know all of you who come here really come for the [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t usually do link-and-run posts (I prefer to have actual <em>content</em> in a blog), but I thought this was disturbing enough to disseminate. I&#8217;ll probably add my own blathering commentary which will make it more than a link-and-run post anyway. (After all, I know all of you who come here <em>really</em> come for the blathering. I&#8217;m just so blatherful&#8230;.)</p>
<p>I&#8217;m not sure how many of you out there follow the <a href="http://www.twit.tv/sn" title="The TWiT Netcast Network: Security Now!">Security Now!</a> podcast over at <a href="http://www.twit.tv/" title="The TWiT Netcast Network">TWiT</a>, but it&#8217;s probably obvious by now that I do, given <a href="http://www.jeffdarlington.com/2007/11/07/roaming-authentication-with-apache-mod_rewrite/" title="Roaming authentication with Apache mod_rewrite, November 7th, 2007">recent</a> <a href="http://www.jeffdarlington.com/2007/10/31/wordpress-security-tweaks/" title="WordPress security tweaks, October 31st, 2007">posts</a>. This past week&#8217;s episode, <a href="http://www.twit.tv/sn119" title="TWiT: Security Now! #119">#119</a>, exposes a rather unsettling fact that shouldn&#8217;t be ignored.  (The high quality 64kbps MP3 can be found at that link, while a 16kbps MP3, a transcript in various formats, and additional notes can be found <a href="http://www.grc.com/SecurityNow.htm#119" title="GRC | Security Now!">here</a>.) While I encourage you to download and listen/read the facts for yourself, I&#8217;ll see if I can summarize it below for the attention-span impaired.</p>
<p>For a long time, I&#8217;ve defended <a href="https://www.paypal.com/" title="PayPal">PayPal</a> as a method of monetary transfer. They&#8217;ve always been good to me personally, even during the stormy periods where some <a href="http://www.gpf-comics.com/" title="General Protection Fault">GPF</a> readers boycotted them for &#8220;questionable&#8221; practices. (See the <a href="http://en.wikipedia.org/wiki/PayPal" title="PayPal article on Wikipedia">PayPal Wikipedia entry</a> for an abbreviated history.) For that matter, many online comics wouldn&#8217;t be able to monetize themselves in <em>any</em> fashion if it weren&#8217;t for PayPal, as many webcomics use the service for donations and online stores. (PayPal has always been an acceptable form of payment in every incarnation of the <a href="https://www.jeffdarlington.com/store/" title="The Official GPF Store">GPF Store</a>.) They&#8217;ve always had issues with customer service, but they&#8217;ve also been champions in <a href="http://en.wikipedia.org/wiki/Phishing" title="Phishing article on Wikipedia">anti-phishing</a> campaigns.</p>
<p>But Steve Gibson and Leo Laporte have helped disclose a rather shady new practice: In a previous Security Now! episode, a listener mentioned problems downloading a software service from PayPal, only to discover that the download link was sending him to a server over at <a href="http://www.doubleclick.com/" title="DoubleClick.com">DoubleClick</a> rather than PayPal. Since he was locally blocking access to the domain &#8220;doubleclick.net&#8221; in his <a href="http://en.wikipedia.org/wiki/Hosts_file" title="Hosts file article on Wikipedia">hosts file</a>, the link failed and the software would not download. Gibson promised to investigate the incident and after a number of side-tracks finally presented his results.</p>
<p>DoubleClick, for the few out there unfamiliar with it, is one of the Internet&#8217;s largest online advertising agencies, serving ad banners to millions of Web sites (including, indirectly, GPF). DoubleClick has long been unpopular among netizens for its questionable policies of tracking Web surfers across multiple sites, using a trick with <a href="http://en.wikipedia.org/wiki/HTTP_cookie#Privacy_and_third-party_cookies" title="Privacy and third-party cookies section of the HTTP Cookie Wikipedia article">tracking cookies</a> to follow you from site to site. Privacy concerns were raised even further when <a href="http://www.google.com/" title="Google">Google</a>, a company that itself stores and indexes a lot of personal information about its users of GMail, Ad-Sense, and other services, recently purchased DoubleClick. DoubleClick eventually bowed to pressure from the Net at large and created an <a href="http://www.doubleclick.com/privacy/dart_adserving.aspx" title="DoubleClick.com: Privacy: Dart Ad Serving: Opt-Out">opt-out page</a> so their tracking cookie would contain &#8220;non-personally-identifiable information&#8221; and thus negate some of the tracking cookie&#8217;s effectiveness. (This opt-out page is still linked to (now indirectly, as the URL has changed) from the <a href="http://www.gpf-comics.com/privacy.html" title="GPF: Privacy Statement and Ad Info">GPF privacy policy page</a>.) Many folks these days, however, including myself, simply run <a href="http://en.wikipedia.org/wiki/Spyware" title="Spyware article on Wikipedia">spyware</a> scanners like <a href="http://www.safer-networking.org/" title="Spybot: Search &amp; Destroy">Spybot: Search &amp; Destroy</a> or<a href="http://www.lavasoftusa.com/" title="Lavasoft"> Ad-Aware</a> and periodically delete such tracking cookies, or just block the &#8220;doubleclick.net&#8221; domain and its subdomains using the hosts file trick mentioned above. (This is how, in part, Spybot&#8217;s immunization against cookies works.) This eliminates or at least minimizes the opportunity for your Web surfing habits to be linked personally to you.</p>
<p>However, PayPal&#8217;s new links bypass many of these anti-drive-by-cookie-ing techniques by sending you directly to DoubleClick&#8217;s servers, rather than inlining content like Flash or images from their site. Since these are internal PayPal URLs and not links that are expected to send you to the outside, they should be immediately suspicious. What&#8217;s even worse is that if you examine the URL closely, there appears to be some sort of &#8220;user ID&#8221; like number included that may personally identify you if you click on it. What&#8217;s even <em>more</em> disturbing is the number of these links you run across as you surf the PayPal site; while some obviously ad-like images contain the &#8220;doubleclick.net&#8221; URL, many links in the site bar that look like ordinary navigational links contain it as well. While Gibson points out&#8211;quite rightly&#8211;that there is no evidence to support any sort of conspiracy theories that many come to mind, it <em>is</em> obvious enough that <em>some</em> sort of information sharing is going on between the two companies, and that if a unique user identifier is indeed being passed along with the URL, there&#8217;s a likelihood that both companies can link your potential spending habits with PayPal to your surfing habits tracked by DoubleClick.</p>
<p>Now it&#8217;s easy to be alarmist and to say everyone should boycott PayPal. Unfortunately, so many of us in webcomics depend on PayPal for survival, so there&#8217;s no way we can easily remove ourselves from it. And there&#8217;s no competitor out there with enough critical mass to really challenge PayPal for dominance, so there aren&#8217;t many viable alternatives. Thus the only current immunization option is diligent observation.</p>
<p>The good news is that the DoubleClick URLs within PayPal&#8217;s site all contain at the end PayPal URL you will eventually be redirected to. It&#8217;s trivial to copy the URL, paste it into your address bar, crop out the DoubleClick portion, and go directly the the PayPal internal destination. Laporte even suggested that it won&#8217;t be long before someone comes up with a <a href="http://www.mozilla.com/firefox/" title="Firefox">Firefox</a> <a href="https://addons.mozilla.org/en-US/firefox/" title="Firefox Add-ons">plugin</a> that does that for you on the fly. The problem I see with this is that it won&#8217;t be long before the diabolical duo figures out savvy users are bypassing the links and they find a better way to obscure the redirection target URL so the copy/paste/edit trick will no longer work. While true encryption might be a bit too much server load for them to handle <em>en masse,</em> a simple ROT13 or Base64 encode might be enough to thwart all but the most stalwart gearheads.</p>
<p>So&#8230; should <em>you</em> avoid PayPal? That&#8217;s up to you. I <em>can&#8217;t,</em> but I&#8217;ll be a lot more careful of where I click on their site from now on.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jeffdarlington.com/2007/11/27/disturbing-paypal-in-cahoots-with-doubleclick/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Roaming authentication with Apache mod_rewrite</title>
		<link>http://www.jeffdarlington.com/2007/11/07/roaming-authentication-with-apache-mod_rewrite/</link>
		<comments>http://www.jeffdarlington.com/2007/11/07/roaming-authentication-with-apache-mod_rewrite/#comments</comments>
		<pubDate>Wed, 07 Nov 2007 21:25:59 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[cookie]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[Security Now]]></category>
		<category><![CDATA[Steve Gibson]]></category>
		<category><![CDATA[TWiT]]></category>

		<guid isPermaLink="false">http://www.jeffdarlington.com/2007/11/07/roaming-authentication-with-apache-mod_rewrite/</guid>
		<description><![CDATA[I mentioned last week that I was working on a neat Apache mod_rewrite trick for locking down access to certain administration pages, but that I wasn&#8217;t having much success with it. Well, it seems to be working now and, as promised, I wanted to share it with anyone who might be interested. Fair warning to [...]]]></description>
			<content:encoded><![CDATA[<p>I <a href="http://www.jeffdarlington.com/2007/10/31/wordpress-security-tweaks/" title="WordPress security tweaks, October 31st, 2007">mentioned last week</a> that I was working on a neat <a href="http://httpd.apache.org/" title="Apache Web server">Apache</a> <a href="http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html" title="mod_rewrite documentation"><code>mod_rewrite</code></a> trick for locking down access to certain administration pages, but that I wasn&#8217;t having much success with it. Well, it seems to be working now and, as promised, I wanted to share it with anyone who might be interested. Fair warning to non-technical readers: extreme geekery lies ahead.</p>
<p>First and foremost, I can&#8217;t claim full credit for this idea. It borrows some from <a href="http://www.grc.com/default.htm" title="Gibson Research Corporation">Steve Gibson</a>&#8216;s roaming authentication scheme outlined in episode #113 of the <a href="http://www.grc.com/SecurityNow.htm" title="GRC | Security Now!">Security Now! podcast</a>. In that show (and subsequently continued in episode #115), Gibson outlines his method of allowing his employees to access secure portions of his site while traveling. The method described here is not quite as secure as his, as I&#8217;m forcing things to happen at the Web server software layer as opposed to the application layer and thus don&#8217;t have the same fine granularity of control he has. However, it uses many of the same ideas.</p>
<p>It&#8217;s relatively easy with <code>mod_rewrite</code> to protect certain resources of a site by restricting access to certain IP addresses. Consider the following:</p>
<blockquote><p><code>RewriteCond %{REQUEST_URI}   ^/store/admin/.*<br />
RewriteCond %{REMOTE_ADDR} !^192\.168\.13\.<br />
RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1$<br />
RewriteRule ^/store/admin/.* /store/ [R,L]</code></p></blockquote>
<p>This rule set essentially says: (1) if the requested URL starts with the string &#8220;/store/admin/&#8221; and (2) the IP address of the requesting client does not begins with &#8220;192.168.13.&#8221; or (3) is not exactly &#8220;127.0.0.1&#8243; then (4) redirect all requests for URLs starting with &#8220;/store/admin/&#8221; to the root URL of the store, &#8220;/store/&#8221;. Essentially, we&#8217;re only allowing access to what is apparently the administrative portions of an online store to a very limited number of IP addresses, one of which is fully qualified (the &#8220;loop-back&#8221; address of 127.0.0.1) and the rest belonging to a range (192.168.13.0 through 192.168.13.255). Anyone outside these IPs will be transparently redirected to the front page of the store. (Redirecting is much friendlier than outright forbidding access.) All of this takes place in Apache itself, before we even get to the application and any potential security flaws it might have. There are no worries about hacking the store software itself to deny access.  Of course, we can list any number of <code>REMOTE_ADDR</code> entries that we wish; each condition is a regular expression (which are negated here by the &#8220;bang&#8221; at the front) so we can filter on any octet we want and can easily specify real, outside IPs rather than private ones. For example, for this site I limit access to my various admin sections to the IP of my cable modem and our outside IP at work.</p>
<p>However, what happens when you are required to go on a trip and need to access the administrative parts of the site while on the go? Obviously, you can&#8217;t add the hotel&#8217;s outside IP to this rule set in advance (imagine asking the front desk for <em>that</em> information), and you probably won&#8217;t be able to add it easily once you get there. Sure, <a href="http://wordpress.org/" title="WordPress">WordPress</a> and the store front software have login security on their various admin interfaces, but we&#8217;re trying to protect those from hackers, right? Aside from reopening them to the entire Internet before the trip and closing them again once we get back, there aren&#8217;t very many options. How then can we identify approved &#8220;roaming&#8221; users and/or machines so they can access the admin sites without being inside a hard-coded list of IPs?</p>
<p>Gibson&#8217;s answer was to optionally set a secure cookie in the user&#8217;s browser if they access the admin site within one of the approved IPs first. Being within an approved IP, they aren&#8217;t restricted by the access rule and they are allowed to reach the login prompt. During login, they are prompted on whether or not they want to enable roaming access on this particular machine. If they agree, a secure cookie is set in the browser and set to expire at some date in the future. Later, when the user attempts to access the admin site outside of the approved IP list, the site checks to see if the cookie has been set. If present, the user is allowed to log in, just as if they were within one of the approved IPs. The cookie acts as a kind of two-factor authentication: the first factor being &#8220;something you know&#8221;, the user name and password, and the second being &#8220;something you have&#8221;, the cookie. Since the cookie is set in secure mode (HTTPS), it will only be sent back to the site over a secure connection. And since (well behaved) browsers only allow a site to read the cookies it has itself set, no other site should be able to read it.</p>
<p>This is all well and good&#8230; <em>if</em> you have access to the source of the application you&#8217;re trying to secure and you&#8217;re willing to hack it. Gibson wrote his own store front, so this was relatively easy for him to integrate. But I want to secure WordPress, a third-party store app, and a few random subdirectories that are pretty much statically built HTML. As much as I like running Open Source software, I usually prefer not to muck around with things if I can help it, lest I screw something up. Thus, I don&#8217;t particularly want to hack WP and the store to add this extra layer of functionality. Fortunately, though, <code>mod_rewrite</code> gives us a mechanism through which we can accomplish basically the same thing without modifying the underlying application. In theory, since all this occurs <em>before</em> we even reach the application, one could argue it may even be <em>more</em> secure than the application&#8217;s authentication mechanisms themselves.</p>
<p>You can actually set browser cookies via <code>mod_rewrite</code> rules. Consider what happens if we insert the following before the rules we defined above:</p>
<blockquote><p><code>RewriteCond %{REMOTE_ADDR} ^192\.168\.13\.<br />
RewriteCond %{HTTP_COOKIE} "!</code><code>(.+; )*admincookie=uniqueval(; .+)*"</code><br />
<code> RewriteRule .* - [CO=admincookie:uniqueval:.domainname.tld:43200:/store/]</code></p></blockquote>
<p>This rule set essentially says: (1) if the remote IP starts with &#8220;192.168.13.&#8221; and (2) there isn&#8217;t a cookie already set by the name &#8220;admincookie&#8221; then (3) set a cookie named &#8220;admincookie&#8221; with the value &#8220;uniqueval&#8221; for the domain &#8220;.domainname.tld&#8221; (assuming that&#8217;s our real domain name) for a period of 30 days (60 minutes x 24 hours x 30 days = 43,200 minutes) restricted to the path &#8220;/store/&#8221; and its subdirectories. Now let&#8217;s modify the rule set from before:</p>
<blockquote><p><code>RewriteCond %{REQUEST_URI}   ^/store/admin/.*<br />
RewriteCond %{REMOTE_ADDR} !^192\.168\.13\.<br />
RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1$<br />
RewriteCond %{HTTP_COOKIE} "!(.+; )*admincookie=uniqueval(; .+)*"<br />
RewriteRule ^/store/admin/.* /store/ [R,L]</code></p></blockquote>
<p>Note that we&#8217;ve added a new condition. In addition to checking for the approved IP list, we also check to see if the &#8220;admincookie&#8221; has been set and that its value is what we expect (&#8220;uniqueval&#8221;). Note the parenthetical parts at the beginning and end of the cookie regex; these should make sure we match the unique cookie name/value pair, regardless of how many cookies are present. (Also note the quotes around this regex; since whitespace delimits the parts of the rewrite statements, the quotes are required to include the spaces after the semicolons in the regex. Without the quotes, the regex produces a &#8220;bad flag delimiters&#8221; error when Apache parses the configuration file.) Since each approved item&#8217;s entry is negated, the rule is only applied if none of them match. So now we should be able to get into the site remotely if and only if we&#8217;re inside an approved IP or we have the secret cookie, which we know is only set if we&#8217;ve been in one of the approved IPs first. Instant roaming authentication!</p>
<p>To summarize, the primary advantages to this scheme are:</p>
<ul>
<li>Restricts access to specific requested URIs to specific IP addresses and/or ranges and to machines outside those addresses that have a special roaming authentication cookie.</li>
<li>The roaming cookie can only be set from within one or more of the authorized IPs.</li>
<li>The cookie is set and checked at the Web server level, before the request reaches application code, so this scheme can be placed on top of third-party applications as an additional layer of security. No changes to the application layer are required.</li>
</ul>
<p>There are, of course, a few caveats:</p>
<ul>
<li>Based on these rules alone, none of the information transmitted back and forth is encrypted; it&#8217;s all sent in the clear, which may potentially be sniffed by a man in the middle. Then again, you can always use <code>mod_rewrite</code> to force certain URLs to always use SSL (assuming you have a secure certificate), thereby securing the connection first. All WP admin functions, the <a href="https://www.jeffdarlington.com/store/" title="GPF Store">GPF Store</a>, and my other secured admin locales here on this site are all secured via SSL, so that helps in keeping my site secure by eliminating sniffing. (Of course, if you go this route, don&#8217;t forget to copy any necessary rules from the main Apache configuration file to the SSL config file, as the secure site will be treated as a different virtual host with its own set of rewriting rules. This little hiccup is what was keeping me from publishing this for quite a while.)</li>
<li>Forcing SSL, however, doesn&#8217;t necessarily protect the cookie itself. Gibson&#8217;s roaming authentication cookie required an SSL connection. This is called a secure mode cookie. While I&#8217;m still doing research into this, as far as I can tell so far <code>mod_rewrite</code> does not have the facility to specify secure mode in a cookie set by a rewrite rule. Thus, the above cookie is <em>not</em> secure and will be sent with each request in or below the specified path, encrypted or not. The cookie is then theoretically susceptible to sniffing attacks. Setting a secure mode cookie is easy enough to do in application code, but not apparently so in <code>mod_rewrite</code>.</li>
<li>The value of the cookie is currently hard-coded to a set value, and every browser accessing it within the approved IP will receive the same hard-coded cookie value. Ideally, the cookie should be unique to each browser and somehow obscured or, better yet, encrypted. Unfortunately, while I&#8217;ve been researching this also, so far I haven&#8217;t come up with a way to create such a unique token natively within <code>mod_rewrite</code>. (Remember, all this is occurring in Apache before we even reach application code.) Right now, <strike>I&#8217;m using a rather large hash of a unique pass phrase string</strike> I use a small command-line script to create a very long, highly random string using random numbers, several hashes, a little bit of Blowfish encryption, and some random string manipulation, but the cookie value is still technically hard coded. It may be possible to write a cron that will periodically create a new value token, update the Apache config file, and restart Apache. This will update the value every so often, but it seems quite a hassle.  (Plus, the user under which the cron runs has to be root in order to modify both the config file and to restart Apache.)</li>
<li>Similarly, there&#8217;s no way to distinguish between browsers behind the approved IP. My desktop is unlikely to roam anywhere, so it technically doesn&#8217;t need the cookie. Meanwhile, if my parents bring their laptop over and visit this site from that machine while within my network, they&#8217;d get the roaming cookie as well. Neither of these scenarios are ideal. In application code, it would be simple to set the cookie only after the user has been authenticated by the app&#8217;s internal mechanism first. But we&#8217;re not working with application code; we&#8217;re rewriting URLs in the server. Thus, this becomes a different security concern: controlling access to the approved IPs, which could be both a physical (who can patch directly in via Ethernet) and a logical issue (who can access the wireless LAN). One thing I&#8217;ve done to get around this problem is to require the browser to be authorized for roaming access to first navigate to a very large (~50 characters), randomly-generated alphanumeric subdirectory alias (generated using the same command-line script mentioned above) that is highly improbably that some might guess. This alias can only be accessed within a single authorized IP address that I directly control. It is only then that the cookie set. This eliminates the unintentional cookie setting by casual browsing of the site from other machines behind the approved IP.</li>
<li><strike>The regular expression to match the cookie should probably be more precise. For example, the expression as stated above could also match the string &#8220;myadmincookie=uniquevalnum2&#8243;, which technically isn&#8217;t what we want. Since we&#8217;re only dealing with cookies that should be set by our domain, it may not be that big of a deal, but it&#8217;s still a vulnerability nonetheless. If nothing else, there&#8217;s always the potential of colliding with cookies sent by other applications running on your site, so picking a unique cookie name and value is important. The <code>%{HTTP_COOKIE}</code> variable gets all the cookies for a given site/path as one big string, with each name/value pair delimited by a semi-colon and a space (&#8220;; &#8220;) and the name and value are glued together with an equal sign. I&#8217;m looking into a better regex to match this more precisely and I&#8217;ll update this post if I find one.</strike> I&#8217;ve updated the regex so it should match the cookie name/value pair more exactly.</li>
<li>Of course, none of this by itself can completely secure a site. In addition to this scheme, I force SSL on certain paths, deny access for all users to other paths that should never be accessed directly, and even explicitly block certain IP ranges that have attempted to hack the site. It&#8217;s not fool proof by any means, but combined with many other secure practices and mechanisms, it adds one more layer of protection, and sometimes one added layer can make all the difference.</li>
</ul>
<p>I welcome any feedback on how to improve this, especially if anyone knows how to get around the secure and unique cookie caveats.</p>
<p><em>Appendium:</em>  I should also point out that this scheme should be equally usable if you place the code in your master Apache configuration file (usually something like <code>/etc/httpd/conf/httpd.conf</code> on UNIX clones) or in per-directory <code>.htaccess</code> files. I usually prefer to put such rules in the master config file, mostly because it&#8217;s more secure (outside of the document root) and only gets parsed and loaded once while <code>.htaccess</code> files are read and parsed each time there&#8217;s a request in that directory (or any of its subdirectories). However, that only works if you have access to the master config, which most shared hosting services don&#8217;t provide. Of course, such rules placed in an <code>.htaccess</code> file will only apply to that directory and its subdirectories, so you&#8217;d have to tweak the rules (such as file paths and the cookie path) as necessary.</p>
<p><em>Update 11/20/2007:</em> Updated cookie regex to better match the exactly name/value pair; added notes about rotating cookie values.</p>
<p><em>Update 11/30/2007:</em>  Put cookie regex in quotes to correct avoid &#8220;bad flag delimiters&#8221; parsing errors; added advantage summary to better showcase the advantages of the scheme; updated my cookie value scheme; added highly-random subdirectory alias to avoid unintentional cookie-ing</p>]]></content:encoded>
			<wfw:commentRss>http://www.jeffdarlington.com/2007/11/07/roaming-authentication-with-apache-mod_rewrite/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress security tweaks</title>
		<link>http://www.jeffdarlington.com/2007/10/31/wordpress-security-tweaks/</link>
		<comments>http://www.jeffdarlington.com/2007/10/31/wordpress-security-tweaks/#comments</comments>
		<pubDate>Wed, 31 Oct 2007 20:31:29 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.jeffdarlington.com/2007/10/31/wordpress-security-tweaks/</guid>
		<description><![CDATA[If you guys haven&#8217;t figured it out by now, I&#8217;m been becoming quite the Internet security nut over the past few years. A thorough search of the Technology category reveals a good bit of my interests in SSH, SSL, public key cryptography, etc. Maybe I ought to experiment with subcategories and introduce a Security category [...]]]></description>
			<content:encoded><![CDATA[<p>If you guys haven&#8217;t figured it out by now, I&#8217;m been becoming quite the <a href="http://en.wikipedia.org/wiki/Internet_security" title="Internet security article on Wikipedia">Internet security</a> nut over the past few years. A thorough search of the <a href="http://www.jeffdarlington.com/category/technology/" title="Category: Technology">Technology category</a> reveals a good bit of my interests in <a href="http://en.wikipedia.org/wiki/Secure_Shell" title="Secure Shell article on Wikipedia">SSH</a>, <a href="http://en.wikipedia.org/wiki/Transport_Layer_Security" title="Transport Layer Security article on Wikipedia">SSL</a>, <a href="http://en.wikipedia.org/wiki/Public-key_cryptography" title="Public-key cryptography article on Wikipedia">public key cryptography</a>, etc. Maybe I ought to experiment with subcategories and introduce a Security category under Technology&#8230;.</p>
<p>Anyway, <a href="http://wordpress.org/" title="WordPress">WordPress</a> usually includes some default feeds in the Dashboard after you log in, mostly from WP developers. One recent entry linked to a <a href="http://dougal.gunters.org/" title="geek ramblings">&#8220;geek ramblings&#8221;</a> post about <a href="http://dougal.gunters.org/blog/2007/10/30/securing-wordpress" title="geek ramblings: Creating a secure WordPress install">creating a secure WordPress install</a>, which in turn references a <a href="http://blogsecurity.net/wordpress/wordpress-security-whitepaper/" title="BlogSecurity: WordPress Security Whitepaper">WordPress security whitepaper</a> over at <a href="http://blogsecurity.net/" title="BlogSecurity">BlogSecurity</a>. (If you didn&#8217;t know any of these sites existed, don&#8217;t feel bad. Neither did I until today.) There&#8217;s lots of interesting reading there, especially if you&#8217;re (a) interested in securing your WordPress site and (b) you happen to be curious and/or adept enough to dabble in a number of arcane Web server settings. I happen to fit both of those criteria.</p>
<p>One of the main reasons I&#8217;m mentioning this is that there might be a few changes and improvements for folks who have registered to comment. The site now redirects you to a secure SSL page on login, and your <a href="http://en.wikipedia.org/wiki/HTTP_cookie" title="HTTP cookie article on Wikipedia">cookies</a> will be stored in secure mode too, meaning they can&#8217;t be read unless sent over an SSL connection. This might require you to log in the next time you try to comment, even if you&#8217;ve told the site to remember you, because the old cookies won&#8217;t be secure and will need to be reset. Otherwise, you probably will never notice the difference unless you go to edit your profile, which most of you probably will never worry about once you&#8217;ve registered.</p>
<p>The rest of the changes are all behind the scenes, so I won&#8217;t bother you with them. Just read the links if you&#8217;re curious. I&#8217;m experimenting with some arcane <a href="http://httpd.apache.org/" title="Apache Web server">Apache</a> <a href="http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html" title="Apache mod_rewrite documentation">mod_rewrite</a> rules to really locking down the admin pages, all outside the scope of the links listed above, but so far those tests don&#8217;t seem to work. However, if I get them to do what I want, I might post them here (to give back to the community and all). It will be pretty sweet and borrows a few ideas from recent episodes of the <a href="http://www.grc.com/SecurityNow.htm" title="GRC | Security Now!">Security Now! podcast</a> (#113 specifically) to lock down access to the admin site from only certain locations or certain roaming computers.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jeffdarlington.com/2007/10/31/wordpress-security-tweaks/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SIGGRAPH Key Signing Party?</title>
		<link>http://www.jeffdarlington.com/2007/05/24/siggraph-key-signing-party/</link>
		<comments>http://www.jeffdarlington.com/2007/05/24/siggraph-key-signing-party/#comments</comments>
		<pubDate>Thu, 24 May 2007 15:18:49 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Webcomics]]></category>

		<guid isPermaLink="false">http://208.78.96.240/?p=98</guid>
		<description><![CDATA[As previously mentioned, I&#8217;m headed to SIGGRAPH in August. The pre-con report is now up on the GPF Shows &#38; Cons site and, as usual, will become the core place for news and updates about my trip there. (I&#8217;ll probably end up mentioning the same stuff here as well, but that&#8217;s the official place to [...]]]></description>
			<content:encoded><![CDATA[<p>As <a href="http://www.jeffdarlington.com/2007/04/23/siggraph-2007/" title="SIGGRAPH 2007, April 23rd, 2007">previously mentioned</a>, I&#8217;m headed to <a href="http://www.siggraph.org/s2007/" title="SIGGRAPH 2007">SIGGRAPH</a> in August. The <a href="http://www.gpf-comics.com/shows/siggraph2007/" title="GPF: The SIGGRAPH 2007 Pre-Con Report">pre-con report</a> is now up on the <a href="http://www.gpf-comics.com/shows/" title="GPF: Shows &amp; Cons">GPF Shows &amp; Cons</a> site and, as usual, will become the core place for news and updates about my trip there. (I&#8217;ll probably end up mentioning the same stuff here as well, but that&#8217;s the official place to look.)</p>
<p>It occurred to me yesterday while I was writing up a <a href="http://www.gpf-comics.com/news/" title="GPF News">News</a> item for Monday that SIGGRAPH may&#8211;or may not&#8211;be a good place to hold a <a href="http://en.wikipedia.org/wiki/Key_signing_party" title="Key signing party article on Wikipedia">key signing party</a>. For those unfamiliar with <a href="http://en.wikipedia.org/wiki/Public-key_cryptography" title="Public-key cryptography article on Wikipedia">public-key cryptography</a>, this is a gathering where PKC users can verify each other&#8217;s identities, prove you are who you say you are, and obtain signatures on your public key. This increases your perceived level of trust; the more signatures you have on your public key, the more people who say they have verified your identity and thus the more trustworthy your own signature becomes. This <a href="http://en.wikipedia.org/wiki/Web_of_trust" title="Web of trust article on Wikipedia">&#8220;web of trust&#8221;</a> is the core to PKC; without it, anyone could create a key and say they&#8217;re somebody else and there wouldn&#8217;t be an easy way to prove otherwise.</p>
<p>I said it <em>may</em> be a good place for a key signing because there will be a lot of computer professionals there. It might <em>not</em> be a good place because most of those computer professionals are more involved with graphics than with cryptography (which is ironic because both require a great deal of mathematical knowledge). Thus, I&#8217;m not sure if I&#8217;ll be able to find anyone there willing to sign my keys or not. My <a href="http://www.jeffdarlington.com/jeffs-gpf-comicscom-gnupg-public-key/" title="Jeff’s GPF-Comics.Com GnuPG Public Key">public key</a> has a pitiful few number of signatures, mostly because I haven&#8217;t been able to meet face-to-face with like-minded cryptography nuts to add any. I&#8217;ve searched and searched and have yet to come up with anything in this vein officially or unofficially attached to SIGGRAPH.</p>
<p>So here&#8217;s a two-pronged appeal. First, if anyone <em>does</em> know of an official or unofficial key signing event somehow attached to SIGGRAPH or that might be going on in the area during that week, please let me know the details so I can somehow get involved. If there <em>isn&#8217;t</em> one going on, I&#8217;d love to see one organized. I&#8217;d consider organizing it myself if it weren&#8217;t for the fact that I&#8217;m not from San Diego and I don&#8217;t have a clue about where would be the best place to hold such an event, let alone how to get the word out. I&#8217;ve put my entry up on <a href="https://biglumber.com/x/web?sl=118" title="BigLumber.Com">BigLumber&#8217;s San Diego listing</a> in hopes that someone might see it, and at least one San Diego resident has expressed interest. If someone else might take the initiative to get things started, I&#8217;d be more than willing to promote it on the <a href="http://www.gpf-comics.com/" title="General Protection Fault">GPF</a> site.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jeffdarlington.com/2007/05/24/siggraph-key-signing-party/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Palm + WiFi + SSH + vi = geek2</title>
		<link>http://www.jeffdarlington.com/2007/03/01/palm-wifi-ssh-vi-geek2/</link>
		<comments>http://www.jeffdarlington.com/2007/03/01/palm-wifi-ssh-vi-geek2/#comments</comments>
		<pubDate>Thu, 01 Mar 2007 13:28:48 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Gadgets]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://208.78.96.240/?p=86</guid>
		<description><![CDATA[Last night, I was working on one part of implementing the GPF update changes previously mentioned. Since I&#8217;ve been having some trouble getting a response from the Keen Tech Crew (who I assume have been as busy with real life things as I have), I decided to try and implement a backup plan in case [...]]]></description>
			<content:encoded><![CDATA[<p>Last night, I was working on one part of implementing the GPF update changes <a href="http://www.jeffdarlington.com/2007/02/17/update-on-several-things/" title="Update on several things..., February 17th, 2007">previously mentioned</a>. Since I&#8217;ve been having some trouble getting a response from the Keen Tech Crew (who I assume have been as busy with real life things as I have), I decided to try and implement a backup plan in case they couldn&#8217;t get their part done by Monday. It&#8217;s all rather technical&#8230; but then you guys probably enjoy reading my technical ramblings from time to time. (Either that, or you ignore the <a href="http://www.jeffdarlington.com/category/technology/" title="Technology on Neural Core Dump">Technology category</a> altogether. Take your pick.) Unfortunately, it involves some intimate knowledge of <a href="http://www.keenspot.com/" title="Keenspot">Keenspot&#8217;s</a> update mechanism, Autokeen, which most of you probably don&#8217;t have.</p>
<p>Long story short, Autokeen uses templates that are parsed by a massive <a href="http://www.perl.org/" title="Perl">Perl</a> script that replaces certain &#8220;tags&#8221; with actual content.  For example, the tag <code>***todays_comics***</code> gets replaced with the necessary <a href="http://en.wikipedia.org/wiki/HTML" title="HTML article on Wikipedia">HTML</a> to display any images or text that have been designated as &#8220;comic&#8221; files. This obviously includes the images for the <strike>daily</strike>weekly strip, but it can also use text and even <a href="http://en.wikipedia.org/wiki/Adobe_Flash" title="Adobe Flash article on Wikipedia">Flash</a>. The <a href="http://www.gpf-comics.com/news/" title="GPF News">GPF News</a> is treated as a &#8220;comic&#8221; by Autokeen, even though it&#8217;s all text. Unfortunately, while there can be multiple &#8220;comics&#8221; under one account (for <a href="http://www.gpf-comics.com/" title="General Protection Fault">GPF</a>, they include the main comic, the News, the <a href="http://www.gpf-comics.com/sketches/" title="Jeff's Sketchbook (PREMIUM only)">Sketchbook</a>, the <a href="http://www.gpf-comics.com/hidef/" title="GPF High Definition Edition (PREMIUM only)">High-Def</a> archive, and a few others), the way these templates are used means that each &#8220;comic&#8221; is pretty much autonomous and self-contained. There are ways to get cross-comic content (like how I get the most recent News date and blurb automatically on the main and High-Def pages), but it&#8217;s definitely not trivial and it stretches Autokeen&#8217;s capabilities beyond their original intended functions. Autokeen is incredibly flexible, which is a credit to <a href="http://www.nukees.com/" title="Nukees">Darren Bleuel&#8217;s</a> design, but you can tell when you&#8217;ve taken it places it&#8217;s never been before.</p>
<p>Anyhoo, I was building a Perl script that would be run on a <a href="http://en.wikipedia.org/wiki/Crontab" title="crontab article on Wikipedia">cron</a> to do some of this cross-comic work for me, just in case my original pure-Autokeen design didn&#8217;t work as expected. I was connected to the GPF server via <a href="http://en.wikipedia.org/wiki/Secure_Shell" title="Secure Shell article on Wikipedia">SSH</a>, editing the file directly on the server via <a href="http://en.wikipedia.org/wiki/Vi" title="vi article on Wikipedia">vi</a>. I tested it pretty thoroughly and was happy with the results. By this point, it was getting late, Ben was already asleep in my wife&#8217;s arms, and we were both ready to go to bed. I shut down the laptop, we took Ben back to his crib, and while she brushed her teeth and performed other nighttime preparations, I climbed into bed.</p>
<p>It was then that I realized I had a fatal flaw in my code. (Nobody ever said inspiration was either punctual or convenient.) While it would successfully build some symbolic links on Monday, Wednesday, and Friday, I forgot to limit the code that <em>removes</em> the symbolic links on the other days of the week. Thus, every Tuesday, Thursday, and Saturday it would undo all the changes it made the days before. It was getting late and I had to get up early in the morning to head off to work. I didn&#8217;t have time to fire up the laptop again and I didn&#8217;t want to go into the office to log into one of those machines and leave my sweetie waiting up for me.</p>
<p>I grabbed my <a href="http://www.palm.com/us/products/mobilemanagers/lifedrive/" title="Official LifeDrive site on Palm.Com">LifeDrive</a> and fired up its <a href="http://en.wikipedia.org/wiki/Wi-Fi" title="Wi-Fi article on Wikipedia">WiFi</a> connection. I have a small SSH client for <a href="http://en.wikipedia.org/wiki/Palm_OS" title="Palm OS article on Wikipedia">Palm OS</a> called <a href="http://www.sealiesoftware.com/pssh/" title="Official pssh site">pssh</a> and used it to log into the GPF server. Now pssh is a wonderful little tool, but anyone who has used a <a href="http://en.wikipedia.org/wiki/Personal_digital_assistant" title="Personal digital assistant article on Wikipedia">PDA</a> probably knows that entering text into one can sometimes be&#8230; challenging. <a href="http://www.palm.com/" title="Palm">Palm</a> has used <a href="http://en.wikipedia.org/wiki/Graffiti_%28Palm_OS%29" title="Graffiti (Palm OS) article on Wikipedia">Graffiti</a> for years, but it can sometimes be a pain when working with applications that are very sensitive to text input mistakes (such as, say, vi). I elected to use the on-screen keyboard instead, and only switched to Graffiti when I discovered the keyboard didn&#8217;t have a pipe symbol (required to do a <a href="http://en.wikipedia.org/wiki/Boolean_expression" title="Boolean expression article on Wikipedia">boolean</a><a href="http://en.wikipedia.org/wiki/Boolean_expression" title="Boolean expression article on Wikipedia"> &#8220;or&#8221;</a> condition). Switching back and forth between edit and command modes was &lt;sarcasm&gt;fun&lt;/sarcasm&gt;, even though pssh includes a nice little &#8220;ESC&#8221; button on the screen for emulating the Escape key. Old hands at vi will know you can always hit ESC multiple times to ensure you&#8217;re no longer in edit mode and that you&#8217;re back in command mode, but it seems I left the volume on the Palm up pretty high from listening to <a href="http://en.wikipedia.org/wiki/MP3" title="MP3 article on Wikipedia">MP3s</a> earlier. The default &#8220;bell&#8221; was embarrassing loud, especially with a sleeping baby lying a few feet away.</p>
<p>It took some work, but I finally got the changes incorporated and saved and compiled the script. As soon as I logged off, I realized just out absurdly geeky the entire experience was. I probably could have done things faster if I had just walked into the office across the hall and fired up <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/" title="PuTTY SSH client">PuTTY</a>, but instead I decided to do things the hard way: working on a tiny little battery-powered device, connecting wirelessly, and fumbling with awkward text input mechanisms to use what is arguably one of the most complex text editors to make what would have been a ten-second change anywhere else. For some reason I found that obscenely amusing. You could probably care less, I&#8217;m sure, but I thought I&#8217;d share anyway.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jeffdarlington.com/2007/03/01/palm-wifi-ssh-vi-geek2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
