<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>Dev411 Blog: Category security</title>
  <subtitle type="html">John Wang on Technology</subtitle>
  <id>tag:www.dev411.com,2005:Typo</id>
  <generator uri="http://www.typosphere.org" version="4.0">Typo</generator>
  <link href="http://www.dev411.com/blog/xml/atom/category/feed.xml" rel="self" type="application/atom+xml"/>
  <link href="http://www.dev411.com/blog/tag/security" rel="alternate" type="text/html"/>
  <updated>2008-06-01T02:16:21-05:00</updated>
  <entry>
    <author>
      <name>John Wang</name>
    </author>
    <id>urn:uuid:9a57e834-b0c7-4638-a581-98f0dd8db411</id>
    <published>2008-05-30T02:20:00-05:00</published>
    <updated>2008-06-01T02:16:21-05:00</updated>
    <title type="html">Laptop Security and IronKey?</title>
    <link href="http://www.dev411.com/blog/2008/05/30/fingerprint-readers-and-ironkey" rel="alternate" type="text/html"/>
    <category term="security" scheme="http://www.dev411.com/blog/tag/security" label="security"/>
    <summary type="html">&lt;p&gt;This article was initially focused on the T61p's fingerprint reader and &lt;a href="http://www.ironkey.com"&gt;IronKey&lt;/a&gt;; however, I've expanded it to cover other options as well. Since the fingerprint reader has turned out to have little value in the way of security, I've turned my attention to the bulk encryption hard drives and encrypting file systems.&lt;/p&gt;

&lt;p&gt;I've been discussing IronKey; however, other hardware crypto tokens such as smart cards and USB tokens may also be solutions.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Fingerprint Reader&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;After playing with the ThinkPad T61p &lt;a href="http://www.thinkpads.com/fingerprint.htm"&gt;fingerprint reader&lt;/a&gt;, I got thinking whether it would be useful to tie an &lt;a href="https://www.ironkey.com/"&gt;IronKey USB key&lt;/a&gt; to the laptop fingerprint reader and/or require the IronKey to be present for the ThinkPad to boot. Furthermore, the laptop's hard drive could be encrypted by a key stored on the IronKey. Some interesting things to think about.&lt;/p&gt;

&lt;p&gt;Does anyone know how secure the ThinkPad fingerprint reader actually is? The &lt;a href="http://forum.notebookreview.com/showthread.php?t=192930"&gt;NotebookReview Forum&lt;/a&gt; has a thread fingerprint readers.&lt;/p&gt;</summary>
    <content type="html">&lt;p&gt;This article was initially focused on the T61p's fingerprint reader and &lt;a href="http://www.ironkey.com"&gt;IronKey&lt;/a&gt;; however, I've expanded it to cover other options as well. Since the fingerprint reader has turned out to have little value in the way of security, I've turned my attention to the bulk encryption hard drives and encrypting file systems.&lt;/p&gt;

&lt;p&gt;I've been discussing IronKey; however, other hardware crypto tokens such as smart cards and USB tokens may also be solutions.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Fingerprint Reader&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;After playing with the ThinkPad T61p &lt;a href="http://www.thinkpads.com/fingerprint.htm"&gt;fingerprint reader&lt;/a&gt;, I got thinking whether it would be useful to tie an &lt;a href="https://www.ironkey.com/"&gt;IronKey USB key&lt;/a&gt; to the laptop fingerprint reader and/or require the IronKey to be present for the ThinkPad to boot. Furthermore, the laptop's hard drive could be encrypted by a key stored on the IronKey. Some interesting things to think about.&lt;/p&gt;

&lt;p&gt;Does anyone know how secure the ThinkPad fingerprint reader actually is? The &lt;a href="http://forum.notebookreview.com/showthread.php?t=192930"&gt;NotebookReview Forum&lt;/a&gt; has a thread fingerprint readers.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Update:&lt;/b&gt; After a bit more reading, it appears that it's impossible to eliminate use of a password for the Administrator user as mentioned in &lt;a href="http://forum.notebookreview.com/showthread.php?t=146481"&gt;this thread&lt;/a&gt;. IBM references include &lt;a href="ftp://ftp.software.ibm.com/pc/pccbbs/thinkvantage_en/tfs56ug_en.pdf/"&gt;this&lt;/a&gt; and &lt;a href="ftp://ftp.software.ibm.com/pc/pccbbs/thinkvantage_en/css80dg.pdf/"&gt;this&lt;/a&gt;.

