<?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/tag/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>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>WinHasher 1.3</title>
		<link>http://www.jeffdarlington.com/2008/06/30/winhasher-13/</link>
		<comments>http://www.jeffdarlington.com/2008/06/30/winhasher-13/#comments</comments>
		<pubDate>Mon, 30 Jun 2008 08:59:11 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[WinHasher]]></category>

		<guid isPermaLink="false">http://www.jeffdarlington.com/?p=145</guid>
		<description><![CDATA[For both of you out there who care, WinHasher has now been bumped to version 1.3. The changes are very minor, so there&#8217;s no need to upgrade unless you find the following two new features useful: There&#8217;s now a drop-down box to choose between hexadecimal output and Base64 (RFC 2045, although without line wrapping). I [...]]]></description>
			<content:encoded><![CDATA[<p>For both of you out there who care, <a title="GPF Downloads: WinHasher" href="http://www.gpf-comics.com/dl/winhasher/">WinHasher</a> has now been bumped to version 1.3. The changes are very minor, so there&#8217;s no need to upgrade unless you find the following two new features useful:</p>
<ul>
<li>There&#8217;s now a drop-down box to choose between <a title="Hexadecimal article on Wikipedia" href="http://en.wikipedia.org/wiki/Hexadecimal">hexadecimal</a> output and <a title="Base64 article on Wikipedia" href="http://en.wikipedia.org/wiki/Base64">Base64</a> (<a title="RFC 2045 - Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies" href="http://tools.ietf.org/html/rfc2045">RFC 2045</a>, although without line wrapping). I personally like using Base64 because it&#8217;s more compact than hex and more &#8220;obscure-looking&#8221;; even non-coders are familiar with hex, seeing it in error messages all the time, but are less familiar with Base64, which looks more like &#8220;random noise&#8221;. The default output is still hex, so you only need to switch modes if you really find Base64 more useful.</li>
<li>There&#8217;s now a tab in the GUI to hash arbitrary text. I added this feature because there was an extension to <a title="Firefox" href="http://www.mozilla.com/firefox/">Firefox</a> that I used all the time to do this—which I used frequently to generate &#8220;random-looking&#8221; passwords by hashing simpler plain text and using the hash as the &#8220;real&#8221; password—but the extension hasn&#8217;t been updated in forever and is no longer working in Firefox 3. So to keep myself from getting locked out of the accounts where I used hashed passwords, I threw this feature in WinHasher. The backbone was already there, so all that needed to be added was a GUI.  There&#8217;s also an <a title="Character encoding article on Wikipedia" href="http://en.wikipedia.org/wiki/Character_encoding">encoding</a> drop-down box that lets you change the text encoding if you so desire/need. To be honest, I don&#8217;t think it&#8217;s really necessary because I think <a title="Microsoft .NET Framework article on Wikipedia" href="http://en.wikipedia.org/wiki/.NET_Framework">.NET</a> uses <a title="Unicode article on Wikipedia" href="http://en.wikipedia.org/wiki/Unicode">Unicode</a> internally all the time, but it does have a nice side-effect: if you enter text in one encoding and change the encoding setting to something radically different (say you enter Western European Windows text but change the encoding to IBM <a title="Extended Binary Coded Decimal Interchange Code article on Wikipedia" href="http://en.wikipedia.org/wiki/Extended_Binary_Coded_Decimal_Interchange_Code">EBCDIC</a> Japanese), you&#8217;ll end up with a very different hash than you would have had if you used the &#8220;right&#8221; encoding. This isn&#8217;t encryption by any means as it could be easily reverse engineered if you knew what encodings were used, but it does significantly scramble things to the point that it makes it much harder to figure out exactly what you did.</li>
</ul>
<p>I had originally started adding support for <a title="HMAC article on Wikipedia" href="http://en.wikipedia.org/wiki/HMAC">HMAC</a> signed hashes but have abandoned that for now. If there&#8217;s anyone out there who might actually find that useful, drop me a line and I&#8217;ll revisit the code to see what I might be able to add. Downloads can be found at the first link above.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jeffdarlington.com/2008/06/30/winhasher-13/feed/</wfw:commentRss>
		<slash:comments>0</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>WinHasher 1.2</title>
		<link>http://www.jeffdarlington.com/2007/11/30/winhasher-12/</link>
		<comments>http://www.jeffdarlington.com/2007/11/30/winhasher-12/#comments</comments>
		<pubDate>Sat, 01 Dec 2007 02:10:04 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[WinHasher]]></category>

		<guid isPermaLink="false">http://www.jeffdarlington.com/2007/11/30/winhasher-12/</guid>
		<description><![CDATA[I just can&#8217;t leave well enough alone. I&#8217;ve been mildly annoyed with the &#8220;hash in progress&#8221; and progress dialogs in WinHasher 1.1. The original idea was to use System.ComponentModel.BackgroundWorker to easily multi-thread very large hashes (say of CD or DVD ISOs or uncompressed video files). This had two benefits: (1) it allows the user to [...]]]></description>
			<content:encoded><![CDATA[<p>I just can&#8217;t leave well enough alone. I&#8217;ve been mildly annoyed with the &#8220;hash in progress&#8221; and progress dialogs in <a href="http://www.gpf-comics.com/dl/winhasher/" title="GPF Downloads: WinHasher">WinHasher</a> 1.1. The original idea was to use <code>System.ComponentModel.BackgroundWorker</code> to easily multi-thread very large hashes (say of CD or DVD ISOs or uncompressed video files). This had two benefits: (1) it allows the user to cancel a hash in progress and (2) gives us an opportunity to update the GUI while the hashing takes place in the background, meaning we can inform the user of the progress. Unfortunately, I couldn&#8217;t find a method right away to determine the progress of an individual hash. <code>System.Security.Cryptography.HashAlgorithm.ComputeHash()</code> by default takes a byte array or file stream and chugs the whole thing at once, spitting out the hash as a result. There&#8217;s no way with this method to determine how far along you are.</p>
<p>However, if you look at the guts of <code>ComputeHash()</code>, you&#8217;ll find it reads in chunks of bytes into a buffer, then calls two methods: <code>TransformBlock()</code> for every chunk but the last, and <code>TransformFinalBlock()</code> to hash the last chunk and finalize the hash. The result can then be obtained from the <code>HashAlgorithm.Hash</code> property. If we bypass the convenience of the single <code>ComputeHash()</code> method call, you can read chunks of bytes from the buffer, feed it to the <code>Transform...()</code> methods, and keep track of how many bytes have been read so far. Since we already know how big the file is from the start (<code>System.IO.FileStream.Length</code>), it&#8217;s trivial to calculate a percentage complete. Want the progress of a multi-file comparison? Sum the lengths of all files in the batch, then keep track of the total number of bytes hashed along the way.</p>
<p>I&#8217;ve bumped WinHasher to version 1.2. It should be available on the official site by tomorrow morning.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jeffdarlington.com/2007/11/30/winhasher-12/feed/</wfw:commentRss>
		<slash:comments>0</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>WinHasher 1.0 and Mandelbrot Madness! 2.0</title>
		<link>http://www.jeffdarlington.com/2007/09/26/winhasher-10-and-mandelbrot-madness-20/</link>
		<comments>http://www.jeffdarlington.com/2007/09/26/winhasher-10-and-mandelbrot-madness-20/#comments</comments>
		<pubDate>Wed, 26 Sep 2007 20:07:55 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[fractal]]></category>
		<category><![CDATA[Mandelbrot Madness]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[WinHasher]]></category>

		<guid isPermaLink="false">http://www.jeffdarlington.com/2007/09/26/winhasher-10-and-mandelbrot-madness-20/</guid>
		<description><![CDATA[I&#8217;m not sure if anyone cares, but I&#8217;ve been doing a tiny bit of dabbling in releasing Open Source software lately. Since I don&#8217;t particularly care to announce them on the GPF News (it isn&#8217;t, after all, GPF news), I&#8217;ll announce them here. For those of you who might complain that working on these has [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m not sure if anyone cares, but I&#8217;ve been doing a tiny bit of dabbling in releasing <a href="http://www.opensource.org/" title="The Open Source Initiative">Open Source</a> software lately. Since I don&#8217;t particularly care to announce them on the <a href="http://www.gpf-comics.com/news/" title="GPF News">GPF News</a> (it isn&#8217;t, after all, <a href="http://www.gpf-comics.com/" title="General Protection Fault">GPF</a> news), I&#8217;ll announce them here. For those of you who might complain that working on these has taken precious time away from the comic, fret not. The tiny bit of time I&#8217;ve been able to squeeze in here and there to work on these have been during periods when working on the comic would be impossible, so there&#8217;s no way for there to be any conflict.</p>
<p>The first one I&#8217;ll announce is the most recent. <a href="http://www.gpf-comics.com/dl/winhasher/" title="GPF: WinHasher">WinHasher</a> is a <a href="http://msdn2.microsoft.com/en-us/netframework/aa731542.aspx" title="Microsoft .NET Framework 2.0">Microsoft .NET Framework 2.0</a> application for generating <a href="http://en.wikipedia.org/wiki/Cryptographic_hash_function" title="Cryptographic hash function article on Wikipedia">cryptographic hashes</a> of files. It is both a Windows <a href="http://en.wikipedia.org/wiki/Graphical_user_interface" title="Graphical user interface article on Wikipedia">GUI</a> applet and a console (command line) program, and it operates in two possible modes. The first mode generates the hash of a single file, which you can then use to verify a download or check to see if a file has been tampered with. The second mode takes the hashes of multiple files and compares them; in this way, you can see if two or more files have the same binary contents regardless of their names, locations, and time stamps. The Windows app supports drag-and-drop functionality, and the installer lets you also build shortcuts in your Windows Explorer &#8220;Send To&#8221; context menu so you can just right-click a file and get its hash.</p>
<p>So why did I build this? Well, the full details are on the site, but the quick version is that I&#8217;ve grown tired of not being able to validate the hashes of downloaded files because Windows doesn&#8217;t have a built-in hashing program. Linux and the other free UNIX clones have <a href="http://www.openssl.org/" title="OpenSSL">OpenSSL</a>; heck, even Mac OS has OpenSSL under the hood. Not Windows&#8230; of course. So instead of downloading a file on a Windows machine, copying it to the Linux box, validating the hash, and moving it back (or worse, just not even validating the hash at all and taking my chances), I hacked together this little program. Then I thought it might be useful enough to share, so I did. If you find it useful, please let me know.</p>
<p>For the really technically inclined out there, most of the hashes are built-in to .NET 2.0, so this was obscenely easy to implement. In fact, 2.0 has an abstract hash algorithm class (<code>System.Security.Cryptography.HashAlgorithm</code>) that all of the built-in hashes implement. The two non-standard hashes, <a href="http://en.wikipedia.org/wiki/Whirlpool_%28cryptography%29" title="Whirlpool (cryptography) article on Wikipedia">Whirlpool</a> and <a href="http://en.wikipedia.org/wiki/Tiger_%28hash%29" title="Tiger (hash) article on Wikipedia">Tiger</a>, were taken from the <a href="http://www.bouncycastle.org/csharp/" title="The Legion of the Bouncy Castle Crypto API">Legion of the Bouncy Castle Crypto API</a>, which is actually .NET 1.1 based. I (rather crudely) ported these classes to be subclasses of <code>HashAlgorithm</code>, so they can technically be used as a drop-in replacement of any .NET 2.0 hash. I plan to add additional hashes over time, provided that (a) the original source code is free and (b) I can port it to be a <code>HashAlgorithm</code> subclass.</p>
<p>The second program to mention is actually a bit of an oldie now. (I actually released it back in June.) The <a href="http://www.gpf-comics.com/dl/mandel/win32.html" title="Mandelbrot Madness! .NET Version">Windows version of <em>Mandelbrot Madness!</em></a> is back, also in a .NET 2.0 edition. I wrote the original in <a href="http://msdn.microsoft.com/visualc/" title="Microsoft Visual C++">Visual C++</a> 4.x, but have long since lost the source code. Then the <a href="http://www.gpf-comics.com/dl/mandel/java/" title="Mandelbrot Madness JAVA!">Java version</a> came into being and rapidly surpassed the Windows version, leaving it to suffer from bit rot. Both eventually languished as I lost time to work on them. Well, in December of 2005, I released the not-quite-complete-but-close-enough 4.0 version of <em>Mandelbrot Madness JAVA!,</em> declaring it abandoned. It always bugged me that I never went back and revisited the Visual C++ code, but without the source I was stuck.</p>
<p>Well, to make a long story short, my <a href="http://www.jeffdarlington.com/2006/05/25/homeward-bound/" title="Homeward Bound, May 25th, 2006">new job</a> had me <a href="http://www.jeffdarlington.com/2006/11/13/sometimes-it-makes-me-feel-dirty/" title="Sometimes it makes me feel dirty..., November 13th, 2006">learning a new programming language: C#</a>. That had me programing Web sites, but I knew you could also do Windows GUI apps in it as well. So somewhere down the line I got a wild hair and started the agonizing work of porting the Java code from the last version of <em>MMJ!</em> to C#. Actually, Java and C# are similar enough that the porting work wasn&#8217;t all that hard. Not only is <em>MM!</em> 2.0 now pretty much identical in functionality to <em>MMJ!</em> 4.0, but I introduced a number of new features that I hope to eventually port back to the Java version. While I still prefer the platform independence of Java, I&#8217;ll readily admit that the .NET version is a lot faster on Windows. I think that anyone on that platform that has actually bothered to play with the Java version (both of you) should make the switch. Anyone still using the decrepit old 1.0 version of Win32 <em>MM!</em> should enter the 21st century and upgrade too.</p>
<p>Both programs have been released under <a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html" title="GNU General Public License, version 2">version 2 of the GPL</a> (haven&#8217;t had time to really review <a href="http://www.gnu.org/copyleft/gpl.html" title="GNU General Public License">version 3</a> yet), so the sources are also available. If you have any suggested changes, feel free to pass them along and I might incorporate them into the official builds (giving you credit, of course).</p>]]></content:encoded>
			<wfw:commentRss>http://www.jeffdarlington.com/2007/09/26/winhasher-10-and-mandelbrot-madness-20/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
