<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>peekay &#187; iPhone</title>
	<atom:link href="http://peekay.org/category/iphone/feed/" rel="self" type="application/rss+xml" />
	<link>http://peekay.org</link>
	<description>random stuff about software, infrastructure, security, etc</description>
	<lastBuildDate>Wed, 11 Jan 2012 00:07:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='peekay.org' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>peekay &#187; iPhone</title>
		<link>http://peekay.org</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://peekay.org/osd.xml" title="peekay" />
	<atom:link rel='hub' href='http://peekay.org/?pushpress=hub'/>
		<item>
		<title>Incorrect time setting could leak iOS 5 album pictures</title>
		<link>http://peekay.org/2011/12/31/incorrect-time-setting-could-leak-ios-5-album-pictures/</link>
		<comments>http://peekay.org/2011/12/31/incorrect-time-setting-could-leak-ios-5-album-pictures/#comments</comments>
		<pubDate>Sat, 31 Dec 2011 23:03:12 +0000</pubDate>
		<dc:creator>Ade Barkah</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://peekay.org/?p=102</guid>
		<description><![CDATA[I always get a bit antsy about hacking researching vulnerabilities when I travel, and this time is no exception.  Often I notice &#8220;glitches&#8221; or abnormalities which I want to investigate, but since I&#8217;m in the middle of riding my motorcycle from Canada to Argentina, infosec has been on the back burner. Recently I took advantage [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=peekay.org&amp;blog=4701354&amp;post=102&amp;subd=peekay&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I always get a bit antsy about <del>hacking</del> researching vulnerabilities when I travel, and this time is no exception.  Often I notice &#8220;glitches&#8221; or abnormalities which I want to investigate, but since I&#8217;m in the middle of riding my motorcycle <a href="http://www.advrider.com/forums/showthread.php?t=710505">from Canada to Argentina</a>, infosec has been on the back burner.</p>
<p>Recently I took advantage of great wi-fi in Costa Rica to <em>finally</em> upgrade my iPhone 4 to iOS 5.   Double-clicking the home button now allows one to quickly access the Camera app even from a locked phone:</p>
<p style="text-align:center;"><a href="http://peekay.files.wordpress.com/2011/12/iphone-unlock-screen.png"><img class="size-full wp-image-101 aligncenter" title="The Camera icon is now accessible from a locked iPhone" src="http://peekay.files.wordpress.com/2011/12/iphone-unlock-screen.png?w=500" alt=""   /></a><em>The camera icon (bottom-right) is now accessible from a locked iPhone</em></p>
<p>Since the camera is locked, Camera app has a smart feature barring access to the iPhone&#8217;s album.  You can only see pictures taken from the current (locked) session.</p>
<p>As an aside, I thought I noticed a glitch whereby I could completely bypass the passcode lock, but turns out it&#8217;s just poor UI from Apple.  (There&#8217;s a state where the phone is locked but a passcode is not yet required, and the UI during this period can be misleading.)   I changed the passcode setting to &#8220;immediate&#8221; after that.</p>
<p style="text-align:center;"><a href="http://peekay.files.wordpress.com/2011/12/iphone-locked-album.png"><img class="size-full wp-image-100 aligncenter" title="UI restricting album access from locked phone" src="http://peekay.files.wordpress.com/2011/12/iphone-locked-album.png?w=500" alt=""   /></a><em>UI barring access to album pictures from locked phone</em></p>
<p>While researching the above &#8220;glitch&#8221;, I was intrigued at how the Camera app&#8217;s album manager was able to segregate your &#8220;protected&#8221; images vs. the ones from the current session.  It&#8217;s like a &#8220;jail&#8221; for images.  I wondered if I could break out of this image jail.</p>
<p>Turns out Apple&#8217;s restriction is just a simple filter based on <em>the timestamp when the Camera app was invoked</em>.  You&#8217;re allowed to see all images with a timestamp greater than this invocation time.  Yet that leads to an immediate hole: if your iPhone&#8217;s clock ever rolls back, then all images with timestamps newer than your iPhone&#8217;s clock will be viewable from your locked phone.</p>
<p>But time always moves forward, right? Why would your phone&#8217;s clock ever roll backwards?</p>
<ul>
<li>It could be due to user error.  E.g., maybe while traveling across timezones you accidentally set the iPhone&#8217;s date or time incorrectly (rather than simply resetting the timezone).   If you set the clock ahead of what it&#8217;s supposed to be, then this vulnerability will appear when you reset to the correct time.  If you accidentally set the clock to the past, then your images will immediately become unprotected.</li>
<li>It could be an iPhone glitch.  E.g., a software or hardware issue could reset your iPhone&#8217;s clock to epoch time &#8212; iPhone&#8217;s &#8220;zero&#8221; time at midnight January 1, 2001.  In this case all your images are exposed.</li>
<li>It could be an infrastructure error.  E.g., if you automatically sync from a erroneous external time source (cell phone company, etc.)</li>
</ul>
<p>I don&#8217;t think normal (non-Apple) apps can change the iPhone&#8217;s clock, but if it can then that could be another possible source of rollback.</p>
<p>This vulnerability is simple to test.  Just set your iPhone&#8217;s clock to a time in the past (say, in 2010).  Then access the Camera while your phone is still locked.  Lo-and-behold, you&#8217;ll be able to see all your &#8220;protected&#8221; images.</p>
<p>The point to all this is that Apple should not rely on a simple timestamp to restrict image access.  Changing the iPhone&#8217;s clock &#8212; forwards or backwards &#8212; <em>should not</em> affect its security.  We can&#8217;t guarantee the clock will always monotonically more forward, and when it doesn&#8217;t, the system should fail-secure.</p>
<p>In the big picture, if real &#8220;bad guys&#8221; have physical access to your phone, then the game is over already.  However, as I wrote previously, <a href="peekay.org/2009/03/23/chinks-in-the-armor/">defense-in-depth</a> is a basic concept which should always be applied.</p>
<p>In various occasions I&#8217;ve advised clients to secure their time servers, etc., in the context of esoteric cryptographic attacks, audit logging, and other protocols which depend on accurate timekeeping.  I&#8217;m a bit amused that the iPhone is vulnerable to a simple time change.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/peekay.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/peekay.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/peekay.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/peekay.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/peekay.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/peekay.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/peekay.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/peekay.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/peekay.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/peekay.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/peekay.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/peekay.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/peekay.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/peekay.wordpress.com/102/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=peekay.org&amp;blog=4701354&amp;post=102&amp;subd=peekay&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://peekay.org/2011/12/31/incorrect-time-setting-could-leak-ios-5-album-pictures/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0846f908258a0d05752ee89a61da5d4f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">peekay</media:title>
		</media:content>

		<media:content url="http://peekay.files.wordpress.com/2011/12/iphone-unlock-screen.png" medium="image">
			<media:title type="html">The Camera icon is now accessible from a locked iPhone</media:title>
		</media:content>

		<media:content url="http://peekay.files.wordpress.com/2011/12/iphone-locked-album.png" medium="image">
			<media:title type="html">UI restricting album access from locked phone</media:title>
		</media:content>
	</item>
		<item>
		<title>iPhone SDK Regular Expressions</title>
		<link>http://peekay.org/2009/03/18/iphone-sdk-regular-expressions/</link>
		<comments>http://peekay.org/2009/03/18/iphone-sdk-regular-expressions/#comments</comments>
		<pubDate>Wed, 18 Mar 2009 02:49:28 +0000</pubDate>
		<dc:creator>Ade Barkah</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[regex]]></category>

		<guid isPermaLink="false">http://peekay.wordpress.com/?p=22</guid>
		<description><![CDATA[If you&#8217;re programming the iPhone, sooner or later you&#8217;ll need regular expressions (regex).  By default OS X includes the ICU, an open source Unicode library which has extensive regex capabilities. The ICU APIs are in C/C++ however, not Objective-C.   Fear not, RegexKitLite to the rescue.   This small library has done all the hard work [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=peekay.org&amp;blog=4701354&amp;post=22&amp;subd=peekay&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re programming the iPhone, sooner or later you&#8217;ll need regular expressions (regex).  By default OS X includes the <a title="International Components for Unicode" href="http://site.icu-project.org/">ICU</a>, an open source Unicode library which has extensive regex capabilities.</p>
<p>The ICU APIs are in C/C++ however, not Objective-C.    Fear not, <a href="http://regexkit.sourceforge.net/RegexKitLite/index.html">RegexKitLite</a> to the rescue.   This small library has done all the hard work of adding regex methods to NSString.  RegexKitLite is small, thread-safe, and quite fast.  It simply links to ICU &#8211;  unlike its bigger brother, RegexKit, which must be compiled against <a title="Perl Compatible Regular Expressions" href="http://www.pcre.org/">PCRE</a>.</p>
<p>RegexKitLite is also easy to use:</p>
<pre style="padding-left:30px;">#import "RegexKitLite.h"
NSString * foo = @"some string to search on";
NSString * regex = @"^(.+?)\s";
NSLog(@"Match: %@", [foo stringByMatching:regex capture:1]);</pre>
<p>Then just link with -<em>licucore </em>and that&#8217;s it!!</p>
<p>Note: In Xcode I simply added <em>-licucore</em> to the &#8220;Other Linker Flags&#8221; in my project&#8217;s build configuration.  Maybe there&#8217;s a &#8220;better&#8221; way of doing this but this method works for me.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/peekay.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/peekay.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/peekay.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/peekay.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/peekay.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/peekay.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/peekay.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/peekay.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/peekay.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/peekay.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/peekay.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/peekay.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/peekay.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/peekay.wordpress.com/22/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=peekay.org&amp;blog=4701354&amp;post=22&amp;subd=peekay&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://peekay.org/2009/03/18/iphone-sdk-regular-expressions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0846f908258a0d05752ee89a61da5d4f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">peekay</media:title>
		</media:content>
	</item>
	</channel>
</rss>
