<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Alice, Bob and Mallory: Category Security</title>
    <link>http://alicebobandmallory.blogdns.com/articles/category/security</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>security and obscurity</description>
    <item>
      <title>A case for using only three different digits in keypad codes</title>
      <description>&lt;p&gt;Keypads have obvious security problems and keypads accepting a stream of digits with no # or enter in between, while checking for the four digit long code, are even worse.&lt;/p&gt;

&lt;p&gt;The important part is to not leak the digits in the code &lt;a href="http://www.schneier.com/blog/archives/2009/07/information_lea_1.html"&gt;by wear&lt;/a&gt; or intentional markings because if they leak it's suddenly very far from 10000 combinations.&lt;/p&gt;

&lt;p&gt;If the "lock picker" only knows that the code contains four digits there are 10000 combinations. Keypads accepting a stream of digits can then be opened in a maximum of 10003 keystrokes using the &lt;a href="http://en.wikipedia.org/wiki/De_Bruijn_sequence#Uses"&gt;De
Bruijn sequence&lt;/a&gt;. That is still quite a lot.&lt;/p&gt;

&lt;p&gt;Below is a Ruby implementation of the &lt;a href="http://www.hakank.org/comb/debruijn.cgi"&gt;De
Bruijn sequence&lt;/a&gt;.&lt;/p&gt;

&lt;table class="CodeRay"&gt;&lt;tr&gt;
  &lt;td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;13&lt;tt&gt;
