{"id":392,"date":"2010-02-08T22:38:20","date_gmt":"2010-02-08T21:38:20","guid":{"rendered":"http:\/\/signal.eu.org\/blog\/?p=392"},"modified":"2010-02-09T19:06:18","modified_gmt":"2010-02-09T18:06:18","slug":"android-pattern-locking-an-horror-story","status":"publish","type":"post","link":"https:\/\/signal.eu.org\/blog\/2010\/02\/08\/android-pattern-locking-an-horror-story\/","title":{"rendered":"Android pattern locking: a horror story"},"content":{"rendered":"\n<div class=\"twitter-share\"><a href=\"https:\/\/twitter.com\/intent\/tweet?via=pbeyssac\" class=\"twitter-share-button\">Tweet<\/a><\/div>\n<p>45 seconds of play, ~5 hours of desperate hacking.<\/p>\n<p>A few days ago, my 4 year old daughter was playing with my mobile phone running Android 1.6. To let her play with the screen while avoiding any mishap, I locked the phone. It was obviously not enough, she instantly found the MENU key to unlock it.<\/p>\n<p>So I had the brilliant idea to put on a <a href=\"http:\/\/beust.com\/weblog2\/archives\/000497.html\">locking pattern<\/a>, the pretty method used on Android to really lock the screen.<\/p>\n<p>After 5 unsuccessful tries, which my daughter reached in about 15 seconds, the pattern unlocking incurs a 30-second guard delay. I decided that the game was too risky (I found out later there&#8217;s also a 20-try hard limit, but we didn&#8217;t reach it) and took my phone back.<\/p>\n<p>There, I had another brilliantly fatal idea: I clicked on the &#8220;forgot the unlock pattern&#8221; button which just appeared, just out of curiosity to see what would happen next. The phone asked for my Gmail account and password. I filled the requested information, but it didn&#8217;t unlock the phone; apparently this is a <a href=\"http:\/\/androidforums.com\/motorola-droid\/15918-major-flaw-pattern-lock-how-brick-your-droid.html\">known Android bug<\/a> that I didn&#8217;t know about. And, contrary to what I naively assumed, there was no way to get back to the unlock pattern screen. I rebooted the phone. No change, no escape.<\/p>\n<p>Then it dawned on me that I was 600 kilometers away from home, for almost a full week, without all my computer tools. And I was locked out of my own phone.<\/p>\n<p><!--more-->On the plus side, I had another almost usable (EDGE) mobile connection, and quickly found out a hack to <a href=\"http:\/\/forum.xda-developers.com\/archive\/index.php\/t-485988.html\">clear the lock pattern<\/a> using the Android SDK tools. I needed a Windows or Linux PC, but I had one at hand.<\/p>\n<p>So I happily began downloading the 23 MB <a href=\"http:\/\/developer.android.com\/sdk\/index.html\">Android SDK<\/a> zip file. It stuck at 5 MB. I tried again. It stuck again at the same size. Something crappy, either (most probably) in my mobile provider&#8217;s network or Google servers.<\/p>\n<p>Long story short: I <a href=\"http:\/\/www.openssh.org\/\">ssh<\/a>&#8216;d at home to get the SDK through <a href=\"http:\/\/www.gnu.org\/software\/wget\/\">wget<\/a>. <a href=\"http:\/\/www.openssh.org\/\">scp&#8217;<\/a>d it. Got stuck at 5 MB again. <a href=\"http:\/\/www.openssh.org\/\">sftp<\/a>&#8216;d it in 5 MB chunks instead. Finally got it where I needed it. Installed it, started it. Discovered that I needed to fetch the USB driver for Android&#8230; which is a 6 MB download. I&#8217;m sure you can guess what happened next; no <a href=\"http:\/\/www.openssh.org\/\">ssh<\/a> fallback this time since this download is integrated within the Android SDK tools \ud83d\ude41<\/p>\n<p>(apparently there were <a href=\"http:\/\/code.google.com\/p\/android-roms\/downloads\/list\">standalone USB drivers <\/a>available, but I didn&#8217;t find these until it was too late)<\/p>\n<p>That&#8217;s when I fortunately remembered I had installed the <a href=\"http:\/\/android-roms.googlecode.com\/files\/JFv1.43_Recovery.zip\">JFv1.43 custom recovery code<\/a> on my phone, which you can activate by pressing the HOME key while powering up the phone.<\/p>\n<p>So I did, I started a single-user mode root shell directly on the phone, mounted the \/data and \/system partitions, and as described in the fix I referenced above, ran &#8220;update system set value=0 where name=&#8217;lock_pattern_autolock&#8217;;&#8221;.<\/p>\n<p>Reboot. No way. I was still stuck on the Gmail login form.<\/p>\n<p>After a bit more wrestling with SQL, looking at the system table, I finally found out the cure to my problem:<\/p>\n<blockquote><p>update system set value=0 where name=&#8217;lockscreen.lockedoutpermanently&#8217;;<\/p><\/blockquote>\n<p>Reboot. I got access to my phone, at last, after 5 hours of cursing. I love Android. What other phone would let me do this?<\/p>\n<p>Lessons learned:<\/p>\n<ul>\n<li>don&#8217;t play with or (worse) monkey-test security systems, <em>especially<\/em> when away from home;<\/li>\n<li>set up a recovery shell for future use, to cater for possible bugs;<\/li>\n<li>Android is still a bit rough on the edges, to put it nicely;<\/li>\n<li>it&#8217;s nice to always have a <em>real<\/em> computer handy; and possibly a spare IP connection, too;<\/li>\n<li>I&#8217;m glad Android makes this kind of hacking possible, almost easy <em>and<\/em> legit.<\/li>\n<\/ul>\n<p>Things that I think should really be changed in the Android locking pattern behavior:<\/p>\n<ul>\n<li>don&#8217;t count (or significantly raise) the number of unlocking failures before asking for the Gmail login (What if the phone is in my pocket? A child plays with it unattended?);<\/li>\n<li>fix the <strong>old<\/strong> bug that prevents unlocking (at least in my case, but I don&#8217;t seem to be alone) with the Gmail account: given that it was so fast to reject the password, it clearly didn&#8217;t test it to Google over the data connection; so I wonder if that screen isn&#8217;t just a mock-up, which would be perverse but is supported by the name of the variable lockedout<strong>permanently<\/strong>;<\/li>\n<li>let the user revert from the Gmail login screen to the unlocking pattern, that may come in handy (at least when he explicitly chose to press the &#8220;Forgot the pattern&#8221; button), or make it <strong>very clear<\/strong> that there&#8217;s no coming back.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>45 seconds of play, ~5 hours of desperate hacking. A few days ago, my 4 year old daughter was playing with my mobile phone running Android 1.6. To let her play with the screen while avoiding any mishap, I locked the phone. It was obviously not enough, she instantly found the MENU key to unlock &hellip; <a href=\"https:\/\/signal.eu.org\/blog\/2010\/02\/08\/android-pattern-locking-an-horror-story\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Android pattern locking: a horror story<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[14,5],"tags":[],"_links":{"self":[{"href":"https:\/\/signal.eu.org\/blog\/wp-json\/wp\/v2\/posts\/392"}],"collection":[{"href":"https:\/\/signal.eu.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/signal.eu.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/signal.eu.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/signal.eu.org\/blog\/wp-json\/wp\/v2\/comments?post=392"}],"version-history":[{"count":10,"href":"https:\/\/signal.eu.org\/blog\/wp-json\/wp\/v2\/posts\/392\/revisions"}],"predecessor-version":[{"id":396,"href":"https:\/\/signal.eu.org\/blog\/wp-json\/wp\/v2\/posts\/392\/revisions\/396"}],"wp:attachment":[{"href":"https:\/\/signal.eu.org\/blog\/wp-json\/wp\/v2\/media?parent=392"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/signal.eu.org\/blog\/wp-json\/wp\/v2\/categories?post=392"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/signal.eu.org\/blog\/wp-json\/wp\/v2\/tags?post=392"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}