&lt;p&gt;&lt;b&gt;Encrypting Hard Drives&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Modern hard drives including the &lt;a href="http://www.hitachigst.com/tech/techlib.nsf/techdocs/A198FEF5A3B22F08862572D400656432/$file/7K200DS.pdf"&gt;Hitachi Travelstar 7K200&lt;/a&gt; and the &lt;a href="http://www.seagate.com/www/en-us/products/laptops/momentus/momentus_5400_fde.2/"&gt;Momentus&#174; 5400 FDE.2 Hard Drives&lt;/a&gt; include built-in bulk-encryption technology. Here is a &lt;a href="http://forum.notebookreview.com/showthread.php?t=193778"&gt;thread on the ThinkPad's bulk encryption hard drive&lt;/a&gt;. Moving the decryption key to a removable device like the IronKey seems to make a lot of sense. This way if the laptop/hard drive was lost, it would be useless without the IronKey and the IronKey password. Is something like this in the future for laptop security? I wasn't able to find this feature on their website but it seems like an interesting option.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Encrypting File Systems&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Microsoft has been offering their Encrypting File System (EFS) offering for sometime and has redesigned for Vista. Linux users also have an option with &lt;a href="http://www.arg0.net/encfs"&gt;EncFS&lt;/a&gt; which is licensed under GPL. &lt;a href="http://www.pgp.com/products/wholediskencryption/"&gt;PGP Whole Disk Encryption&lt;/a&gt; is yet another option. Microsoft EFS can use keys stored in smart cards, and presumably the IronKey. I'm still not sure how popular Microsoft EFS is and whether you need a Microsoft PKI deployment or not.&lt;/p&gt;

&lt;p&gt;With the growing number of laptop security solutions, what is the current best option and what would be the ideal option for the future? I have to admit the idea of using a USB crypto token to decrypt a hard drive seems attractive.&lt;/p&gt;</content>
  </entry>
  <entry>
    <author>
      <name>John Wang</name>
    </author>
    <id>urn:uuid:1acd4e66-6803-4f72-b9ce-69f7aa92ebe2</id>
    <published>2006-08-10T12:20:00-05:00</published>
    <updated>2007-06-16T12:30:24-05:00</updated>
    <title type="html">Rails 1.1.4 LOAD_PATH vulnerability</title>
    <link href="http://www.dev411.com/blog/2006/08/10/rails-1-1-4-load_path-vulnerability" rel="alternate" type="text/html"/>
    <category term="security" scheme="http://www.dev411.com/blog/tag/security" label="security"/>
    <category term="rails" scheme="http://www.dev411.com/blog/tag/rails" label="rails"/>
    <summary type="html">&lt;p&gt;A couple of people have blogged about their use of the "elite hacking tool &lt;span class="fix"&gt;diff -r&lt;/span&gt;" to identify the problem solved by the &lt;a href="http://weblog.rubyonrails.com/2006/8/9/rails-1-1-5-mandatory-security-patch-and-other-tidbits"&gt;Rails 1.1.5 Mandatory Mystery Patch&lt;/a&gt;. The problem is that Rails accepted LOAD_PATH as a HTTP request header with any file upload so a hacker could upload ruby controllers and then execute them by accessing the newly exposed URIs. This is discussed by &lt;a href="http://blog.koehntopp.de/archives/1367-Ruby-On-Rails-Mandatory-Mystery-Patch.html"&gt;Kristian K&#246;hntopp&lt;/a&gt; and &lt;a href="http://blog.evanweaver.com/articles/2006/08/10/explanation-of-the-rails-security-vulnerability-in-1-1-4-others"&gt;Evan Weaver&lt;/a&gt;.&lt;/p&gt;</summary>
    <content type="html">&lt;p&gt;A couple of people have blogged about their use of the "elite hacking tool &lt;span class="fix"&gt;diff -r&lt;/span&gt;" to identify the problem solved by the &lt;a href="http://weblog.rubyonrails.com/2006/8/9/rails-1-1-5-mandatory-security-patch-and-other-tidbits"&gt;Rails 1.1.5 Mandatory Mystery Patch&lt;/a&gt;. The problem is that Rails accepted LOAD_PATH as a HTTP request header with any file upload so a hacker could upload ruby controllers and then execute them by accessing the newly exposed URIs. This is discussed by &lt;a href="http://blog.koehntopp.de/archives/1367-Ruby-On-Rails-Mandatory-Mystery-Patch.html"&gt;Kristian K&#246;hntopp&lt;/a&gt; and &lt;a href="http://blog.evanweaver.com/articles/2006/08/10/explanation-of-the-rails-security-vulnerability-in-1-1-4-others"&gt;Evan Weaver&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Brian Hogan reports the 1.1.5 fix does not work with Mongrel and &lt;a href="http://wrath.rubyonrails.org/pipermail/rails/2006-August/059976.html"&gt;Sander Land's fix&lt;/a&gt; is needed. The issue is being discussed on &lt;a href="http://www.ruby-forum.com/topic/76671"&gt;Ruby Forums&lt;/a&gt; and here's the latest patch':&lt;/p&gt;