&lt;/tt&gt;14&lt;tt&gt;
&lt;/tt&gt;15&lt;tt&gt;
&lt;/tt&gt;16&lt;tt&gt;
&lt;/tt&gt;17&lt;tt&gt;
&lt;/tt&gt;18&lt;tt&gt;
&lt;/tt&gt;19&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;20&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;21&lt;tt&gt;
&lt;/tt&gt;22&lt;tt&gt;
&lt;/tt&gt;23&lt;tt&gt;
&lt;/tt&gt;24&lt;tt&gt;
&lt;/tt&gt;25&lt;tt&gt;
&lt;/tt&gt;26&lt;tt&gt;
&lt;/tt&gt;27&lt;tt&gt;
&lt;/tt&gt;28&lt;tt&gt;
&lt;/tt&gt;29&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;30&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;31&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class="code"&gt;&lt;pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }"&gt;&lt;span style="color:#666"&gt;# De Bruijn sequence&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span style="color:#666"&gt;# Original implementation by Frank Ruskey (1994)&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span style="color:#666"&gt;# translated to C by Joe Sawada&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span style="color:#666"&gt;# and further translated to Ruby by Jonas Elfström (2009)&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span style="color:#33B"&gt;@n&lt;/span&gt;=&lt;span style="color:#00D;font-weight:bold"&gt;4&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span style="color:#33B"&gt;@k&lt;/span&gt;=&lt;span style="color:#00D;font-weight:bold"&gt;10&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span style="color:#33B"&gt;@a&lt;/span&gt;=[&lt;span style="color:#00D;font-weight:bold"&gt;0&lt;/span&gt;]&lt;tt&gt;
&lt;/tt&gt;&lt;span style="color:#33B"&gt;@sequence&lt;/span&gt;=[]&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span style="color:#080;font-weight:bold"&gt;def&lt;/span&gt; &lt;span style="color:#06B;font-weight:bold"&gt;debruijn&lt;/span&gt;(t, p, alike)&lt;tt&gt;
&lt;/tt&gt;  &lt;span style="color:#080;font-weight:bold"&gt;if&lt;/span&gt; t&amp;gt;&lt;span style="color:#33B"&gt;@n&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span style="color:#080;font-weight:bold"&gt;if&lt;/span&gt; &lt;span style="color:#33B"&gt;@n&lt;/span&gt;%p==&lt;span style="color:#00D;font-weight:bold"&gt;0&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      &lt;span style="color:#00D;font-weight:bold"&gt;1&lt;/span&gt;.upto(p) {|j| &lt;span style="color:#33B"&gt;@sequence&lt;/span&gt;&amp;lt;&amp;lt;&lt;span style="color:#33B"&gt;@a&lt;/span&gt;[j]}&lt;tt&gt;
&lt;/tt&gt;    &lt;span style="color:#080;font-weight:bold"&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span style="color:#080;font-weight:bold"&gt;else&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span style="color:#33B"&gt;@a&lt;/span&gt;[t]=&lt;span style="color:#33B"&gt;@a&lt;/span&gt;[t-p]&lt;tt&gt;
&lt;/tt&gt;    &lt;span style="color:#080;font-weight:bold"&gt;if&lt;/span&gt; &lt;span style="color:#33B"&gt;@a&lt;/span&gt;[t]&amp;gt;&lt;span style="color:#00D;font-weight:bold"&gt;0&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      debruijn(t+&lt;span style="color:#00D;font-weight:bold"&gt;1&lt;/span&gt;,p,alike+&lt;span style="color:#00D;font-weight:bold"&gt;1&lt;/span&gt;)&lt;tt&gt;
&lt;/tt&gt;    &lt;span style="color:#080;font-weight:bold"&gt;else&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      debruijn(t+&lt;span style="color:#00D;font-weight:bold"&gt;1&lt;/span&gt;,p,alike)&lt;tt&gt;
&lt;/tt&gt;    &lt;span style="color:#080;font-weight:bold"&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    (&lt;span style="color:#33B"&gt;@a&lt;/span&gt;[t-p]+&lt;span style="color:#00D;font-weight:bold"&gt;1&lt;/span&gt;).upto(&lt;span style="color:#33B"&gt;@k&lt;/span&gt;-&lt;span style="color:#00D;font-weight:bold"&gt;1&lt;/span&gt;) {|j|&lt;tt&gt;
&lt;/tt&gt;      &lt;span style="color:#33B"&gt;@a&lt;/span&gt;[t]=j&lt;tt&gt;
&lt;/tt&gt;      debruijn(t+&lt;span style="color:#00D;font-weight:bold"&gt;1&lt;/span&gt;,t,alike+&lt;span style="color:#00D;font-weight:bold"&gt;1&lt;/span&gt;)&lt;tt&gt;
&lt;/tt&gt;    }&lt;tt&gt;
&lt;/tt&gt;  &lt;span style="color:#080;font-weight:bold"&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span style="color:#080;font-weight:bold"&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;debruijn(&lt;span style="color:#00D;font-weight:bold"&gt;1&lt;/span&gt;,&lt;span style="color:#00D;font-weight:bold"&gt;1&lt;/span&gt;,&lt;span style="color:#00D;font-weight:bold"&gt;0&lt;/span&gt;)&lt;tt&gt;
&lt;/tt&gt;print &lt;span style="color:#33B"&gt;@sequence&lt;/span&gt;.join&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;

&lt;p&gt;It's not uncommon to find keypads with 4 of the 10 keys worn down and if you do you can be pretty sure that the code contains those four different digits. The number of possible combinations are 4! = 4x3x2x1 = 24. I got curious to see if there's a kind of &lt;a href="http://mathworld.wolfram.com/deBruijnSequence.html"&gt;De Bruijn sequence&lt;/a&gt; for this that brings down the 4*24=96 keystrokes. By scribbling in a &lt;a href="http://www.scintilla.org/SciTE.html"&gt;text editor&lt;/a&gt; I quickly realized there's not a clean sequence. Not clean in the way that a sequence following the rules can be created. Also it's probably even quite daunting to present it as mathematically dense and beautiful as the &lt;a href="http://www.stefangeens.com/2004/10/the-de-bruijn-c.html"&gt;De Bruijn&lt;/a&gt; but that could be my less than great &lt;a href="http://en.wikipedia.org/wiki/Combinatorics"&gt;combinatorics&lt;/a&gt; speaking.&lt;/p&gt;

&lt;p&gt;I made a quick and dirty brute force hack to try to find a shorter sequence.&lt;/p&gt;

&lt;table class="CodeRay"&gt;&lt;tr&gt;
  &lt;td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;13&lt;tt&gt;
