<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title><![CDATA[shift or die]]></title>
  <link href="http://shiftordie.de/atom.xml" rel="self"/>
  <link href="http://shiftordie.de/"/>
  <updated>2012-03-18T20:00:34+01:00</updated>
  <id>http://shiftordie.de/</id>
  <author>
    <name><![CDATA[Alexander Klink]]></name>
    
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[Geohashing with GPX files and QLandkarte GT]]></title>
    <link href="http://shiftordie.de/blog/2012/03/18/geohashing-with-qlandkartegt/"/>
    <updated>2012-03-18T19:40:00+01:00</updated>
    <id>http://shiftordie.de/blog/2012/03/18/geohashing-with-qlandkartegt</id>
    <content type="html"><![CDATA[<p>
Because of some <a href="http://blog.xkcd.com/2012/02/27/geohashing-2/">scientists near the south pole</a>, I recently re-discovered <a href="http://www.geohashing.org">geohashing</a>. As I wanted an easy way to see the most recent hash points (and the upcoming one(s), since I live east of <a href="http://wiki.xkcd.com/geohashing/W30">W30</a>), I did some automation.
</p>
<p>
The different online services are pretty nice but they did not have all the features I wanted to have. Also, I have grown quite fond of the ability to have an OpenStreetMap available offline (not necessarily because I am offline that much, but because it makes looking at the map so much faster). I use <a href="http://www.qlandkarte.org/">QLandkarte GT</a> and the <a href="http://openmtbmap.org">Openmtbmap.org</a> map, as it shows cycling routes quite nicely.
</p>
<p>
QLandkarte GT supports loading GPX files, so the first thing I needed was something to produce GPX files for a given graticule (and date, or if no date is specified, for all upcoming ones). I wanted something similar to the <a href="http://tjum.anthill.de/geohash.html">Small Hash Inquiry Tool</a>, as it shows you the hash points of the surrounding graticules as well. I took an evening to hack something together using Ruby, <a href="http://www.sinatrarb.com">Sinatra</a> and relet&#8217;s <a href="http://wiki.xkcd.com/geohashing/Implementations#JSON_Web_Service">JSON web service</a>. I decided to host it on <a href="http://www.heroku.com">Heroku</a>, as it was easy and free. You can find out how to use it at <a href="http://geohashing-gpx.heroku.com">http://geohashing-gpx.heroku.com</a>. It should also work quite nicely with GPS devices with GPX support (or with gpsbabel, for that matter). The source is available at git://git.alech.de/geohashing_gpx.git, if you are curious.
</p>
<p>
But back from devices to the desktop, I wanted an easy way to view this in QLandkarte GT and keep it updated. Luckily, QLandkarte GT offers a sort of reload feature with the “-m” command line option. I&#8217;ve written a small wrapper which makes this available using a signal handler:
<pre>
$ cat bin/qlandkartegt_reloadable.rb 
#!/usr/bin/env ruby

f = IO.popen("qlandkartegt -m0 #{ARGV.join(' ')}", 'w')

trap('USR1') do
	f.write 'A'
end
Process.wait
</pre>

So now I can do something along the lines of:

<pre>
qlandkartegt_reloadable.rb ~/gps/geohash.gpx
wget http://geohashing-gpx.heroku.com/multi/1/49/8 -O ~/gps/geohash.gpx &amp;&amp; pkill -USR1 -f qlandkartegt_reloadable.rb
</pre>

to keep the data shown in my (always open) QLandkarte GT up to date.
</p>
<p>
The only things on my TODO list for this are timezones (it works using UTC at the moment, which is fine for me since I am pretty close to UTC, but may be annoying if you are not that close) and the possible addition of business holidays to figure out if tomorrow will have new DJIA opening value or not (if anyone has a good, free source, please let me know). I might work on this or I might not, chances are higher if someone bothers me to do so.
</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Shell injection without whitespace]]></title>
    <link href="http://shiftordie.de/blog/2011/12/23/shell-injection-without-whitespace/"/>
    <updated>2011-12-23T22:50:00+01:00</updated>
    <id>http://shiftordie.de/blog/2011/12/23/shell-injection-without-whitespace</id>
    <content type="html"><![CDATA[<p>
Recently, I was in the situation where I could inject code into a Perl <tt>system</tt> call, but whitespace (\s+) was filtered beforehand (probably not for security but rather for functionality reasons).
</p>
<p>
In looking for a way to still execute more than a parameterless binary (which of course would be a possible solution if I had had a way to put a custom binary on the system), I stumbled over the $IFS variable, which is the “Internal Field Seperator” with default value “&lt;space&gt;&lt;tab&gt;&lt;newline&gt;”. It also works fine as a separator for parameters, so you can inject something like:
<pre>
nc${IFS}-l${IFS}-p1337${IFS}-e/bin/sh
</pre>
without using a single whitespace character. May it come in handy for you one day.
</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Moving to Octopress]]></title>
    <link href="http://shiftordie.de/blog/2011/12/22/moving-to-octopress/"/>
    <updated>2011-12-22T21:33:00+01:00</updated>
    <id>http://shiftordie.de/blog/2011/12/22/moving-to-octopress</id>
    <content type="html"><![CDATA[<p>
My blog has been running on <a href="https://github.com/jrockway/angerwhale">Angerwhale</a>, a Catalyst-based Perl blog framework. Although it worked fine for me from a usability point of view (plain text files plus some meta-data), it was way to slow to deal with a few concurrent hits. I never noticed until <a href="https://twitter.com/chaosupdates">@chaosupdates</a> linked to my blog post about @cryptofax2tweet and the server more or less exploded in (virtual) flames.
</p>
<p>
I made an attempt to change from the standalone server (well, no surprise that it did not deal well with load there but that was fine for a long time for my little blog here) to a real modperl-based installation, but that did not help much.
</p>
<p>
As I am more confident with Ruby then Perl nowadays I started looking for something to change to. A static solution would of course be nice to have because of the speed factor, so after some searching and #followerpower, I stumbled over <a href="http://www.octopress.org">Octopress</a>, which uses the <a href="https://github.com/mojombo/jekyll">Jekyll</a> framework.
</p>
<p>
I converted all my Angerwhale posts to Octopress using a small Ruby script (ping me if you are interested). The comments from the old site are still missing, but I am considering converting them with <a href="https://github.com/mpalmer/jekyll-static-comments">Jekyll::StaticComments</a> plugin.
</p>
<p>
The plan for now is to try to blog a bit more than before, maybe it should be on my list of new year&#8217;s resolutions (or maybe not as not to jinx it ;-).
</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Introducing CryptoFax2Tweet]]></title>
    <link href="http://shiftordie.de/blog/2011/04/27/introducing-cryptofax2tweet/"/>
    <updated>2011-04-27T23:14:00+02:00</updated>
    <id>http://shiftordie.de/blog/2011/04/27/introducing-cryptofax2tweet</id>
    <content type="html"><![CDATA[<p>
<img src="http://shiftordie.de/static/cryptofax_sample.png"/>
</p>
<p>
Meet <a href="https://twitter.com/cryptofax2tweet">@cryptofax2tweet</a>, a new
Twitter account I run. So, what is so special about this account? As the name
suggests, it can be used to tweet by sending an encrypted <a href="http://en.wikipedia.org/wiki/QR_code">QR code</a> using a fax,
for example when your government decides to turn off the internet. In case you
are not interested in the technical details on how it works and just want to
use it, you can download the <a
href="https://cryptofax2tweet.cdn.as250.net/cryptofax.pdf">cryptofax.pdf</a>
file and open it in Adobe Reader. A <a
href="https://cryptofax2tweet.cdn.as250.net/cryptofax_users_guide.pdf">one page
user&#8217;s guide</a> is also available.
</p>
<p>
So, how does this work? Recent PDF versions support the <a href="http://partners.adobe.com/public/developer/xml/index_arch.html">XML Forms Architecture (XFA)</a>,
which I&#8217;ve been playing with lately. It includes all kind of funny things, such as its
own language (because having both Javascript and Flash in Reader is not enough, apparently),
FormCalc. It is apparently not more useful than Javascript except if you want to
<a href="https://twitter.com/#!/alech/status/41249449359572992">generate arbitrary HTTP requests</a>.
</p>
<p>
But I am digressing. One of the more interesting features of XFA is the possibility
to create all kinds of barcodes, both one- and two-dimensional. The list of different
types you can create in the specification is about five pages long(!). Also, the
specification claims that the content of the barcode can be encrypted before creating
it using an RC4/RSA hybrid encryption.
</p>
<p>
I had recently read about Google&#8217;s <a href="https://twitter.com/speak2tweet">@speak2tweet</a>
account and liked the idea but not the <i>Medienbruch</i> &mdash; the change from one medium (voice) to another
(text). So I thought about implementing something using XFA which would allow people
to send tweets via fax.
</p>
<p>
One obstacle on the way was finding out that Adobe does not want you to create
dynamic 2D barcodes if <a href="http://blogs.adobe.com/asktheexperts/2009/06/adobe_livecycle_barcoded_forms.html">you do not have the license for it</a>.
Unluckily, if you do not know this and modify the rawValue attribute of the barcode
field after the form has rendered, you just get to see a grey block instead of the
barcode and keep wondering whether Adobe just broke the functionality. Also, debugging
Javascript code if you only have Adobe Reader is less funny than you think. Once
I figured that out, I realised that you can ask for the dynamic information in the
initialize event handler using app.response() and create the barcode at that point (not sure
whether Adobe would consider this a bug or a feature).
</p>
<p>
After that was solved, I looked into encrypting the content of the tweet. Note that
the encryption just helps against an attacker who only monitors the phone lines
and not the @cryptofax2tweet account. Still, it might help people who have printed
out the fax and it gets intercepted before it has been faxed. Unluckily, it looks
like this particular functionality from the specification has not been implemented
in Reader (the fact that the <a href="http://help.adobe.com/en_US/livecycle/es/lcdesigner_scripting_reference.pdf">LiveCycle&reg; Designer ES Scripting Reference</a> does not talk about it at all points in this direction, too).
</p>
<p>
Luckily, there was no need to implement the cryptography myself, as there is
already a pretty nice <a href="http://www-cs-students.stanford.edu/~tjw/jsbn/">BSD-licensed RSA implementation</a> for Javascript. A few <a href="http://git.alech.de/?p=cryptofax2tweet.git;a=blob_plain;f=pdf/rsa-js-reader-patches.diff;hb=HEAD">patches</a> later to fix some Reader-specific oddities, I was able to RSA-encrypt a tweet.
As a tweet can only be 140 characters (thus at most 560 bytes in UTF-8), I just used
a 4096 bit RSA key (not for security, just for convenience reasons :-). This would
enable us to encode only at most 128 characters of four-byte UTF-8 characters
(e.g. Klingon in the private use area). I accepted this trade-off and in the end
it turned out that inputting four-byte UTF-8 characters using app.response() was
impossible anyways.
</p>
<p>
The other end of the service needs to decode the QR code, decrypt the content and
tweet it. This part was a lot easier than the PDF part, as it could be implemented
in less than 50 lines using Ruby and the <a href="http://zbar.sourceforge.net/">ZBar
barcode library</a>. A fax number was thankfully provided by <a href="https://as250.net">AS250.net</a>
so that I only needed to deal with emails from the fax2mail gateway.
</p>
<p>
If you managed to read this far, you might be interested in the code, which is available
in a <a href="git://git.alech.de/cryptofax2tweet.git">Git repository</a> (or see the
<a href="http://git.alech.de/?p=cryptofax2tweet.git">Gitweb interface</a>).
</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Evading AVs using the XML Data Package (XDP) format]]></title>
    <link href="http://shiftordie.de/blog/2011/02/09/evading-avs-using-the-xml-data-package-xdp-format/"/>
    <updated>2011-02-09T10:59:00+01:00</updated>
    <id>http://shiftordie.de/blog/2011/02/09/evading-avs-using-the-xml-data-package-xdp-format</id>
    <content type="html"><![CDATA[<p>
At work, I recently obtained a copy of <a href="http://itextpdf.com/book/">iText 
in Action, 2nd Edition</a> because I have been playing with PDF a bit lately
and the book not only offers advice on how to use the Java PDF library
<a href="http://itextpdf.com">iText</a> but also some background on PDF internals
and the new features in PDF 1.7.
</p>
<p>
One thing I stumbled about in the book was that there is a format called
<a href="http://en.wikipedia.org/wiki/XML_Data_Package">XML Data Package</a> (XDP)
which can be used to represent a PDF as XML. So of course I downloaded the
<a href="http://partners.adobe.com/public/developer/en/xml/xdp_2.0.pdf">specification</a>
and went to play with it a bit.
</p>
<p>
Acrobat Reader opens XDP files just fine if they have an .xdp file extension or
if they are sent by a webserver with the application/vnd.adobe.xdp+xml MIME type.
It was an easy exercise to write a small script to convert a given PDF to an XDP
file (basically it&#8217;s just an XML header, the Base64-encoded PDF and an XML footer).
</p>
<p>
I was wondering how Antivirus products would react to a malware PDF file in disguise
as a XDP. Thus, I generated a PDF containing an exploit using 
<a href="http://www.metasploit.com">Metasploit</a> and uploaded it to 
<a href="http://www.virustotal.com">VirusTotal</a>.
<a href="http://www.virustotal.com/file-scan/report.html?id=0d2144c2d05ee908d219b822c1744e56c007329186187527bfbcca6ec1f3c7a6-1296594207">13 out of 43</a> products classified the PDF as malware.
Interestingly enough, <a href="http://www.virustotal.com/file-scan/report.html?id=4633250dcd186d00cb36a7fc7b37e112dc5abff8748a147d90f591297fbe84a7-1296594366"><b>0</b>/43</a> recognized
the equivalent XDP file as malware (and neither did a few mail gateways I tested).
</p>
<p>
I&#8217;ve just submitted a <a href="https://www.metasploit.com/redmine/issues/3679">feature request</a> for Metasploit to add XDP support and added my <a href="https://www.metasploit.com/redmine/attachments/834/pdf2xdp.rb">pdf2xdp.rb</a> script as a starting point. Let&#8217;s see where this
is heading.
</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Language-dependant spellchecking within sup]]></title>
    <link href="http://shiftordie.de/blog/2010/08/16/language-dependant-spellchecking-within-sup/"/>
    <updated>2010-08-16T22:28:00+02:00</updated>
    <id>http://shiftordie.de/blog/2010/08/16/language-dependant-spellchecking-within-sup</id>
    <content type="html"><![CDATA[<p>
As we all know, <a href="http://www.mutt.org">all mail clients suck</a>. In the eternal search for the one that sucks the least, I have come across <a href="http://sup.rubyforge.org">Sup</a>. I tried it a while ago and it wouldn&#8217;t import my mailbox, so I gave it up pretty quickly. Apparently, it has become better in that regard so that I now have a full-text searchable index over roughly 200.000 mails and am seriously considering moving away from mutt.
</p>
<p>
One feature that I like particularly is the extensibility by using Ruby code in so-called <a href="http://sup.rubyforge.org/wiki/wiki.pl?Hooks">hooks</a>. One quick hack I did tonight allows me to set the spellchecking language of my editor (vim) based on the language of the message I am replying to by using the <a href="http://www.rubyinside.com/whatlanguage-ruby-language-detection-library-1085.html">whatlanguage gem</a>. This code in ~/.sup/hooks/reply-from.rb replaces the spelllang parameter on the (default) vim commandline in the configuration:
</p>
<p>
<pre>
<font color="#00aaaa">require</font>&nbsp;<font color="#6666ff"><b>'</b></font><font color="#00aaaa">whatlanguage</font><font color="#6666ff"><b>'</b></font><br>
<br>
<font color="#44ffff"><b>case</b></font>&nbsp;message.quotable_body_lines.join(<font color="#6666ff"><b>&quot;</b></font><font color="#6666ff"><b>\n</b></font><font color="#6666ff"><b>&quot;</b></font>).language<br>
<font color="#44ffff"><b>when</b></font>&nbsp;<font color="#00aaaa">:german</font>&nbsp;<font color="#44ffff"><b>then</b></font><br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ffffff">$config</font>[<font color="#00aaaa">:editor</font>].gsub!(<font color="#6666ff"><b>/</b></font><font color="#00aaaa">spelllang=</font><font color="#6666ff"><b>[^</b></font><font color="#00aaaa">'</font><font color="#6666ff"><b>]</b></font><font color="#6666ff"><b>+</b></font><font color="#00aaaa">'</font><font color="#6666ff"><b>/</b></font>, <font color="#6666ff"><b>%q|</b></font><font color="#00aaaa">spelllang=de_de'</font><font color="#6666ff"><b>|</b></font>)<br>
<font color="#44ffff"><b>else</b></font><br>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ffffff">$config</font>[<font color="#00aaaa">:editor</font>].gsub!(<font color="#6666ff"><b>/</b></font><font color="#00aaaa">spelllang=</font><font color="#6666ff"><b>[^</b></font><font color="#00aaaa">'</font><font color="#6666ff"><b>]</b></font><font color="#6666ff"><b>+</b></font><font color="#00aaaa">'</font><font color="#6666ff"><b>/</b></font>, <font color="#6666ff"><b>%q|</b></font><font color="#00aaaa">spelllang=en_us'</font><font color="#6666ff"><b>|</b></font>)<br>
<font color="#44ffff"><b>end</b></font><br>
<br>
<font color="#00aaaa">nil</font><br>
</pre>
</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Raindrops in a spider web]]></title>
    <link href="http://shiftordie.de/blog/2010/03/29/raindrops-in-a-spider-web/"/>
    <updated>2010-03-29T21:57:00+02:00</updated>
    <id>http://shiftordie.de/blog/2010/03/29/raindrops-in-a-spider-web</id>
    <content type="html"><![CDATA[<a href="http://shiftordie.de/static/photos/raindrops_blog_big.jpg" rel="lightbox" title="Raindrops in a spider web"><img src="http://shiftordie.de/static/photos/raindrops_blog_small.jpg" border=0/></a><br/>
<a href="http://shiftordie.de/static/photos/raindrops_blog_big.jpg" rel="lightbox" title="Raindrops in a spider web"><span style="font-family: sans-serif; text-decoration: underline; color: #333333; font-variant: small-caps">Raindrops in a spider web</span></a>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Springtime]]></title>
    <link href="http://shiftordie.de/blog/2010/03/25/springtime/"/>
    <updated>2010-03-25T22:55:00+01:00</updated>
    <id>http://shiftordie.de/blog/2010/03/25/springtime</id>
    <content type="html"><![CDATA[<p><img src="http://shiftordie.de/static/photos/fruehling.jpg"/></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Masters of Darmstadt]]></title>
    <link href="http://shiftordie.de/blog/2010/02/28/masters-of-darmstadt/"/>
    <updated>2010-02-28T13:36:00+01:00</updated>
    <id>http://shiftordie.de/blog/2010/02/28/masters-of-darmstadt</id>
    <content type="html"><![CDATA[<p>
Gestern war ich beim &raquo;Masters of Darmstadt&laquo; und habe ein paar Fotos gemacht. Hier ein paar erste Impressionen, mehr bald auf <a href="http://pics.alech.de">pics.alech.de</a>.
</p>
<p>
<p><img src="http://shiftordie.de/static/photos/DSC01667_blog.jpg"/></p>
<p><img src="http://shiftordie.de/static/photos/DSC01669-blog.jpg"/></p>
<p><img src="http://shiftordie.de/static/photos/DSC01705-blog.jpg"/></p>
<p><img src="http://shiftordie.de/static/photos/DSC01727-blog.jpg"/></p>
<p><img src="http://shiftordie.de/static/photos/DSC01751-blog.jpg"/></p>
<p><img src="http://shiftordie.de/static/photos/DSC01763-blog.jpg"/></p>
<p><img src="http://shiftordie.de/static/photos/DSC01777-blog.jpg"/></p>
<p><img src="http://shiftordie.de/static/photos/DSC01807-blog.jpg"/></p>
<p><img src="http://shiftordie.de/static/photos/DSC01828-blog.jpg"/></p>
<p><img src="http://shiftordie.de/static/photos/DSC01833-blog.jpg"/></p>
<p><img src="http://shiftordie.de/static/photos/DSC01848-blog.jpg"/></p>
<p>
F&uuml;r die Strobisten unter Euch: So sah mein Hauptsetup aus (bis einer der Snowboarder in meinen Lightstand bretterte und es dabei meinen Mittenschuh nach Minolta-Adapter zerriss):
</p>
<p><img src="http://shiftordie.de/static/photos/setup_blog.jpg"/></p>
<p>Interessant fand ich auch, dass da jede Menge Hobbyfotografen mit Strobistequipment oder sogar Studioblitzen herumsprangen, die wohl gr&ouml;&szlig;tenteils zu den Teams geh&ouml;rten.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Photo Challenge 2009: Yellow]]></title>
    <link href="http://shiftordie.de/blog/2009/02/04/photo-challenge-2009-yellow/"/>
    <updated>2009-02-04T22:32:00+01:00</updated>
    <id>http://shiftordie.de/blog/2009/02/04/photo-challenge-2009-yellow</id>
    <content type="html"><![CDATA[<p>
I have recently stumbled over the <a href="http://www.photochallenge.org">2009 Photo Challenge</a>, which provides a topic each day for a photo to be taken.</p>
<p>Today I managed to pull out my freshly acquired <a href="http://strobist.blogspot.com">Strobist</a> gear and shoot something for today&#8217;s topic, &raquo;Yellow&laquo;.</p>
<p><img src="http://shiftordie.de/static/photos/yellow_small.jpg" alt="Yellow Banana"></p>
<p>Strobist info: seamless black background, HVL-F56AM on camera right, Nikon SB-26 camera left for rim light mainly, black paper in a <a href="http://www.strobist.blogspot.com/2006/07/how-to-diy-10-macro-photo-studio.html">DIY macro studio</a>. Minolta 50/2.8 Macro & some Gimp.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[MD5 hackers]]></title>
    <link href="http://shiftordie.de/blog/2008/12/30/md5-hackers/"/>
    <updated>2008-12-30T23:46:00+01:00</updated>
    <id>http://shiftordie.de/blog/2008/12/30/md5-hackers</id>
    <content type="html"><![CDATA[<p>
I was lucky to be sitting in the speaker&#8217;s corner at 25C3 when the <a href="http://www.win.tue.nl/hashclash/rogue-ca/">MD5 hackers</a> met before the talk and was asked to take a picture of them.
</p>
<p>
I quickly set up my newly purchased <a href="http://strobist.blogspot.com">Strobist gear</a> and caught the following shot:
</p>
<p>
<a href="http://shiftordie.de/static/photos/md5_team2.jpg"><img src="http://shiftordie.de/static/photos/md5_team2_small.jpg"></a>
</p>
<p>
The uncropped version can be seen over at the <a href="http://events.ccc.de/2008/12/30/the-cat-is-out-of-the-bag/">CCC events blog</a>, and for those who need it, here is the <a href="http://shiftordie.de/static/photos/md5_team_original.jpg">original version</a> in its complete 12 MP glory. Everything is released under CC-BY, so I am happy if you use it, but please credit me accordingly (&raquo;Photo: Alexander Klink.&laquo;).
</p>
<p>
I was not quite happy with this version, but I learned the typical photographer&#8217;s problem: the subjects only have a limited amount of time. Once we (risktaker, POCsascha and myself) had set up a better version with two flashes and a softbox, they were already on their way to their talk &#8230; :-( &#8212; which was awesome, of course.
</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[DemoTag works]]></title>
    <link href="http://shiftordie.de/blog/2008/09/08/demotag-works/"/>
    <updated>2008-09-08T23:28:00+02:00</updated>
    <id>http://shiftordie.de/blog/2008/09/08/demotag-works</id>
    <content type="html"><![CDATA[<p>
Cynops recently bought a <a href="http://www.iaik.tugraz.at/research/vlsi/02_products/05_rfid_demotag/">RFID DemoTag</a>, a device that is made by the IAIK people at TU Graz. Its main use is to be able to copy a Mifare card&#8217;s &raquo;unique&laquo; ID. Not having had a reader for Mifare cards, I wasn&#8217;t able to play with it all week &#8212; not until the <a href="http://mrmcd.net">mrmcd</a>, that is.
</p>
<p>
Luckily, local and not-so-local RFID hackers where present and willing to play with it &#8212; thanks to Collin and starbug. Here are some pictures of us spoofing a Mifare card with ID &raquo;DEADBEEF&laquo; :-)
</p>
<p>
Here is the device with two different readers:<br/>
<img src="http://shiftordie.de/static/photos/mifare_setup_1.png"> <img src="http://shiftordie.de/static/photos/mifare_setup2.png">
</p>
<p>
This is how it looks on the client &#8212; you connect to the device via the serial port and tell it to be the tag with ID x, and you can see the communication between the reader and the tag:<br/>
<img src="http://shiftordie.de/static/photos/mifare_client.png">
</p>
<p>
And this is how it looks on the reader side &#8212; DEADBEEF received correctly :-)<br/>
<img src="http://shiftordie.de/static/photos/mifare_collin.png"><br/>
<img src="http://shiftordie.de/static/photos/mifare_starbug.png">
</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[mrmcd111b Vortr&auml;ge]]></title>
    <link href="http://shiftordie.de/blog/2008/09/08/mrmcd111b-vortrage/"/>
    <updated>2008-09-08T22:54:00+02:00</updated>
    <id>http://shiftordie.de/blog/2008/09/08/mrmcd111b-vortrage</id>
    <content type="html"><![CDATA[<p>
Auf den <a href="http://mrmcd.net">meta rhein main chaos days 111b</a> habe ich zwei Vortr&auml;ge gehalten.
</p>
<p>
Der erste war eine Wiederauflage meines <a href="http://shiftordie.de/articles/EuSecWest%20Slides">EuSecWest</a> Vortrags auf Deutsch &#8212; hierzu gibt es auch ein <a href="ftp://ftp.ccc.de/mrmcd/mrmcd111b/mrmcd-video/mrmcd111b-2684-de-abusing_x509_certificate_features.mp4">Video</a>.
</p>
<p>
Der zweite handelte mal wieder von OpenXPKI und war f&uuml;r eine Veranstaltung dieser Gr&ouml;&szlig;e mit ungef&auml;hr 15-20 Leuten ziemlich gut besucht. Besonders gefreut hat es mich, dass fast der komplette #openxpki-Channel anwesend war :-). Hier gibt&#8217;s die Slides:
</p>
<p>
<a href="http://shiftordie.de/static/mrmcd111b_OpenXPKI.pdf"><img src="http://shiftordie.de/static/images/mrmcd111b_OpenXPKI.png"/></a>
</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[The(?) DNS Bug]]></title>
    <link href="http://shiftordie.de/blog/2008/07/22/the-dns-bug/"/>
    <updated>2008-07-22T18:42:00+02:00</updated>
    <id>http://shiftordie.de/blog/2008/07/22/the-dns-bug</id>
    <content type="html"><![CDATA[<p>
So, it&#8217;s <a href="http://beezari.livejournal.com/141796.html">out</a>. Apparently, <a href="http://addxorrol.blogspot.com/2008/07/on-dans-request-for-no-speculation.html">Halvar</a> got pretty close and Matasano accidentally posted the whole thing on their blog &#8212; d&#8217;oh.
</p>
<p>
So, as hiding it now is definitely too late, I guess the &raquo;no speculation rule&laquo; is off the table as well. Here are some random thoughts of mine:
</p>
<p>
This is huge. It is pretty easy to exploit, so I wonder how stable DNS will be within the next few days (at work, I use a T-Mobile hotspot which apparently messes transparently with my DNS traffic, so dnscache refuses to work, thus I am vulnerable even though I could help it by running a local dnscache &#8212; bummer).
</p>
<p>
Lutz Donnerhacke keeps saying on the Heise forums that this is not Dan&#8217;s original exploit (which he claims to know, and I believe him), so I wonder whether this is something completely new or whether it&#8217;s just a variant on Dan&#8217;s exploit. On the &raquo;this is it&laquo; side is the testing of $random.toorrr.com, which closely matches the exploit scenario. Also, Dan has been looking at random subdomains of domains in the web context, which apparently with some providers don&#8217;t return NXDOMAIN but a provider specific page (this has the &#8220;nice&#8221; implication that if it can be exploited, the cookies for $domain are in danger even though the website that is compromised is not made by the real owner of $domain). 
</p>
<p>
I would guess that there are some more tricks to it, as Dan returns ::1 on AAAA queries with his (obviously custom) nameserver, so I doubt this is by accident but serves some kind of purpose. Also, all of the advisories mention the birthday paradox which has not come into play with this exploit (yet) - this is just iterative guessing, but there is no such thing as having multiple outstanding queries for the same RR or so. Furthermore, Thomas Ptacek set pretty high expectations on when he would be impressed, and apparently he was &#8230;
</p>
<p>
This exploit would be particularly easy/fast if you could generate the spoofed responses at the requesting client as well, anyone knows if this is remotely possible using Flash, Java, or some other browser-based client stuff?
</p>
<p>
Well, interesting times to be a security researcher &#8230;
</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Traversing Dan's directory]]></title>
    <link href="http://shiftordie.de/blog/2008/07/16/traversing-dans-directory/"/>
    <updated>2008-07-16T21:43:00+02:00</updated>
    <id>http://shiftordie.de/blog/2008/07/16/traversing-dans-directory</id>
    <content type="html"><![CDATA[<p>
So I guess you have all read <a href="http://www.doxpara.com/?p=1162">Dan&#8217;s post</a> (and seen <a href="http://www.youtube.com/watch?v=XDKw8ny6IcM">Sarah&#8217;s video</a>, of course :-).
</p>
<p>
&#8230; And I guess many of you have used the DNS checker on <a href="http://www.doxpara.com">doxpara.com</a> to see if your DNS is vulnerable (although, personally, I like the &#8220;dig +short porttest.dns-oarc.net TXT&#8221; method better). Well, so did I (and neither my home provider, my mobile provider nor $CUSTOMER have fixed their DNS yet) and of course using wasn&#8217;t enough, I had to look more closely at how it works &#8230;
</p>
<p>
Turns out it is doing a simple lookup on $randomstring.toorrr.com, which resolves to the webserver via a CNAME chain that encodes the interesting data from the queries that are sent out by the resolver. So what does Dan do with it then? He writes a file with the query details (requested hostname, date, source ports and query IDs) to /fprint/$randomstring on his webserver (which is automatically deleted after about two minutes or so), which the script then fetches using some AJAX-magic. Luckily for me, he forgot to turn of the directory listing on /fprint/, so not only the original requestor could download the result files, but me too.
</p>
<p>
Thus, for the last few days, I have been doing something along the lines of <tt>while true; do rm 209.200.168.66/fprint/index.html; wget -U &#8220;Hi Dan, just compiling some stats, hope you don&#8217;t mind &#8230; Alex&#8221; -r -nc -l inf http://209.200.168.66/fprint/; sleep 30; done</tt> and put the output into a database. 471690 queries later, Dan apparently noticed and put a &raquo;*laughs*&laquo; into /fprint/index.html.
</p>
Well, still enough data to produce some interesting graphs. The first one shows the number of new IPs appearing every hour and how many of those had fixed source ports and weak source ports (max(srcport) - min(srcport) < 100).
</p>
<p>
<a href="http://shiftordie.de/static/dns1.pdf"><img src="http://shiftordie.de/static/dns1.png"></a>
</p>
<p>
From here, one can already see that the red line (fixed source ports, thus apparently vulnerable to what Dan&#8217;s been cooking up) is still more than 50% of the blue one - here are the percentages of red vs. blue:
</p>
<p>
<a href="http://shiftordie.de/static/dns2.pdf"><img src="http://shiftordie.de/static/dns2.png"></a>
</p>
<p>
But of course, it is not only interesting how many new vulnerable servers are discovered, but what happens to the old ones. The next two graphs show the number of vulnerable servers at the time (some of those may have been fixed, but not retested afterwards, so take the figures with a grain of salt) and how many have been fixed.
</p>
<p>
<a href="http://shiftordie.de/static/dns3.pdf"><img src="http://shiftordie.de/static/dns3.png"></a>
</p>
<p>
<a href="http://shiftordie.de/static/dns4.pdf"><img src="http://shiftordie.de/static/dns4.png"></a>
</p>
<p>
Let&#8217;s hope that the numbers change a bit before August 6th or I guess all hell will break loose &#8230;
</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Interview on Debian OpenSSL]]></title>
    <link href="http://shiftordie.de/blog/2008/06/06/interview-on-debian-openssl/"/>
    <updated>2008-06-06T13:19:00+02:00</updated>
    <id>http://shiftordie.de/blog/2008/06/06/interview-on-debian-openssl</id>
    <content type="html"><![CDATA[<p>
Yesterday night, I was interviewed on <a href="http://www.c-radar.de">C-Radar</a>, <a href="http://www.chaos-darmstadt.de">Chaos Darmstadt</a>&#8217;s radio show on the local radio station. <a href="http://www.hcesperer.org">HC</a>, <a href="https://www.datenzone.de">Erik</a> and myself talk at length (nearly 40 minutes) about the issue and what it entails &#8212; here is the <a href="http://shiftordie.de/static/c-radar-20080605-interview-debian-openssl.mp3">recording</a>.
</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[EuSecWest Photos]]></title>
    <link href="http://shiftordie.de/blog/2008/06/01/eusecwest-photos/"/>
    <updated>2008-06-01T21:03:00+02:00</updated>
    <id>http://shiftordie.de/blog/2008/06/01/eusecwest-photos</id>
    <content type="html"><![CDATA[<p>
<a href="http://www.flickr.com/people/hirosan/">Ryo Hirosawa</a> has put up some photos from EuSecWest, including two nice panoramas made during my talk &#8212 <a href="http://www.flickr.com/photos/hirosan/2540124857/">one</a>, <a href="http://www.flickr.com/photos/hirosan/2540945284/">two</a>. I think he has captured the location quite nicely. I enjoyed the atmosphere of the <a href="http://www.soundlondon.com/">Sound Club</a>, although I heard the feedback on the location was quite mixed.
</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[EuSecWest Slides]]></title>
    <link href="http://shiftordie.de/blog/2008/05/22/eusecwest-slides/"/>
    <updated>2008-05-22T22:11:00+02:00</updated>
    <id>http://shiftordie.de/blog/2008/05/22/eusecwest-slides</id>
    <content type="html"><![CDATA[<p>
<img src="http://shiftordie.de/static/EuSecWestTitle.png" alt="Title slide"/>
</p>
<p>
I just completed my talk at EuSecWest, go <a href="http://shiftordie.de/static/EuSecWest_Abusing_X509_Certificate_Features.pdf">download the slides</a>, if you like.
</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[The Debian and OpenSSL debacle &#8212; consider your passwords compromised, too]]></title>
    <link href="http://shiftordie.de/blog/2008/05/18/the-debian-and-openssl-debacle-consider-your-passwords-compromised-too/"/>
    <updated>2008-05-18T23:23:00+02:00</updated>
    <id>http://shiftordie.de/blog/2008/05/18/the-debian-and-openssl-debacle-consider-your-passwords-compromised-too</id>
    <content type="html"><![CDATA[<p>We have been having some &raquo;fun&laquo; with the <a href="http://www.debian.org/security/key-rollover/">Debian OpenSSL debacle</a> last week. Having read the advisory and realized that the SSH list of vulnerable keys was for public exponent 35, we went on to compile our own list of vulnerable keys with public exponent 65537 (the one most often used in certificates).</p>
<p>On Thursday, we then checked all the CAs with exponent 65537 and key length 1024 or 2048 bits &#8212; luckily none of them was affected (all hell would have broken loose if one would have been) &#8230; We checked a few HTTPS webservers, and after the 70th invocation or so, we stumpled over an affected webserver at a major german financial institution. Luckily, the security scene is small, so my boss knew someone in the security team and called him up. The dialogue: &raquo;Are you sitting down? &#8230; Good. We know the private key to your webserver&laquo; led to some laughter on our side. Kudos to them, though, the problem was fixed about 2-3 hours later. I call that pretty quick for a production system (the new certificates were actually issued 15-30 minutes after we called).</p>
<p>One thing that has not been widely noted (expect for by my boss, who came up with this scenario) is that you also might want to consider your passwords compromised if they were transmitted in an SSH session where one participant had a weak OpenSSL installation. Why so, you ask? The SSH session starts with a Diffie-Hellmann key exchange. In short, the client calculates a random x and sends g^x to the server. The server in turn computes a random y and sends g^y to the client. Knowing x, the client can compute (g^y)^x = g^(y*x) = g^(x*y). The server knows y, so he can compute (g^x)^y = g^(x*y). This is now their shared secret which will be used to encrypt the further communication &#8212 including the transmission of the password, if you use password-based authentication.</p>
<p>
Now assume someone has been listening in on this key exchange and that either the client or the server was running a vulnerable OpenSSL. Without loss of generality (hah, I didn&#8217;t think I&#8217;d use that mathematician phrase ever again), let&#8217;s assume it is the client. In this case, the pseudo random number generator is flawed and x is not truly random but only one of 16k possible values. If we know all of them (they are pretty trivial to generate, possibly much faster than the list of RSA keys), we can have a look at g^x for all x and see if the result matches the value sent by the client to the server. We then know x and are thus in the same position as the client and we are able to decrypt the complete session. This means that anything in that session (your login password for the SSH session, passwords for any other servers you might have logged into, database passwords you might have entered) is now in the hands of the attacker.
</p>
<p>
To make sure that we didn&#8217;t make a mistake in our theoretical thoughts on this, I have patched my OpenSSH to output x, linked it with a vulnerable OpenSSL library and started it with the <a href="http://www.metasploit.com/users/hdm/tools/debian-openssl/">Metasplot LD_PRELOAD library</a>. And indeed, for a fixed MAGIC_PID environment variable, a fixed x is generated. This was not so easy to see in Wireshark, because apparently the server decides on the group and sends it to the client. The groups and the generator differ from time to time, so the messages that are sent are different, too. For an attacker, this does not matter though, he just needs to do some more calculations for the different parameters.
</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Installing Nexenta on USB drives]]></title>
    <link href="http://shiftordie.de/blog/2008/05/04/installing-nexenta-on-usb-drives/"/>
    <updated>2008-05-04T23:17:00+02:00</updated>
    <id>http://shiftordie.de/blog/2008/05/04/installing-nexenta-on-usb-drives</id>
    <content type="html"><![CDATA[<p>As said, I&#8217;ve been playing with <a href="http://www.nexenta.org">Nexenta</a> (OpenSolaris + GNU + APT) a bit lately. Installed just fine in a Parallels VM, but in VirtualBox, the network won&#8217;t work for some reason (tried with the latest SVN checkout, all different network adapters).
</p>
<p>
As I (currently) mainly want it for safely backing up my photos to two mirrored ZFS disks, I decided to install it using real hardware on two USB disks. After trying that, I got hit by the <a href="http://osdir.com/ml/solaris.gnusolaris.general/2006-02/msg00043.html">bad PBR sig</a> bug.
</p>
<p>
Some googling revealed that this is somehow GRUB-related and can be solved by installing GRUB again. After some twiddling, here is how it worked out for me:
<p>
<pre>
# after the installer completes, switch to screen 2 (Ctrl-a-n)
cd /.livecd/boot/grub
installgrub -m stage1 stage2 /dev/rdsk/c2t0d0s0
</pre>
</p>
<p>
As usual, your mileage (and your device file for the right disk &#8212; have a look at the installer output for that) may vary. For me, it worked just fine and tomorrow, rsync (which was already installed using apt-get install rsync &#8212; that&#8217;s how I like my Solaris) will do its share to move the photos to two USB disks &#8230;
</p>
]]></content>
  </entry>
  
</feed>