&lt;pre&gt;--- routing.rb.orig     2006-08-10 12:20:12.830325000 -0500
+++ routing.rb  2006-08-10 12:20:26.043147000 -0500
@@ -273,7 +273,7 @@
             $LOAD_PATH.select do |base|
               base = File.expand_path(base)
               extended_root = File.expand_path(RAILS_ROOT)
-
base.match(/\A#{Regexp.escape(extended_root)}\/*#{file_kinds(:lib) *
'|'}/) || base =~ %r{rails-[\d.]+/builtin}
+
base.match(/\A#{Regexp.escape(extended_root)}\/+(#{file_kinds(:lib) *
'|'})/) || base =~ %r{rails-[\d.]+/builtin}
             end
           else
             $LOAD_PATH&lt;/pre&gt;

&lt;!--div class="quote_simple"&gt;Fix:&lt;br /&gt;
actionpack-1.12.4\lib\action_controller\routing.rb: 276&lt;br /&gt;
CHANGE&lt;br /&gt;
base.match(/\A#{Regexp.escape(extended_root)}\/*#{file_kinds(:lib) * 
'|'}/) || base =~ %r{rails-[\d.]+/builtin}&lt;br /&gt;
TO&lt;br /&gt;
base.match(/\A#{Regexp.escape(extended_root)}\/*(?:#{file_kinds(:lib) * 
'|'})/) || base =~ %r{rails-[\d.]+/builtin}&lt;/div--&gt;