&lt;/tt&gt;14&lt;tt&gt;
&lt;/tt&gt;15&lt;tt&gt;
&lt;/tt&gt;16&lt;tt&gt;
&lt;/tt&gt;17&lt;tt&gt;
&lt;/tt&gt;18&lt;tt&gt;
&lt;/tt&gt;19&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;20&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;21&lt;tt&gt;
&lt;/tt&gt;22&lt;tt&gt;
&lt;/tt&gt;23&lt;tt&gt;
&lt;/tt&gt;24&lt;tt&gt;
&lt;/tt&gt;25&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class="code"&gt;&lt;pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }"&gt;seq=[]&lt;tt&gt;
&lt;/tt&gt;&lt;span style="color:#00D;font-weight:bold"&gt;1&lt;/span&gt;.upto(&lt;span style="color:#00D;font-weight:bold"&gt;4&lt;/span&gt;) {|a| &lt;span style="color:#00D;font-weight:bold"&gt;1&lt;/span&gt;.upto(&lt;span style="color:#00D;font-weight:bold"&gt;4&lt;/span&gt;) {|b| &lt;span style="color:#00D;font-weight:bold"&gt;1&lt;/span&gt;.upto(&lt;span style="color:#00D;font-weight:bold"&gt;4&lt;/span&gt;) {|c| &lt;span style="color:#00D;font-weight:bold"&gt;1&lt;/span&gt;.upto(&lt;span style="color:#00D;font-weight:bold"&gt;4&lt;/span&gt;) {|d|&lt;tt&gt;
&lt;/tt&gt;  seq &amp;lt;&amp;lt; &lt;span style="background-color:#fff0f0;color:#D20"&gt;&lt;span style="color:#710"&gt;&amp;quot;&lt;/span&gt;&lt;span style=""&gt;%d%d%d%d&lt;/span&gt;&lt;span style="color:#710"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; % [a,b,c,d] &lt;span style="color:#080;font-weight:bold"&gt;if&lt;/span&gt; !(a==b || a==c || a==d || b==c || b==d || c==d)&lt;tt&gt;
&lt;/tt&gt;}}}}&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;s=seq[&lt;span style="color:#00D;font-weight:bold"&gt;0&lt;/span&gt;]&lt;tt&gt;
&lt;/tt&gt;seq.delete_at(&lt;span style="color:#00D;font-weight:bold"&gt;0&lt;/span&gt;)&lt;tt&gt;
&lt;/tt&gt;&lt;span style="color:#080;font-weight:bold"&gt;while&lt;/span&gt; (seq.length&amp;gt;&lt;span style="color:#00D;font-weight:bold"&gt;0&lt;/span&gt;)&lt;tt&gt;
&lt;/tt&gt;  next_code=(seq.select {|c| c[&lt;span style="color:#00D;font-weight:bold"&gt;0&lt;/span&gt;..&lt;span style="color:#00D;font-weight:bold"&gt;2&lt;/span&gt;]==s[&lt;span style="color:#00D;font-weight:bold"&gt;-3&lt;/span&gt;..&lt;span style="color:#00D;font-weight:bold"&gt;-1&lt;/span&gt;]})&lt;tt&gt;
&lt;/tt&gt;  &lt;span style="color:#080;font-weight:bold"&gt;if&lt;/span&gt; next_code.empty?&lt;tt&gt;
&lt;/tt&gt;    next_code=(seq.select {|c| c[&lt;span style="color:#00D;font-weight:bold"&gt;0&lt;/span&gt;..&lt;span style="color:#00D;font-weight:bold"&gt;1&lt;/span&gt;]==s[&lt;span style="color:#00D;font-weight:bold"&gt;-2&lt;/span&gt;..&lt;span style="color:#00D;font-weight:bold"&gt;-1&lt;/span&gt;]})&lt;tt&gt;
&lt;/tt&gt;    &lt;span style="color:#080;font-weight:bold"&gt;if&lt;/span&gt; next_code.empty? &lt;tt&gt;
&lt;/tt&gt;      next_code=(seq.select {|c| c[&lt;span style="color:#00D;font-weight:bold"&gt;0&lt;/span&gt;]==s[&lt;span style="color:#00D;font-weight:bold"&gt;-1&lt;/span&gt;]})&lt;tt&gt;
&lt;/tt&gt;      s+=next_code[&lt;span style="color:#00D;font-weight:bold"&gt;0&lt;/span&gt;][&lt;span style="color:#00D;font-weight:bold"&gt;1&lt;/span&gt;..&lt;span style="color:#00D;font-weight:bold"&gt;3&lt;/span&gt;]&lt;tt&gt;
&lt;/tt&gt;      seq.delete_at(seq.index(next_code[&lt;span style="color:#00D;font-weight:bold"&gt;0&lt;/span&gt;]))&lt;tt&gt;
&lt;/tt&gt;    &lt;span style="color:#080;font-weight:bold"&gt;else&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      s+=next_code[&lt;span style="color:#00D;font-weight:bold"&gt;0&lt;/span&gt;][&lt;span style="color:#00D;font-weight:bold"&gt;2&lt;/span&gt;..&lt;span style="color:#00D;font-weight:bold"&gt;3&lt;/span&gt;]&lt;tt&gt;
&lt;/tt&gt;      seq.delete_at(seq.index(next_code[&lt;span style="color:#00D;font-weight:bold"&gt;0&lt;/span&gt;]))&lt;tt&gt;
&lt;/tt&gt;    &lt;span style="color:#080;font-weight:bold"&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span style="color:#080;font-weight:bold"&gt;else&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    next_code=(seq.select {|c| c[&lt;span style="color:#00D;font-weight:bold"&gt;0&lt;/span&gt;..&lt;span style="color:#00D;font-weight:bold"&gt;2&lt;/span&gt;]==s[&lt;span style="color:#00D;font-weight:bold"&gt;-3&lt;/span&gt;..&lt;span style="color:#00D;font-weight:bold"&gt;-1&lt;/span&gt;]})&lt;tt&gt;
&lt;/tt&gt;    s+=next_code[&lt;span style="color:#00D;font-weight:bold"&gt;0&lt;/span&gt;][&lt;span style="color:#00D;font-weight:bold"&gt;3&lt;/span&gt;].chr&lt;tt&gt;
&lt;/tt&gt;    seq.delete_at(seq.index(next_code[&lt;span style="color:#00D;font-weight:bold"&gt;0&lt;/span&gt;]))&lt;tt&gt;
&lt;/tt&gt;  &lt;span style="color:#080;font-weight:bold"&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span style="color:#080;font-weight:bold"&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;p&gt;The above code takes the first code "1234" of the 24 and then searches the rest of the array for a code beginning with "234". It finds "2341" and adds "1" to the end of &lt;em&gt;s&lt;/em&gt; and continues to look for "341" and so on. Relatively soon there is no three digit match and then it tries two digits and eventually even that fails and then it gets the first one digit match. The resulting sequence is: &lt;/p&gt;

