<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Labix Blog &#187; Mobile</title>
	<atom:link href="http://blog.labix.org/tag/mobile/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.labix.org</link>
	<description>by Gustavo Niemeyer</description>
	<lastBuildDate>Fri, 09 Jul 2010 19:15:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Integrating IRC with LDAP and two-way SMSing</title>
		<link>http://blog.labix.org/2010/06/19/integrating-irc-with-ldap-and-two-way-smsing</link>
		<comments>http://blog.labix.org/2010/06/19/integrating-irc-with-ldap-and-two-way-smsing#comments</comments>
		<pubDate>Sat, 19 Jun 2010 21:56:07 +0000</pubDate>
		<dc:creator>Gustavo Niemeyer</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Erlang]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Project]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.labix.org/?p=296</guid>
		<description><![CDATA[A bit of history I don&#8217;t know exactly why, but I&#8217;ve always enjoyed IRC bots. Perhaps it&#8217;s the fact that it emulates a person in an easy-to-program way, or maybe it&#8217;s about having a flexible and shared &#8220;command line&#8221; tool, &#8230; <a href="http://blog.labix.org/2010/06/19/integrating-irc-with-ldap-and-two-way-smsing">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><b>A bit of history</b></p>
<p>I don&#8217;t know exactly why, but I&#8217;ve always enjoyed IRC bots.  Perhaps it&#8217;s the fact that it emulates a person in an easy-to-program way, or maybe it&#8217;s about having a flexible and shared &#8220;command line&#8221; tool, or maybe it&#8217;s just the fact that it helps people perceive things in an asynchronous way without much effort.  Probably a bit of everything, actually.</p>
<p><span id="more-296"></span></p>
<p>My bot programming started with <a href="http://labix.org/pybot">pybot</a> many years ago, when I was still working at <a href="http://www.conectiva.com.br">Conectiva</a>.  Besides having many interesting features, this bot eventually got in an abandonware state, since <a href="http://www.canonical.com">Canonical</a> already had pretty much equivalent features available when I joined, and I had other interests which got in the way.  The code was a bit messy as well.. it was a time when I wasn&#8217;t very used to testing software properly (a friend has a great excuse for that kind of messy software: <i>&#8220;I was young, and needed the money!&#8221;</i>).</p>
<p>Then, a couple of years ago, while working in the <a href="http://landscape.canonical.com">Landscape</a> project, there was an opportunity of getting some information more visible to the team.  Coincidently, it was also a time when I wanted to get some practice with the concepts of <a href="http://erlang.org">Erlang</a>, so I decided to write a bot from scratch with some nice support for plugins, just to get a feeling of how the promised stability of Erlang actually took place for real.  This bot is called <a href="https://launchpad.net/mup">mup</a> (Mup Pet, more formally), and its code is available publicly through <a href="https://launchpad.net/mup">Launchpad</a>.</p>
<p>This was a nice experiment indeed, and I did learn quite a bit about the ins and outs of Erlang with it.  Somewhat unexpected, though, was the fact that the bot grew up a few extra features which multiple teams in Canonical started to appreciate.  This was of course very nice, but it also made it more obvious that the egocentric reason for having a bot written in Erlang would now hurt, because most of Canonical&#8217;s own coding is done in Python, and that&#8217;s what internal tools should generally be written in for everyone to contribute and help maintaining the code.</p>
<p>That&#8217;s where the desire of migrating mup into a Python-based brain again came from, and having a new feature to write was the perfect motivator for this.</p>
<p><b>LDAP and two-way SMSing over IRC</b></p>
<p>Canonical is a <i>very</i> distributed company.  Employees are distributed over dozens of countries, literally.  Not only that, but most people also work from their homes, rather than in an office.  Many different countries also means many different timezones, and working from home with people from different timezones means flexible timing.  All of that means communication gets&#8230; well.. interesting.</p>
<p>How do we reach someone that should be in an online meeting and is not?  Or someone that is traveling to get to a sprint?  Or how can someone that has no network connectivity reach an IRC channel to talk to the team?  There are probably several answers to this question, but one of them is of course SMS.  It&#8217;s not exactly cheap if we consider the cost of the data being transfered, but pretty much everyone has a mobile phone which can do SMS, and the model is not that far away from IRC, which is the main communication system used by the company.</p>
<p>So, the itch was itching.  Let&#8217;s scratch it!</p>
<p>Getting the mobile phone of employees was already a solved problem for mup, because it had a plugin which could interact with the LDAP directory, allowing people to do something like this:</p>
<blockquote><p>
&lt;joe&gt; mup: poke gustavo<br />
&lt;mup&gt; joe: niemeyer is Gustavo Niemeyer &lt;&#8230;@canonical.com&gt; &lt;time:&#8230;&gt; &lt;mobile:&#8230;&gt;
</p></blockquote>
<p>This just had to be migrated from Erlang into a Python-based brain for the reasons stated above. This time, though, there was no reason to write something from scratch.  I could even have used pybot itself, but there was also <a href="http://sourceforge.net/projects/supybot/">supybot</a>, an IRC bot which started around the same time I wrote the first version of pybot, and unlike the latter, supybot&#8217;s author was much more diligent in evolving it.  There is quite a comprehensive list of plugins for supybot nowadays, and it includes means for testing plugins and so on.  The choice of using it was straighforward, and getting &#8220;<i>poke</i>&#8221; support ported into a plugin wasn&#8217;t hard at all.</p>
<p>So, on to SMSing.  Canonical already had a contract with an SMS gateway company which we established to test-drive some ideas on <a href="https://landscape.canonical.com">Landscape</a>. With the mobile phone numbers coming out of the LDAP directory in hands and an SMS contract established, all that was needed was a plugin for the bot to talk to the SMS gateway.  That &#8220;conversation&#8221; with the SMS gateway allows not only sending messages, but also receiving SMS messages which were sent to a specific number.</p>
<p>In practice, this means that people which are connected to IRC can very easily deliver an SMS to someone using their nicks.  Something like this:</p>
<blockquote><p>
&lt;joe&gt; @sms niemeyer Where are you?  We&#8217;re waiting!
</p></blockquote>
<p>And this would show up in the mobile screen as:</p>
<blockquote><p>
joe&gt; Where are you?  We&#8217;re waiting!
</p></blockquote>
<p>In addition to this, people which have <i>no connectivity</i> can also contact individuals and channels on IRC, with mup working as a middle man.  The message would show up on IRC in a similar way to:</p>
<blockquote><p>
&lt;mup&gt; [SMS] &lt;niemeyer&gt; Sorry, the flight was delayed. Will be there in 5.
</p></blockquote>
<p>The communication from the bot to the gateway happens via plain HTTPS.  The communication back is a bit more complex, though.  There is a small proxy service deployed in <a href="http://code.google.com/appengine">Google App Engine</a> to receive messages from the SMS gateway.  This was done to avoid losing messages when the bot itself is taken down for maintenance.  The SMS gateway doesn&#8217;t handle this case very well, so it&#8217;s better to have something which will be up most of the time buffering messages.</p>
<p>A picture is worth 2<sup>10</sup> words, so here is a simple diagram explaining how things got linked together:</p>
<p><a href="http://blog.labix.org/wp-content/uploads/2010/06/mup-sms.png"><img src="http://blog.labix.org/wp-content/uploads/2010/06/mup-sms.png" alt="" title="SMS integration diagram" width="449" height="255" class="aligncenter size-full wp-image-308" /></a></p>
<p>This is now up for experimentation, and so far it&#8217;s working nicely.  I&#8217;m hoping that in the next few weeks we&#8217;ll manage to port the rest of mup into the supybot-based brain.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.labix.org/2010/06/19/integrating-irc-with-ldap-and-two-way-smsing/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Breaking into an Android password manager &#8211; Practice</title>
		<link>http://blog.labix.org/2009/12/05/breaking-into-an-android-password-manager-practice</link>
		<comments>http://blog.labix.org/2009/12/05/breaking-into-an-android-password-manager-practice#comments</comments>
		<pubDate>Sun, 06 Dec 2009 00:38:11 +0000</pubDate>
		<dc:creator>Gustavo Niemeyer</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Puzzle]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://blog.labix.org/?p=230</guid>
		<description><![CDATA[In the last post, we&#8217;ve seen some security issues which exist in the Android password manager gbaSafe version 1.1.0a, by analyzing the security description provided in its web site. As described there, even though the system depends on a &#8220;master &#8230; <a href="http://blog.labix.org/2009/12/05/breaking-into-an-android-password-manager-practice">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://blog.labix.org/2009/12/01/breaking-into-an-android-password-manager-theory">the last post</a>, we&#8217;ve seen some security issues which exist in the Android password manager <a href="http://www.gbizapps.com/gbasafe.htm">gbaSafe</a> version 1.1.0a, by analyzing the security description provided in its web site.  As described there, even though the system depends on a &#8220;master key&#8221; which might be secure, the security of the system is seriously compromised by the encouragement of very weak keys (a few <i>digits</i> only) in what is named an &#8220;unlock key&#8221;, used to encrypt the master key itself.  All of that in an application which claims to strongly <i>protect</i> people&#8217;s data from unwanted eyes.</p>
<p>In this post, we will play a bit with the Linux-based Android OS to actually explore these security deficiencies, demonstrating that such issues are very real, and that the claims of being hard to unveil the data is unfounded.  Since the most serious weakness lies in the key itself, we&#8217;ll run a simple brute force attack to try to find arbitrary unlock keys.</p>
<p><span id="more-230"></span></p>
<p>This procedure is actually mentioned by the author of gbaSafe himself in the web page, except he overestimates the work involved in producing such a mechanism:</p>
<blockquote><p>
Theoretically, somebody could write a program that tries to decrypt the master key by trying all possible values of the short key (with 4 digits there are only 10000 possibilities), but this would still be much work, as more information about the crypting algorithm is needed (e.g. salt bytes, iteration count).
</p></blockquote>
<p>So let&#8217;s get started.</p>
<p>As a first step, we&#8217;ll need the <a href="http://developer.android.com/sdk/index.html">Android SDK</a> with a working emulator (I&#8217;ve used API level 5, revision 1), and a copy of the application itself.  I got a <a href="http://andappstore.com/AndroidApplications/apps/gbaSafe_Password_Safe">trial version of the application</a> from <a href="http://andappstore.com/">AndAppStore.com</a>.</p>
<p>The application downloaded is bundled within that <i>.apk</i> file, which is really a <i>.zip</i> file that may be opened up normally with any tool which understands this file format.</p>
<p>Once that&#8217;s done, we get access to all the information needed to run the application, including icons, interface layouts, and most importantly in this case, the bytecode which targets the <a href="http://en.wikipedia.org/wiki/Dalvik_virtual_machine">Dalvik VM</a>.   This bytecode is the end result of a sequence of translations which happen when the program&#8217;s Java source code is compiled, so that&#8217;s what we&#8217;ll have to fiddle with to figure details of the application we want to investigate.</p>
<p>The bytecode is located inside the <i>classes.dex</i> file, and as expected it&#8217;s not easy to read in its native format.  Luckily, though, a smart guy has already written a couple of tools, <a href="http://code.google.com/p/smali/">smali and baksmali</a>, which allow people to decompile and recompile that bytecode format to/from something that is much easier to understand.</p>
<p>After downloading these tools, the following command should decompile the file:</p>
<blockquote><p>
$ java -jar baksmali.jar &#8211;output classes classes.dex
</p></blockquote>
<p>We now have a <i>classes/</i> directory full of <i>.smali</i> files.</p>
<p>Before going any further, let&#8217;s ponder for a moment about what we want to do.  A brute force attack is when we attempt sequentially many possible keys, and given the context already presented, what we&#8217;re looking after is to attempt different &#8220;unlock keys&#8221;.  With that in mind, we&#8217;ll introduce a very small modification in the application so that it will attempt to enter the unlock key automatically, rather than reporting an error when the key entered in the unlock dialog is invalid.</p>
<p>With that in mind, after some quick research, it looks like the <i>onClick()</i> method within the <i>DlgUnlock.smali</i> file is a pretty good candidate.  This is supposedly called when the button in the unlock dialog is clicked, so something interesting about the password being correct or not must happen there.</p>
<p>Before doing anything there, I&#8217;ve increased the number of registers in the function to 12, to get some additional registers to play with, and then initialized a register with the value zero, to serve as a monotonically increasing number (our keys!):</p>
<blockquote><p>
 .method public onClick(Landroid/view/View;)V<br />
-    .registers 9<br />
+    .registers 12<br />
     .parameter &#8220;view&#8221;<br />
+    const/16 v9, 0&#215;0
</p></blockquote>
<p>Then, we have to instruct the program to use these keys rather than whatever is typed in the dialog box.  Some lines down, we&#8217;ll see a call to the <i>checkUnlockKey()</i> method, which is certainly what we&#8217;re looking after.  Let&#8217;s do this now:</p>
<blockquote><p>
+    :mykey<br />
+    invoke-static {v9}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;<br />
+    move-result-object v2<br />
     invoke-static {v2}, Lcom/gbizapps/safeA/Crypt;->checkUnlockKey(Ljava/lang/String;)I
</p></blockquote>
<p>Now, what if this key is wrong?  We don&#8217;t want the master key to be removed as mentioned in the software description.  We want to simply attempt the next key.  With some analysis, we see that in case of errors, the next couple of lines below the above code will instruct the VM to jump to an error branch.  Rather than following up with the normal error logic, we&#8217;ll increment the key, and jump back to the above code:</p>
<blockquote><p>
     :cond_6c<br />
+    add-int/lit8 v9, v9, 0&#215;1<br />
+    goto :mykey
</p></blockquote>
<p>Now we just have to rebundle this and put it into the emulator.  I won&#8217;t go over it in too much detail here, since there&#8217;s plenty of information available online, but the steps to do that are:</p>
<ol>
<li>Recreate a modified classes.dex with <i>smali</i>
<li>Recreate a modified <i>.apk</i> file by just zipping the modified content
<li>Sign and zipalign the new <i>.apk</i> file
<li>Install it
</ol>
<p>And that&#8217;s it, seriously!  This would be enough to break the software security if it was working <i>correctly</i>.</p>
<p>Interestingly, though, the software <i>wasn&#8217;t</i> working correctly with this change.  Instead, it was <i>Force Closing</i> on certain keys.   To test it out, use the master key &#8220;master key&#8221;, and the unlock key &#8220;999999&#8243;, and then once you close and open the application again, try to unlock it with the key &#8220;1175&#8243;.  Instead of showing an error message, it will break badly.</p>
<p>Now, for the proof of concept to work, I actually had to <i>fix</i> the bug, which felt a bit funny to do given the context.</p>
<p>Looking at the traceback trough <i>adb logcat</i>, I found out that there was a null being dereferenced in the file <i>Crypt.smali</i>, so I fixed the problem by injecting some error checking at this position and jumping the flow into an existing error branch:</p>
<blockquote><p>
+    if-eqz v3, :cond_5a<br />
     const-string v4, &#8220;ucpmhkexov85MDKhdfdfFGQPYxywq7209fcrqhghjkuiopy&#8221;
</p></blockquote>
<p>With this in place came the biggest surprise of the experiment. The keys which were crashing the application were special, in the sense that they actually <i>decode the master key successfully</i>!  That&#8217;s right: whatever the algorithm is doing, that six-digit &#8220;999999&#8243; encrypts the master key in such a way that attempting the &#8220;1175&#8243; key works, so even big keys are rendered extremely weak with the logic used to encrypt the master key.</p>
<p>At this point, I added some trivial logic to display the key found with a <a href="http://developer.android.com/reference/android/widget/Toast.html">Toast</a>, just to ensure the whole thing was working correctly:</p>
<p><img src="http://blog.labix.org/wp-content/uploads/2009/12/device.png" alt="Toast displaying unlock key found" title="Toast displaying unlock key found" width="320" height="480" class="aligncenter size-full wp-image-242" /></p>
<p>Note that the key generation implemented above is a bit simplistic, in the sense that it doesn&#8217;t attempt keys with leading zeros, but this would be trivial to implement, and my intention here isn&#8217;t to actually break any keys for real, but just to show how the promised security in this application is not to be trusted at all.  Just the logic above will already be enough for a brute force attack against the application, and has broken all the keys I&#8217;ve tried in mere seconds, in a <i>slow emulator</i>.</p>
<p>As a conclusion, if you want to put your data in a secure place, rather than picking an application which promises security because <i>the salt is hidden somewhere</i> or because it&#8217;s <i>too much work to figure its logic</i>, pick an open source application with logic which is publicly verifiable and has already had many eyes over it.  Chances are that doing something like what was described in this post won&#8217;t be so trivial.  Then, <i>choose your keys wisely</i>!  The most secure application won&#8217;t be enough if you pick a bad key.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.labix.org/2009/12/05/breaking-into-an-android-password-manager-practice/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Breaking into an Android password manager &#8211; Theory</title>
		<link>http://blog.labix.org/2009/12/01/breaking-into-an-android-password-manager-theory</link>
		<comments>http://blog.labix.org/2009/12/01/breaking-into-an-android-password-manager-theory#comments</comments>
		<pubDate>Wed, 02 Dec 2009 01:33:16 +0000</pubDate>
		<dc:creator>Gustavo Niemeyer</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Puzzle]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://blog.labix.org/?p=203</guid>
		<description><![CDATA[For some time now I&#8217;ve been wanting to research more deeply about the internals of Android. Until now, though, this was just a sentiment. Then, a couple of weeks ago I&#8217;ve finally managed to replace my iPhone for an Android &#8230; <a href="http://blog.labix.org/2009/12/01/breaking-into-an-android-password-manager-theory">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>For some time now I&#8217;ve been wanting to research more deeply about the internals of <a href="http://www.android.com">Android</a>.  Until now, though, this was just a sentiment.  Then, a couple of weeks ago I&#8217;ve finally managed to replace <a href="http://blog.labix.org/2009/06/30/my-iphone-for-an-android">my iPhone for an Android</a> phone, and that was the final motivator for me to actually get into learning more about the inner workings of the Linux-based OS.</p>
<p>Now, I just had to pick an actual task for digging into.  The Dalvik VM is certainly one of the most innovative and advertised technical details about the OS, so something around it would be a nice start.. some kind of bytecode fiddling perhaps, but what?  Luckily, even without trying too hard, I eventually stumbled upon an interesting case for researching upon.</p>
<p>The &#8220;victim&#8221; of this research is the application <a href="http://www.gbizapps.com/gbasafe.htm">gbaSafe</a> version 1.1.0a, which claims to protect user passwords using <i>unbreakable algorithms</i> (how&#8217;s that for a hint of a <a href="http://en.wikipedia.org/wiki/Snake_oil_(cryptography)">Snake oil</a> case?).</p>
<p><span id="more-203"></span></p>
<p>Before we get into some hacking, let&#8217;s see some words on the software security by the author himself, and then render some analysis on conceptual issues on it:</p>
<blockquote><p>
The confidential data can only be decrypted if the master key is known. You should choose a long key (at least 16 characters) with mixed case and unreadable text. Of course you cannot enter this key each time you want to access the confidential data, so it is stored in the user settings encrypted with a shorter key (4 to 6 digits) and normally you only have to enter this unlock key. Theoretically it is possible to try all possible values (brute force attack), but then you must use another program, since gbaSafe deletes the encrypted master key from the user settings when you enter the unlock key wrong three times repeatedly, and then you must enter the master key. If you wrote a program to decrypt the master key, you would have to know the algorithm used, the salt bytes and iteration count (used to augment the short unlock key), which are very hard to extract from the binary program module gbaSafe.
</p></blockquote>
<p>If you have some security background, I&#8217;m sure that by now you&#8217;re already counting the issues on this single paragraph.</p>
<p>The most obvious issue is the fact that there&#8217;s a &#8220;strong key&#8221; and a &#8220;weak key&#8221;, and the strong key is encrypted with the weak one.  This is a very common cryptography sin, as would say my friend and coworker Andreas Hasenack (a security researcher himself).  A security system is only as secure as its weakest spot.  It obviously makes little difference for an attacker if he has to attempt decrypting a master key or the actual data, since decrypting the master key will give access to the data.</p>
<p>Then, it mentions en passant that the software <i>enforces</i> the use of <i>digits</i> for the weak key.  This ensures that the weak key is <i>really</i> weak!  Four digits is basically ten thousand attempts, which is absolutely nothing for nowadays&#8217;s hardware.  This number would move up to about 15 million by simply allowing upper and lowercase letters as well (which isn&#8217;t great either, but a few orders of magnitude never hurt in this scenario).</p>
<p>It follows up encouraging people to think that it&#8217;s actually hard to figure the algorithm and other implementation details.  Considering that there&#8217;s absolutely nothing preventing people from getting their hands in the implementation itself, this is in fact asserting that the security mechanism is based on the ignorance of the attacker.  Counting on the ignorance of people is bad at all times, and in a security context it&#8217;s a major error.</p>
<p>There&#8217;s a final security issue in this description which is a bit more subtle, but further analysis on the logic used leaves no doubt.  In cryptography, the <a href="http://en.wikipedia.org/wiki/Salt_(cryptography)">salt</a> is supposed to increase the work needed in a brute force attack by strengthening the number of bits of the actual passphrase, in a case where the salt is <i>actually</i> unavailable, or at least prevent that a single large word dictionary can be used to attack several encryptions or hashes at once, in a case where the salt is known but variable.  In the latter case, it helps because encrypting a single key with two different salts must be done twice, rather than once, so it increases the computational task when attacking multiple items.  A salt which is known and does not change across all processed items is worth pretty close to nothing.</p>
<p>So, indeed, considering the many security issues here, this isn&#8217;t something I&#8217;d store my passwords or credit card numbers on, and I suggest you don&#8217;t do it either.</p>
<p>In my next post on this topic I&#8217;ll actually implement a trivial brute force attack to prove that these issues are <i>very</i> real, and that, actually, it&#8217;s not even hard to break into a security system like this.</p>
<p>The application author has been contacted about this blog post, since he&#8217;ll likely want to fix some of these issues.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.labix.org/2009/12/01/breaking-into-an-android-password-manager-theory/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Geocaching on the Easter Island</title>
		<link>http://blog.labix.org/2009/10/13/geocaching-on-the-easter-island</link>
		<comments>http://blog.labix.org/2009/10/13/geocaching-on-the-easter-island#comments</comments>
		<pubDate>Tue, 13 Oct 2009 23:05:47 +0000</pubDate>
		<dc:creator>Gustavo Niemeyer</dc:creator>
				<category><![CDATA[GPS]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Project]]></category>

		<guid isPermaLink="false">http://blog.labix.org/?p=155</guid>
		<description><![CDATA[This post is not about what you think it is, unfortunately. I actually do hope to go to the Easter Island at some point, but this post is about a short story which involves geohash.org, Groundspeak (from geocaching.com), and very &#8230; <a href="http://blog.labix.org/2009/10/13/geocaching-on-the-easter-island">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This post is not about what you think it is, unfortunately.  I actually do hope to go to the Easter Island at some point, but this post is about a short story which involves <a href="http://geohash.org">geohash.org</a>, <a href="http://geocaching.com">Groundspeak (from geocaching.com)</a>, and very very poor minded behavior.</p>
<p><b>The context</b></p>
<p>So, before anything else, it&#8217;s important to understand what geohash.org is.  As <a href="http://blog.labix.org/2008/02/26/geohashorg-is-public">announced</a> when the service was launched (also as a <a href="http://forums.groundspeak.com/GC/index.php?showtopic=186412">post on Groundspeak&#8217;s own forum</a>), geohash.org offers short URLs which encode a latitude/longitude pair, so that referencing them in emails, forums, and websites is more convenient, and that&#8217;s pretty much it.</p>
<p><span id="more-155"></span></p>
<p>When people go to geohash.org, they can enter geographic coordinates that they want to encode, and they get back a nice little map with the location, some links to useful services, and most importantly the actual Geohash they can use to link to the location, so as an example they could be redirected to the URL <a href="http://geohash.org/6gkzwgjf3">http://geohash.org/6gkzwgjf3</a>.</p>
<p>Of course, it&#8217;s pretty boring to be copy &#038; pasting coordinates around, so shortly after the service launched, the support for geocoding addresses <a href="http://blog.labix.org/2008/03/01/enhancements-on-geohashorg">was also announced</a>, which means people could type a human oriented address and get back the Geohash page for it.  Phew.. much more practical.</p>
<p><b>The problem</b></p>
<p>All was going well, until a couple of months ago, when a user reported that the geocoding of addresses wasn&#8217;t working anymore.  After some investigation, it turned out that geohash.org was indeed going over the free daily quota allowed by the geocoding provider used.   But, that didn&#8217;t quite fit with the overall usage reports for the system, so I went on to investigate what was up in the logs.</p>
<p><b>The cause</b></p>
<p>Something was wrong indeed.  The system was getting thousands of queries a day from some application, and not only that, but the queries were entirely unrelated to Geohashes.  The application was purely interested in the geocoding of addresses which the site supported for the benefit of Geohash users.  Alright, that wasn&#8217;t something nice to do, but I took it lightly since the interface implemented could perhaps give the impression that the site was a traditional geocoding system.  So, to fix the situation, the non-Geohash API was removed at this point, and requests for the old API then started to get an error saying something like <i>403 Forbidden: For geocoding without geohashes, please look elsewhere.</i>.</p>
<p>Unfortunately, that wasn&#8217;t the end of the issue.  Last week I went on to see the logs, and the damn application was back, and this time it was using Geohashes, so I became curious about who was doing that.  Could I be mistakingly screwing up some real user of Geohashes?  So, based on the logs, I went on to search for who could possibly be using the system in such a way.  It wasn&#8217;t too long until I found out that, to my surprise, it was <a href="http://www.geocaching.com/iphone/">Groundspeak&#8217;s iPhone application</a>.  Groundspeak&#8217;s <i>paid</i> iPhone application, to be more precise, because the address searching feature is only available for <i>paying</i> users.</p>
<p>Looking at the <a href="http://forums.groundspeak.com/GC/index.php?showtopic=228305">release notes</a> for the application, there was no doubt.  Version 2.3.1, sent to Apple on September 10th, shortly after the old API was blocked, <i>fixes the Search by Address/Postal Code feature</i> says the maintainer, and there&#8217;s even a <a href="http://forums.groundspeak.com/GC/index.php?showtopic=230624">thread discussing the breakage</a> where the maintainer mentions:</p>
<blockquote><p>
The geocoding service we&#8217;ve been using just turned their service off. That&#8217;s why things are failing; it was relying on an external service for this feature. We&#8217;re fixing the issue on our end and using a service that shouldn&#8217;t fail as easily. Unfortunately we&#8217;ll have to do an update to the store to get this feature out to the users. This will take some time, but in version 2.4 this will work.
</p></blockquote>
<p>Wait, ok, so let&#8217;s see this again.  First, they were indeed <i>not</i> using Geohashes at all, and instead using geohash.org purely as a geocoding service.  Then, when the API they used is disabled with hints that the Geohash service is not a pure geocoding service, they workaround this by <i>decoding</i> the Geohash retrieved and grabbing the coordinates so that they can still use it as a pure geocoding service.  At the same time, they tell their users that they changed to <i>&#8220;a service that shouldn&#8217;t fail as easily&#8221;</i>.  Under no circumstances they contact someone at geohash.org to see what was going on (shouldn&#8217;t be necessary, really, but assuming immaculate innocence, sending an email would be pretty cool).</p>
<p><b>Redirecting users to the Easter Island</b></p>
<p>So, yeah, sorry, but I didn&#8217;t see many reasons to sustain the situation.  Not only because it looks like an unfriendly behavior overall, but also because, on their way of using an unrelated free service to sustain their paid application, they were killing the free geocoding feature of geohash.org with thousands of geocoding requests a day, which impacted on the daily quota the service has by itself.</p>
<p>So, what to do?  I could just disable the service again, or maybe contact the maintainers and ask them to please stop using the service in such a way, after all there are <a href="http://www.google.com/search?q=geocode">dozens of real geocoding services out there</a>!  But&#8230; hmmm&#8230; I figured a friendly poke could be nice at this point, before actually bringing up that whole situation.</p>
<p>And that&#8217;s what happened: rather than blocking their client, the service was modified so that <i>all</i> of their geocoding requests translated into the geographic coordinates of the <a href="http://geohash.org/3e4jxq9:Easter_Island">Easter Island</a>.</p>
<p>Of course, users quickly noticed it and started <a href="http://forums.groundspeak.com/GC/index.php?showtopic=233335">reporting the problem again</a>.</p>
<p><b>The answer from Groundspeak</b></p>
<p>After users started complaining loudly, Bryan Roth, which signs as co-founder of Groundspeak, finally contacted me for the first time asking if there was a way to keep the service alive.  Unfortunately, I really can&#8217;t, and provided the whole explanation to Bryan, and even mentioned that I actually use Google as the upstream geocoding provider and that I would be breaking the terms of service doing this, but offered to redirect their requests to their own servers if necessary.</p>
<p>Their answer to this?  Pretty bad I must say.  I got nothing via email, but they <a href="http://forums.groundspeak.com/GC/index.php?showtopic=233335">posted this in the forum</a>:</p>
<blockquote><p>
But seriously, this bug actually has nothing to do with our app and everything to do with the external service we&#8217;ve been using to convert an address into GPS coordinates. For the next app update, we&#8217;re completely dropping that provider since they&#8217;ve now failed us twice. We&#8217;ll be using only Google from that point on, so hopefully their data will be more accurate.
</p></blockquote>
<p>I can barely believe what I read.  They blame the upstream service, as if they were using a first class geocoding provider somewhere rather than sucking resources from a site they felt cool to link their paid application to, take my suggestion of using Google for geocoding, and lie about the fact that the data would be more accurate (it obviously can&#8217;t, since it was already Google that was being used).</p>
<p>I mentioned something about this in the forum itself, but I was moderated out immediately of course.</p>
<p>Way to go Groundspeak.</p>
<p><b>UPDATE</b></p>
<p>After some back and forth with Bryan and Josh, the last post got edited away to avoid the misleading details, and Bryan clarified the case in the forum.  Then, we actually settled on my proposal of redirecting the iPhone Geocaching.com application requests to Groundspeak&#8217;s own servers so that users of previous versions of the application wouldn&#8217;t miss the feature while they work on the new release.</p>
<p>If such communication had taken place way back when the feature was being planned, or when it was &#8220;fixed&#8221; the first time, the whole situation would never have happened.</p>
<p>No matter what, I&#8217;m glad it ended up being sorted towards a more friendly solution.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.labix.org/2009/10/13/geocaching-on-the-easter-island/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>My iPhone for an Android!</title>
		<link>http://blog.labix.org/2009/06/30/my-iphone-for-an-android</link>
		<comments>http://blog.labix.org/2009/06/30/my-iphone-for-an-android#comments</comments>
		<pubDate>Wed, 01 Jul 2009 02:50:11 +0000</pubDate>
		<dc:creator>Gustavo Niemeyer</dc:creator>
				<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://blog.labix.org/?p=123</guid>
		<description><![CDATA[Yes, you&#8217;ve heard it right. I&#8217;ll exchange a legally unlocked iPhone 3G for a recent Android phone such as the Samsung Galaxy or the HTC Hero, and will pay the difference back! (street price minus 30% of devaluation for the &#8230; <a href="http://blog.labix.org/2009/06/30/my-iphone-for-an-android">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Yes, you&#8217;ve heard it right.  I&#8217;ll exchange a legally unlocked iPhone 3G for a recent Android phone such as the <a href="http://www.phonearena.com/htmls/Samsung-Galaxy-I7500-Preview-review-r_2173.html">Samsung Galaxy</a> or the <a href="http://www.engadget.com/2009/06/24/htc-hero-hands-on/">HTC Hero</a>, and will pay the difference back! (street price minus 30% of devaluation for the used iPhone 3G).</p>
<p>I got an iPhone some time ago to learn the concepts introduced in the platform, and get a feeling of how it works out in practice.  I&#8217;m happy I did it, since the hands on experience is worthwhile.  But the experience is done, and even though I have positive things to say about the platform, the <a href="http://toucharcade.com/2009/06/20/full-commodore-64-emulator-rejected-from-app-store/">omnipotent</a> <a href="http://apple.slashdot.org/article.pl?sid=09/05/03/029249">and</a> <a href="http://news.cnet.com/apple-rejects-nine-inch--nails-iphone-app-update/">arrogant</a> <a href="http://arstechnica.com/apple/news/2008/09/apple-rejects-another-app-for-duplicating-functionality.ars">position</a> <a href="http://www.eff.org/deeplinks/2009/06/oh-come-apple-reject">of</a> <a href="http://www.engadget.com/2009/05/11/apple-rejects-bittorrent-control-app-from-app-store-because-it-m/">Apple</a> <a href="http://www.macnn.com/articles/09/05/21/apple.rejects.ebook.reader/">with</a> <a href="http://www.macworld.com/article/139316/2009/03/tweetie_rejection.html">developers</a> kills any chance of any further involvement I could have with the platform.  I&#8217;m upset enough with it that I don&#8217;t want to see my wife using the device either.</p>
<p>There are many things in Apple&#8217;s behavior which are a source of arguments, and interminable flamewars, and most of the times I can see both sides of the story.  For instance, when people pay a premium to get the hardware, some feel like it&#8217;s just throwing money away, but if there is good engineering behind it, well.. I understand people may want to pay the premium to get that exclusive product they like.  That said, being so incredibly arrogant in the marketplace, and with <i>developers</i>, which theoretically should be their most precious partners, since they sustain the platform going, is something I can&#8217;t tolerate.</p>
<p>I know.. who am I.  Just a random guy that actually gave them some money for one of their products.  But I&#8217;m also a guy that won&#8217;t be buying their upgraded phones, and will be spreading the word to make people realize what a terrible future it will be if Apple ever dominates the marketplace.   Even you&#8217;re not a developer, it&#8217;s a good idea to ponder carefully about this behavior.  It tells a lot about how far they go to defend their own interests, and what kind of <i>lock in</i> they intend to get you into.</p>
<p>Finally, compare that to a <a href="http://planetandroid.com/">nice open source operating system</a> on which <a href="http://www.openhandsetalliance.com/index.html">multiple first class vendors are cooperating</a>.  Sheeshh.. easy choice for me.</p>
<p><b>Update on November 29th</b></p>
<p>I actually got an HTC Hero for a couple of weeks now, and I&#8217;m quite happy with it so far.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.labix.org/2009/06/30/my-iphone-for-an-android/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Are you ready for the mobile revolution?</title>
		<link>http://blog.labix.org/2009/06/23/are-you-ready-for-the-mobile-revolution</link>
		<comments>http://blog.labix.org/2009/06/23/are-you-ready-for-the-mobile-revolution#comments</comments>
		<pubDate>Wed, 24 Jun 2009 00:58:44 +0000</pubDate>
		<dc:creator>Gustavo Niemeyer</dc:creator>
				<category><![CDATA[GPS]]></category>
		<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://blog.labix.org/?p=113</guid>
		<description><![CDATA[Are you? I&#8217;m not entirely sure I am, even though I think about this a lot. If you&#8217;re of the tech-savvy kind, you&#8217;re certainly aware of the great capabilities that the new mobile phone generation is bringing: Internet connection, a &#8230; <a href="http://blog.labix.org/2009/06/23/are-you-ready-for-the-mobile-revolution">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Are you?  I&#8217;m not entirely sure I am, even though I think about this a lot.</p>
<p>If you&#8217;re of the tech-savvy kind, you&#8217;re certainly aware of the great capabilities that the <a href="http://planetandroid.com/">new mobile phone generation</a> is bringing: Internet connection, a quite decent browser, GPS, camera, etc.  But, really.. did you stop to think about what&#8217;s going on?  This phone generation is still relatively expensive today, but <a href="http://www.engadget.com/2009/05/28/google-at-least-18-android-phones-coming-this-year/">they&#8217;re here to stay</a>, and in just a few years, they&#8217;ll be commonplace.</p>
<p>Now, let&#8217;s forget about ourselves for a moment, and think about what <i>mass adoption</i> of a quite capable generic computer with full internet connectivity 24h a day being carried with its owner means for the world?  Remember, the <a href="http://www.guardian.co.uk/technology/2008/sep/26/mobilephones.unitednations">number of mobile phone users in the world</a> is several times superior to the  <a href="http://www.gizmodo.com.au/2008/06/1_billion_computers_now_in_use_not_necessarily_useful-2/">number of computers</a>, and most of the computers are in the so called <i>first world</i>.</p>
<p>This implies that not only will everyone have access to the world in their pockets, which is already quite amazing by itself, but that a large number of people will have access to the Internet <i>at all</i> for the first time with their mobiles.  Besides the several social impacts that these changes will bring, there are also many other interesting consequences.  As simple examples,  the <i>most common client</i> to many web services will be mobile phones, and many people will learn to use a touch screen interface of the mobile to interact with the world before ever having used a desktop computer for that.</p>
<p>I find that amazing, and this is happening right now, in front of our eyes.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.labix.org/2009/06/23/are-you-ready-for-the-mobile-revolution/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