&lt;p&gt;37Signals is getting some flack for keeping this a secret when it's so easy to discover what the issue is. Hopefully they'll learn their lesson. They'd also come across as more professional without things like this: &lt;a href="http://www.flickr.com/photos/planetargon/127984254/"&gt;http://www.flickr.com/photos/planetargon/127984254/&lt;/a&gt;.&lt;/p&gt;</content>
  </entry>
  <entry>
    <author>
      <name>John Wang</name>
    </author>
    <id>urn:uuid:31fd117d-06ec-41c9-8dba-f81073ad0d58</id>
    <published>2006-08-10T10:37:00-05:00</published>
    <updated>2007-06-16T12:30:24-05:00</updated>
    <title type="html">Rails 1.1.5 routing vulnerability</title>
    <link href="http://www.dev411.com/blog/2006/08/10/rails-1-1-5-routing-vulnerability" rel="alternate" type="text/html"/>
    <category term="security" scheme="http://www.dev411.com/blog/tag/security" label="security"/>
    <category term="rails" scheme="http://www.dev411.com/blog/tag/rails" label="rails"/>
    <summary type="html">&lt;p&gt;People are reporting a &lt;a href="http://www.ruby-forum.com/topic/76671"&gt;Rails 1.1.5 routing vulerability&lt;/a&gt; where accessing certain URIs will crash Rails. The problem has been reported on Mongrel, WeBrick and FastCGI. &lt;a href="http://www.bofh.org.uk/articles/2006/08/10/working-round-the-rails-showstopper"&gt;Piers Cawley&lt;/a&gt; is working on an explicit routes fix for Typo and discusses the issue on his blog. This has not been mentioned on the &lt;a href="http://weblog.rubyonrails.com"&gt;RoR blog&lt;/a&gt; yet. Good thing for public forums.&lt;/p&gt;</summary>
    <content type="html">&lt;p&gt;People are reporting a &lt;a href="http://www.ruby-forum.com/topic/76671"&gt;Rails 1.1.5 routing vulerability&lt;/a&gt; where accessing certain URIs will crash Rails. The problem has been reported on Mongrel, WeBrick and FastCGI. &lt;a href="http://www.bofh.org.uk/articles/2006/08/10/working-round-the-rails-showstopper"&gt;Piers Cawley&lt;/a&gt; is working on an explicit routes fix for Typo and discusses the issue on his blog. This has not been mentioned on the &lt;a href="http://weblog.rubyonrails.com"&gt;RoR blog&lt;/a&gt; yet. Good thing for public forums.&lt;/p&gt;

&lt;p&gt;While this is being fixed you can take steps to protect your own apps by ensuring only valid urls are allowed to make it to your Rails app.&lt;/p&gt;

&lt;p&gt;Some problem URIs that have been mentioned include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;active_support/dependencies&lt;/li&gt;
&lt;li&gt;breakpoint_client&lt;/li&gt;
&lt;li&gt;builder/blankslate&lt;/li&gt;
&lt;li&gt;cgi&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I've added some mod_rewrite rules for now but I'm hoping there will be a better solution soon.&lt;/p&gt;

&lt;p&gt;If you are using 1.1.5 with Mongrel, see &lt;a href="http://www.dev411.com/blog/2006/08/10/rails-1-1-4-load_path-vulnerability"&gt;Rails 1.1.4 LOAD_PATH vulernability&lt;/a&gt; for a patch to make them work together.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;This is now mentioned &lt;a href="http://weblog.rubyonrails.org/2006/8/10/rails-1-1-6-backports-and-full-disclosure"&gt;on the RoR blog&lt;/a&gt; with their recommended mod_rewrite fixes for Apache and lighttpd if you can't upgrade to 1.1.6 right away:&lt;/p&gt;

&lt;p&gt;Apache:&lt;/p&gt;

&lt;p&gt;RewriteRule ^(app|components|config|db|doc|lib|log|public|script|test|tmp|vendor)/ - [F]&lt;/p&gt;

&lt;p&gt;lighttpd:&lt;/p&gt;