&lt;blockquote&gt;
    &lt;p&gt;123412314231243121342132413214321&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;From 96 to 33 keystrokes. Not as effective as De Bruijn but still significant. Unlike De Bruijn I have absolutely no proof that this is the shortest one possible but it seems likely. Also notice that in the middle of the sequence we find "3121" and "1213". Those break the criteria of four different digits but they seem to be necessary to be able to enter the reversed mode. Try reading the sequence forward and backwards to see what I mean.&lt;/p&gt;

&lt;p&gt;If the code only contains two digits it's gets even more trivial to try them all. There are 14 possible codes and by &lt;em&gt;compressing&lt;/em&gt; those to one sequence you get down to 20 keystrokes. &lt;/p&gt;

&lt;p&gt;Things get a little more interresting if three buttons are worn. It turns out that the repeated digits can be placed in the code in six different ways.&lt;/p&gt;

&lt;blockquote&gt;
    &lt;p&gt;0012,1002,1200,0102,0120,1020&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That's 6x2x3=36 combinations and, maybe a little unintuitive, 12 more than if you are using four different digits. I compressed it down to 49 key strokes. Unlike the sequence for four different digits I can't find it with google and I know it's kind of security by obscurity but that could give a tiny amount of extra trouble to an attacker. I will not be the first one publishing it.&lt;/p&gt;

&lt;p&gt;Be aware that if an attacker knows you are using a 0012-like code he gets a smaller space to search. 6x8x9x10=4320 instead of 10000. You have to weight the risk of button leaks against a code protocol leak.&lt;/p&gt;</description>
      <pubDate>Sun, 27 Sep 2009 21:02:00 +0200</pubDate>
      <guid isPermaLink="false">urn:uuid:9e10d05b-1a1d-46a1-82da-0ba366d32035</guid>
      <author>Jonas Elfström</author>
      <link>http://alicebobandmallory.blogdns.com/articles/2009/09/27/a-case-for-using-only-three-different-digits-in-keypad-codes</link>
      <category>Security</category>
      <category>Ruby</category>
    </item>
    <item>
      <title>Why you should use four different digits for keypad locks</title>
      <description>&lt;p&gt;I made a couple of very bad mistakes in this article so I took it down. Hopefully I'm more on track in the &lt;a href="http://alicebobandmallory.com/articles/2009/09/27/a-case-for-using-only-three-different-digits-in-keypad-codes"&gt;sequel&lt;/a&gt;.&lt;/p&gt;</description>
      <pubDate>Wed, 23 Sep 2009 19:49:00 +0200</pubDate>
      <guid isPermaLink="false">urn:uuid:327947c8-2f2d-4ca7-9ddf-bdd8b74cd9f4</guid>
      <author>Jonas Elfström</author>
      <link>http://alicebobandmallory.blogdns.com/articles/2009/09/23/why-you-should-use-four-different-digits-for-keypad-locks</link>
      <category>Security</category>
      <category>Ruby</category>
    </item>
    <item>
      <title>Breaking good</title>
      <description>&lt;p&gt;Check out &lt;a href="http://www.veracode.com/blog/2009/04/decoding-the-dbir-2009-cover/"&gt;Chris Eng's post&lt;/a&gt; on how he broke the code on the cover of the  &lt;a href="http://www.verizonbusiness.com/resources/security/reports/2009_databreach_rp.pdf"&gt;2009 Verizon Data Breach Investigations Report&lt;/a&gt;. He makes it seem so simple and without making a big deal of it he also shows the tools and commands he used.&lt;/p&gt;</description>
      <pubDate>Sun, 03 May 2009 23:24:00 +0200</pubDate>
      <guid isPermaLink="false">urn:uuid:6f525b07-1e76-4c82-ac8f-c518d3432101</guid>
      <author>Jonas Elfström</author>
      <link>http://alicebobandmallory.blogdns.com/articles/2009/05/03/breaking-good</link>
      <category>Security</category>
    </item>
    <item>
      <title>Swedish hackers</title>
      <description>&lt;p&gt;The incident I wrote of in &lt;a href="http://alicebobandmallory.com/articles/2007/02/04/hello-this-is-special-agent-brian"&gt;Hello this is special agent Brian&lt;/a&gt; were covered in a Swedish radio documentary a little more than a month ago.
It's all in Swedish. You can find out more &lt;a href="http://www.sr.se/cgi-bin/p3/programsidor/artikel.asp?ProgramID=2519&amp;amp;Artikel=2447808"&gt;here&lt;/a&gt; and you can download the documentary from &lt;a href="http://www.sr.se/laddahem/podradio/SR_p3_dokumentar_081116080008.mp3"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I also would like to add that we did not press charges like the police officers says 37 minutes into the documentary. Not because we thought it wasn't a big deal but we knew that a couple of big players already had so we thought we could spend our time better.&lt;/p&gt;</description>
      <pubDate>Wed, 31 Dec 2008 00:29:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:75c0eb80-02fc-4f10-92bf-d0ee90a49986</guid>
      <author>Jonas Elfström</author>
      <link>http://alicebobandmallory.blogdns.com/articles/2008/12/31/swedish-hackers</link>
      <category>Security</category>
    </item>
    <item>
      <title>Drive encryption matters</title>
      <description>&lt;p&gt;In a recent release &lt;a href="http://www.truecrypt.org/"&gt;TrueCrypt&lt;/a&gt; now supports &lt;a href="http://www.truecrypt.org/docs/?s=system-encryption"&gt;drive/partition&lt;/a&gt; encryption.&lt;/p&gt;