&lt;p&gt;url.rewrite-once = ( "^/(app|components|config|db|doc|lib|log|public|script|test|tmp|vendor)/" =&gt; "index.html" )&lt;/p&gt;
</content>
  </entry>
  <entry>
    <author>
      <name>John Wang</name>
    </author>
    <id>urn:uuid:9e4a4521-59c8-4dd7-b698-e201f4eb144a</id>
    <published>2006-08-10T01:14:00-05:00</published>
    <updated>2007-06-16T12:30:24-05:00</updated>
    <title type="html">Upgrading Typo 4.0.0 to Rails 1.1.5/1.1.6</title>
    <link href="http://www.dev411.com/blog/2006/08/10/upgrading-typo-4-0-0-to-rails-1-1-5" rel="alternate" type="text/html"/>
    <category term="security" scheme="http://www.dev411.com/blog/tag/security" label="security"/>
    <category term="typo" scheme="http://www.dev411.com/blog/tag/typo" label="typo"/>
    <category term="rails" scheme="http://www.dev411.com/blog/tag/rails" label="rails"/>
    <summary type="html">&lt;p&gt;It was recently announced that &lt;a href="http://weblog.rubyonrails.org/2006/8/9/rails-1-1-5-mandatory-security-patch-and-other-tidbits"&gt;Rails 1.1.0, 1.1.1, 1.1.2, and 1.1.4. have a very serious security hole&lt;/a&gt;. Although the RoR blog hasn't discussed exactly what the hole is, it has been rumored to involve uploading of .rb files to execute arbitrary code on the server (UPDATE: &lt;a href="http://www.dev411.com/blog/2006/08/10/rails-1-1-4-load_path-vulernability"&gt;now confirmed&lt;/a&gt;). Typo only allows file uploads by administrators so certain applications may be somewhat safer. (UPDATE: Running arbitrary code was fixed in 1.1.5 however you could still crash it. 1.1.6 has been released to fix these lingering bugs. Just change 1.1.5 to 1.1.6 below).&lt;/p&gt;</summary>
    <content type="html">&lt;p&gt;It was recently announced that &lt;a href="http://weblog.rubyonrails.org/2006/8/9/rails-1-1-5-mandatory-security-patch-and-other-tidbits"&gt;Rails 1.1.0, 1.1.1, 1.1.2, and 1.1.4. have a very serious security hole&lt;/a&gt;. Although the RoR blog hasn't discussed exactly what the hole is, it has been rumored to involve uploading of .rb files to execute arbitrary code on the server (UPDATE: &lt;a href="http://www.dev411.com/blog/2006/08/10/rails-1-1-4-load_path-vulernability"&gt;now confirmed&lt;/a&gt;). Typo only allows file uploads by administrators so certain applications may be somewhat safer. (UPDATE: Running arbitrary code was fixed in 1.1.5 however you could still crash it. 1.1.6 has been released to fix these lingering bugs. Just change 1.1.5 to 1.1.6 below).&lt;/p&gt;

&lt;p&gt;Scott Laird is working on releasing Typo 4.0.1 (&lt;a href="http://scottstuff.net/blog/articles/2006/08/10/typo-4-0-1"&gt;now released&lt;/a&gt;) which will include Rails 1.1.5 but until then, or if you don't want to upgrade Typo, you can simply upgrade the Rails used by Typo by installing the 1.1.5 &lt;span class="fix"&gt;vendor/rails&lt;/span&gt; directory over the existing one. Here are some steps:&lt;/p&gt;

&lt;pre&gt;$ cd /tmp
$ wget http://rubyforge.org/frs/download.php/12258/rails-1.1.5.tgz
$ tar -zxf rails-1.1.5.tgz
$ cd rails/vendor
$ tar -zcf rails-1.1.5-vendor-rails.tgz rails
$ mv rails-1.1.5-vendor-rails.tgz /path/to/typo/vendor
$ cd /path/to/typo/vendor
$ tar -zxf rails-1.1.5-vendor-rails.tgz&lt;/pre&gt;
&lt;p&gt;To verify that Rails has been updated you can view the &lt;span class="fix"&gt;version.rb&lt;/span&gt; file which should now give you the following:&lt;/p&gt;
&lt;pre&gt;$ cat rails/railties/lib/rails/version.rb
module Rails
  module VERSION #:nodoc:
    MAJOR = 1
    MINOR = 1
    TINY  = 5

    STRING = [MAJOR, MINOR, TINY].join('.')
  end
end&lt;/pre&gt;