&lt;p&gt;One reason to encrypt on disk instead of file level is that operating systems and applications sometimes accidently stores passwords on your hard drive. This can happen in a number of ways and one common mistake applications make is to not prevent to be put on disk by the OS. Modern systems have a &lt;a href="http://en.wikipedia.org/wiki/Paging"&gt;page/swap file&lt;/a&gt;. If a program gets paged out while holding your clear text password in pageable memory your password will be written to disk. The problem is that there are &lt;a href="http://www.schneier.com/essay-148.html"&gt;password recovery tools&lt;/a&gt; that can scan your page file for passwords.&lt;/p&gt;

&lt;p&gt;You can configure Windows (and surely most other operating systems) to &lt;a href="http://support.microsoft.com/kb/314834"&gt;clear the page file&lt;/a&gt; on shutdown which will give you better protection (and slower shutdowns). Be aware that if you simply turn off the power the page file will be intact.&lt;/p&gt;</description>
      <pubDate>Tue, 12 Feb 2008 00:26:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:fc149744-6fac-475d-8a37-f548b4db2403</guid>
      <author>Jonas Elfström</author>
      <link>http://alicebobandmallory.blogdns.com/articles/2008/02/12/drive-encryption-matters</link>
      <category>Security</category>
    </item>
    <item>
      <title>Scary tools</title>
      <description>&lt;p&gt;I recently attended a session held by &lt;a href="http://truesecurity.se/blogs/murray/"&gt;Marcus Murray&lt;/a&gt;. It seems it was kind of a compressed version of the &lt;a href="http://truesecurity.se/blogs/murray/archive/2007/06/05/session-notes-sec-310-why-i-can-hack-your-network-in-a-day-teched-us-2007-part-1.aspx#comments"&gt;session&lt;/a&gt; he held at TechEd earlier this year. Murray is witty, charismatic and has a broad and deep understanding of IT-security issues. He cracks jokes and practices a little social engineering to keep the audience attentive.
If you and your IT-staff wants to be briefed (and scared) with the latest in IT-security I could easily recommend Murray.&lt;/p&gt;

&lt;p&gt;He demonstrated a couple of tools that both impressed and scared me. First he demonstrated how to set up a mail based attack using the commercial &lt;a href="http://www.coresecurity.com/?module=ContentMod&amp;amp;action=item&amp;amp;id=32"&gt;Core IMPACT&lt;/a&gt;. It's a very impressive tool and mail based attacks are only one out of many attacks this software has the ability to execute. Before seeing this I could never have guessed there are tools this advanced and this easy to use. The lists of exploits it can test, in an all automated fashion, were long and seemed to be up to date.&lt;/p&gt;

&lt;p&gt;Murray also demonstrated &lt;a href="http://www.grc.com/nat/arp.htm"&gt;ARP poisoning&lt;/a&gt; and hijacking of a RDP session by using the free &lt;a href="http://www.oxid.it/index.html"&gt;Cain &amp;amp; Abel &lt;/a&gt; tool. You could feel the discomfort in the air as it dawned on the audience how easy this is to set up.&lt;/p&gt;</description>
      <pubDate>Wed, 12 Dec 2007 17:15:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:a8894523-e498-4a14-9ea2-45acb0672dbf</guid>
      <author>Jonas Elfström</author>
      <link>http://alicebobandmallory.blogdns.com/articles/2007/12/12/scary-tools</link>
      <category>Security</category>
    </item>
    <item>
      <title>Man in the browser</title>
      <description>&lt;p&gt;There's some buzz about a new trojan technique called &lt;a href="http://www.f-secure.com/f-secure/pressroom/news/fs_news_20071122_1_eng.html"&gt;"Man in the browser"&lt;/a&gt;.  The trojan plugs itself into the users browser and then it intercepts the HTML. This have all sorts of implications, for instance the SSL certificate will seem to be valid. &lt;/p&gt;

&lt;p&gt;Even if your virus protection does not detect the "Man in the browser" there are still ways to be quite safe. If your bank uses a security token which you not only logs in with but also use to sign your transactions, the attack will most likely fail. One problem is that it is up to you, the user, to actually verify that you are signing the expected amount to the expected accounts. To get protection against someone who has complete control over your computer the security protocol must "communicate" with the security token both ways. &lt;/p&gt;

&lt;p&gt;It is not enough to only let the user enter the total value of the transactions because the tokens answer to such a simple value could be reused (during a short period of time) also the attack could be crafted to create the correct amount but to other accounts. By asking the user to also sign every new account the attacker will not be able to hide a transaction to his account.&lt;/p&gt;

&lt;p&gt;The challenge is to make the security protocol clear and &lt;a href="/articles/2007/03/27/secure-and-simple-security-tokens-needed"&gt;simple&lt;/a&gt; enough so that the user can understand what he would expect the bank to respond and expect from him.&lt;/p&gt;

&lt;p&gt;It's the usual three: have a firewall, an updated virus protection and a secure bank with a &lt;a href="http://en.wikipedia.org/wiki/Security_token#Digital_signatures"&gt;digital security token&lt;/a&gt; were you sign your transactions and maybe you can sleep a little better.&lt;/p&gt;</description>
      <pubDate>Mon, 26 Nov 2007 21:40:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:4a0b5d22-29f0-418a-b9df-1fe703ad3fdb</guid>
      <author>Jonas Elfström</author>
      <link>http://alicebobandmallory.blogdns.com/articles/2007/11/26/man-in-the-browser</link>
      <category>Security</category>
    </item>
    <item>
      <title>Blowfish in the URL</title>
      <description>&lt;p&gt;Sometimes you do not want to show the database id for a row in the URL. The reason could be that you do not want someone to be able to scan through all the data.&lt;/p&gt;

&lt;p&gt;One solution is to use &lt;a href="http://en.wikipedia.org/wiki/Globally_Unique_Identifier"&gt;GUID's&lt;/a&gt; but they have drawbacks and one of them is that they add a considerable length to the URL. The shortest URL-safe representation of a GUID I've seen is &lt;a href="http://tools.assembla.com/breakout/wiki/FreeSoftware"&gt;22 characters&lt;/a&gt; but usually they are 36 characters.&lt;/p&gt;

&lt;p&gt;Depending on how your id's are implemented a much shorter way could be to simply to encrypt them.&lt;/p&gt;

&lt;p&gt;Here's a &lt;a href="http://www.ruby-lang.org/"&gt;Ruby&lt;/a&gt;-example that Blowfish encrypts, Base64 encodes and URL-encodes an integer value. You can get crypt as a gem:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gem install crypt&lt;/code&gt;&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="ident"&gt;require&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;rubygems&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;
&lt;span class="ident"&gt;require&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;crypt/blowfish&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;
&lt;span class="ident"&gt;require&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;Base64&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;
&lt;span class="ident"&gt;blowfish&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="constant"&gt;Crypt&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;Blowfish&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;new&lt;/span&gt;&lt;span class="punct"&gt;(&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;A key up to 56 bytes long&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;)&lt;/span&gt;
&lt;span class="ident"&gt;plainId&lt;/span&gt;&lt;span class="punct"&gt;=&lt;/span&gt;&lt;span class="number"&gt;123456&lt;/span&gt;
&lt;span class="ident"&gt;encryptedBlock&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="ident"&gt;blowfish&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;encrypt_block&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="ident"&gt;plainId&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;to_s&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;ljust&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="number"&gt;8&lt;/span&gt;&lt;span class="punct"&gt;))&lt;/span&gt;
&lt;span class="ident"&gt;idForURL&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="constant"&gt;URI&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;escape&lt;/span&gt;&lt;span class="punct"&gt;((&lt;/span&gt;&lt;span class="constant"&gt;Base64&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;encode64&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="ident"&gt;encryptedBlock&lt;/span&gt;&lt;span class="punct"&gt;).&lt;/span&gt;&lt;span class="ident"&gt;strip&lt;/span&gt;&lt;span class="punct"&gt;))&lt;/span&gt;