&lt;p&gt;You'll probably want to back up the existing &lt;span class="fix"&gt;vendor/rails&lt;/span&gt; directory as this will extract the 1.1.5 files over it. If you simply swap &lt;span class="fix"&gt;vendor&lt;/span&gt; directories, you'll get a lot of missing requirements errors (e.g. redcloth, bluecloth, rubypants, uuidtools, etc.) because rails isn't the only thing installed under &lt;span class="fix"&gt;vendor&lt;/span&gt; for Typo.&lt;/p&gt;</content>
  </entry>
  <entry>
    <author>
      <name>John Wang</name>
    </author>
    <id>urn:uuid:310f8f2393192a4bf6885b036d510d30</id>
    <published>2006-07-24T20:40:00-05:00</published>
    <updated>2007-06-16T12:30:23-05:00</updated>
    <title type="html">JSON XSS exploit: don't use text/html</title>
    <link href="http://www.dev411.com/blog/2006/07/24/json-xss-exploit-dont-use-text-html" rel="alternate" type="text/html"/>
    <category term="json" scheme="http://www.dev411.com/blog/tag/json" label="json"/>
    <category term="catalyst" scheme="http://www.dev411.com/blog/tag/catalyst" label="catalyst"/>
    <category term="xss" scheme="http://www.dev411.com/blog/tag/xss" label="xss"/>
    <category term="security" scheme="http://www.dev411.com/blog/tag/security" label="security"/>
    <category term="dojo" scheme="http://www.dev411.com/blog/tag/dojo" label="dojo"/>
    <category term="ajax" scheme="http://www.dev411.com/blog/tag/ajax" label="ajax"/>
    <summary type="html">&lt;p&gt;&lt;a href="http://jibbering.com/blog/?p=514"&gt;Jim Ley reports&lt;/a&gt; on the &lt;a href="http://ha.ckers.org/blog/20060704/cross-site-scripting-vulnerability-in-google/"&gt;Google JSON XSS exploit&lt;/a&gt; with example code and screen shots of stealing information from the AdSense site. The moral of the story is don't use &lt;span class="fix"&gt;text/html&lt;/span&gt; for the MIME type when returning JSON, use &lt;span class="fix"&gt;application/json&lt;/span&gt; which is an &lt;a href="http://www.rfc-editor.org/rfc/rfc4627.txt"&gt;IETF standard (RFC 4627)&lt;/a&gt; now. Most browsers should handle &lt;span class="fix"&gt;application/json&lt;/span&gt; fine, however Opera may have problems and you may want to use &lt;span class="fix"&gt;application/x-javascript&lt;/span&gt; for that. Something to remember even if your AJAX code/library doesn't care about the MIME type returned by the server, e.g. Dojo.&lt;/p&gt;

&lt;p&gt;If you are using Catalyst and Catalyst::View::JSON, your JSON response will automatically be set to &lt;span class="fix"&gt;application/json&lt;/span&gt; for all user agents except Opera (which gets &lt;span class="fix"&gt;application/x-javascript&lt;/span&gt;) so you're already safe(r).&lt;/p&gt;</summary>
    <content type="html">&lt;p&gt;&lt;a href="http://jibbering.com/blog/?p=514"&gt;Jim Ley reports&lt;/a&gt; on the &lt;a href="http://ha.ckers.org/blog/20060704/cross-site-scripting-vulnerability-in-google/"&gt;Google JSON XSS exploit&lt;/a&gt; with example code and screen shots of stealing information from the AdSense site. The moral of the story is don't use &lt;span class="fix"&gt;text/html&lt;/span&gt; for the MIME type when returning JSON, use &lt;span class="fix"&gt;application/json&lt;/span&gt; which is an &lt;a href="http://www.rfc-editor.org/rfc/rfc4627.txt"&gt;IETF standard (RFC 4627)&lt;/a&gt; now. Most browsers should handle &lt;span class="fix"&gt;application/json&lt;/span&gt; fine, however Opera may have problems and you may want to use &lt;span class="fix"&gt;application/x-javascript&lt;/span&gt; for that. Something to remember even if your AJAX code/library doesn't care about the MIME type returned by the server, e.g. Dojo.&lt;/p&gt;

&lt;p&gt;If you are using Catalyst and Catalyst::View::JSON, your JSON response will automatically be set to &lt;span class="fix"&gt;application/json&lt;/span&gt; for all user agents except Opera (which gets &lt;span class="fix"&gt;application/x-javascript&lt;/span&gt;) so you're already safe(r).&lt;/p&gt;

</content>
  </entry>
</feed>