&lt;span class="ident"&gt;decryptedId&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="ident"&gt;blowfish&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;decrypt_block&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="constant"&gt;Base64&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;decode64&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="constant"&gt;URI&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;unescape&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="ident"&gt;idForURL&lt;/span&gt;&lt;span class="punct"&gt;))).&lt;/span&gt;&lt;span class="ident"&gt;strip&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;to_i&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The .ljust(8) is because &lt;a href="http://www.schneier.com/blowfish.html"&gt;Blowfish&lt;/a&gt; is a 64-bit block &lt;a href="http://en.wikipedia.org/wiki/Blowfish_(cipher)"&gt;cipher&lt;/a&gt; and the &lt;a href="http://crypt.rubyforge.org/"&gt;Ruby-implementation&lt;/a&gt; does not pad the data itself.&lt;/p&gt;

&lt;p&gt;The id in the URL in this case would be &lt;code&gt;c2PSXWgky40=&lt;/code&gt;. Its 12 characters long (11 if you skip the equal sign) and that's 10 or 24 characters shorter than a GUID. Also there is zero percent chance of a collusion and if you want to you can even decrypt it.&lt;/p&gt;

&lt;p&gt;This is not a super safe implementation but if you start your id's at a random and not too low number you are making it a bit harder for someone to crack the 56-bit key. Actually a truly random and at least 64-bit big number would be a better choice as it would have no connection to the true id at all. You would have to check for uniqueness before storing those in the database though.&lt;/p&gt;</description>
      <pubDate>Thu, 15 Nov 2007 22:38:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:9071a4d1-aaf0-4f17-a796-4ecd65976d64</guid>
      <author>Jonas Elfström</author>
      <link>http://alicebobandmallory.blogdns.com/articles/2007/11/15/blowfish-in-the-url</link>
      <category>Security</category>
      <category>Ruby</category>
      <category>Cryptography</category>
    </item>
    <item>
      <title>Hash functions</title>
      <description>&lt;p&gt;Recently I happened to see the &lt;a href="http://www.isthe.com/chongo/tech/comp/fnv/"&gt;FNV hash&lt;/a&gt; being mentioned. I had never heard of it before so I googled it and found the authors &lt;a href="http://www.isthe.com/chongo/tech/comp/fnv/"&gt;page&lt;/a&gt; but also a true gem. If you want a crash course in hash functions then I can recommend Mulvey's &lt;a href="http://bretm.home.comcast.net/hash/"&gt;site&lt;/a&gt;.&lt;/p&gt;</description>
      <pubDate>Mon, 01 Oct 2007 21:07:00 +0200</pubDate>
      <guid isPermaLink="false">urn:uuid:55e0d2e8-96eb-41e7-9a1f-e5d3c835915f</guid>
      <author>Jonas Elfström</author>
      <link>http://alicebobandmallory.blogdns.com/articles/2007/10/01/hash-functions</link>
      <category>Security</category>
    </item>
    <item>
      <title>Smart card with LCD</title>
      <description>&lt;p&gt;&lt;a href="http://www.swecard.se/"&gt;This company&lt;/a&gt; is presenting a smart card with built in display. I do not know the underlying protocol for making debit/credit card payments by smart card instead of using the magnetic stripe but if the protocol is sophisticated enough this could help blocking some of the known attacks of those. As &lt;a href="http://www.chipandspin.co.uk/"&gt;Chip and SPIN&lt;/a&gt; points out the smart cards has some issues. One of them is that if the terminal is compromised you as a customer have no way to know that you are actually confirming the transaction you think you are while entering your pin code. If your smart card shows the amount, you could at least not be deceived into emptying your account.&lt;/p&gt;</description>
      <pubDate>Tue, 31 Jul 2007 23:10:00 +0200</pubDate>
      <guid isPermaLink="false">urn:uuid:76986b7d-292e-4665-a9d6-748461fa455b</guid>
      <author>Jonas Elfström</author>
      <link>http://alicebobandmallory.blogdns.com/articles/2007/07/31/smart-card-with-lcd</link>
      <category>Security</category>
    </item>
  </channel>
</rss>
