Security & Risk ConferenceNovember 3th - 6th 2010Lucerne, Switzerland
Apple iOS Privacy Nicolas Seriot Twitter @nst021
Malware on Mobile Phones
• Was a fantasy two years ago
• Is now something common
• Many fantasy among consumers
• “Can my iPhone spy on me?”
Reach Consumer Phones
• Unix permissions + sandbox
• Autoregulated market
• Spywares, fake banking applications, …
• see Jesse Burns session on Android app security
App Store Malware• Hackers have been working on the jailbroken side
• 100 million devices, 250’000 apps, 4 billion downloads
• February 2010 BlackHat DC USA
• iPhone / App Store is not immune from malware
http://www.blackhat.com/presentations/bh-dc-10/Seriot_Nicolas/BlackHat-DC-2010-Seriot-iPhone-Privacy-wp.pdf
Agenda
1. Privacy issues overview
2. What can iPhone spyware do?
1. Access personal data
2. Fool App Store’s reviewers
3. Attack scenarios
4. Recommendations and conclusion
Security Issues Timeline…2007…2007…2007…2007 20082008200820082008 20092009200920092009200920092009 2010…2010…2010…2010…2010…2010…2010…2010…2010…2010…2010…
Root exploits
libtifflibtiff CoreAudioCoreAudioCoreAudioCoreAudioCoreAudioCoreAudioCoreAudioCoreAudioCoreAudioRoot exploits SMS fuzzingSMS fuzzingSMS fuzzingSMS fuzzingSMS fuzzingSMS fuzzingSMS fuzzing FreeTypeFreeTypeFreeTypeFreeTypeFreeTypeFreeTypeFreeType
Pulled from Store
Aurora FaintAurora FaintAurora FaintAurora FaintAurora FaintPulled from Store MogoRoadMogoRoadMogoRoadMogoRoad
SSL Trust you ownTrust you ownTrust you ownTrust you ownTrust you ownTrust you ownTrust you ownTrust you ownTrust you own
Lawsuits
Storm8Storm8Storm8Storm8Storm8Storm8
Analytics
PinchMedia concernsPinchMedia concernsPinchMedia concernsPinchMedia concernsPinchMedia concernsPinchMedia concernsPinchMedia concerns
Worms Ikee & co. (jailbreak)Ikee & co. (jailbreak)Ikee & co. (jailbreak)Ikee & co. (jailbreak)Ikee & co. (jailbreak)Ikee & co. (jailbreak)Ikee & co. (jailbreak)Ikee & co. (jailbreak)Ikee & co. (jailbreak)Ikee & co. (jailbreak)Ikee & co. (jailbreak)
OS 1.01.01.0 1.11.1 22 2 2.22.2 3.03.03.0 3.13.13.13.13.13.13.1 3.23.23.2 44 4.14.14.1
Root Exploit through PDF Handling
http://arstechnica.com/apple/news/2010/08/web-based-jailbreak-relies-on-unpatched-mobile-safari-flaw.ars
ArsTechnica, August 2010
Analytics Frameworks
• PinchMedia
• Think Google Analytics for your app
• July 2009 – bloggers raise privacy concerns
• Users are not informed and can’t opt-out
Storm8 Lawsuit
http://www.theregister.co.uk/2009/11/06/iphone_games_storm8_lawsuit/
http://www.boingboing.net/lawsuits/Complaint_Storm_8_Nov_04_2009.pdf
Pulled out from AppStore*
• Aurora Feint – July 2008
• Sent contact emails in clear
• 20 million downloads
• MogoRoad – September 2009
• Sent phone number in clear
• Customers got commercial calls
* Both applications are back on AppStore after updating their privacy policy.
iPhone is Widely Supposed to be Insecure
http://www.google.com/hostednews/afp/article/ALeqM5gw3h9CaSr41wcnCsPda4CD5mqnyw
Swiss civil servants
are banned
from using iPhones
http://www.lematin.ch/actu/suisse/iphone-berne-299557
Technical Context• Imagine a rogue breakout on AppStore
• iPhone OS version 4.1
• No jailbreak (no root access, 6-8 % iPhones)
• No hardware attacks (don’t lose your iPhone)
• Not calls to private APIs (there’s no need to)
• No Facebook or Twitter profile data…
• No root shells exploits
• Look for entry points, look for personal data
Cell NumbersNSDictionary *d = [NSUserDefaults standardUserDefaults];NSString *phone = [d valueForKey:@"SBFormattedPhoneNumber"];
• Entered in iTunes
• Optional, you can safely change it
Address Book API
• Unrestricted read/write access
• Tampering with data
• change *@ubs.com into [email protected]
File System Access
http://fswalker.googlecode.com
Enumerate Readable Files
- (void)showAllReadableFilesFromPath:(NSString *)rootPath {! NSFileManager *fm = [NSFileManager defaultManager];! NSDirectoryEnumerator *e = [fm enumeratorAtPath:rootPath];! NSString *s = nil;! while(s = [e nextObject]) {! ! if([fm isReadableFileAtPath:s]) {! ! ! NSLog(@"-- /%@", s);! ! }! ! !! }}
iPhone Sandboxing• Restricts applications access to OS resources
• A list of deny/allow rules at kernel level
• /usr/share/sandbox/SandboxTemplate.sb
(version 1)(deny default)
; Sandbox violations get logged to syslog via kernel logging.(debug deny)
(allow sysctl-read)
; Mount / umount commands(deny file-write-mount file-write-umount)
; System is read only(allow file-read*)(deny file-write*)
; Private areas(deny! file-write*! (regex "^/private/var/mobile/Applications/.*$"))(deny! file-read*! (regex "^/private/var/mobile/Applications/.*$"))
Sandboxing for the Win?
False. Sandboxing rules are way too loose!
http://images.apple.com/iphone/business/docs/iPhone_Security_Overview.pdf
Applications on the device are "sandboxed" so they cannot access data stored by other applications.
In addition, system files, resources, and the kernel are shielded from the user's application space.
Apple – iPhone in Business – Security Overview
Demo
iOS 4.0 Bug Fixs
http://support.apple.com/kb/ht4225
Photos – iOS 4
• photos geotags are not accessible anymore
• photos still give a clue about user’s activity
BSSID Location Service{ "wifi_towers": [ { "mac_address": "00:23:6c:80:cb:73" } ], "version": "1.1.0", "host": "www.google.com"}
{ "location": { "latitude": 46.5153829, "longitude": 6.6287134, "accuracy": 150.0 }, "access_token": "2:AEBX2wEULGBpyy9n:mnEZeUQogbCv7DUv"}
http://66.249.92.104/loc/json
HTTP POST
SpyPhone
• Contributions welcome!
• 2000 lines of Objective-C
• GPL License
• http://github.com/nst/spyphone
also runs on iPad!
Apple on iOS 4 Security
We're taking privacy several steps further
– in iPhone OS 4.
- Scott Forstall, Apple senior VP of iOS Software
iPhone OS 3 / iOS 4iPhone OS 3.2 iOS 4.1
Safari searchesYouTube history
Phone dataEmail settingsAddressBook
Keyboard cachePhotos + coord. EXIF missingGPS recent loc.Wifi recent loc.
App Store and Malware
http://www.businessweek.com/technology/content/nov2009/tc20091120_354597.htm
10,000 submissions per week10% of rejections related to malware
We've built a store for the most part that people can trust.
There have been applications submitted for approval that will steal personal data.
- Phil Schiller, Apple senior VP
App Store Reviews
• iPhone SDK Standard Agreement forbids collect users’ personal information and must comply with local laws
• Reviewers can be fooled
• Spyware activation can be delayed
• Payloads can be encrypted
• Many things can change at runtime
Hiding the Beast
• Guesswork about AppStore review process
• Static analysis with $ strings
• Dynamic analysis with I/O Instruments
• Monitor file openings
• Check against black lists
Strings Obfuscation- (NSString *)stringMinus1:(NSString *)s { NSMutableString *s2 = [NSMutableString string]; for(int i = 0; i < [s length]; i++) { unichar c = [s characterAtIndex:i]; [s2 appendFormat:@"%C", c-1]; } return s2;}
- (void)viewDidAppear:(BOOL)animated { NSString *pathPlus1 = @"0wbs0npcjmf0Mjcsbsz0Qsfgfsfodft0dpn/bqqmf/bddpvoutfuujoht/qmjtu"; // @"/var/mobile/Library/Preferences/com.apple.accountsettings.plist" NSString *path = [self stringMinus1:pathPlus1]; NSDictionary *d = [NSDictionary dictionaryWithContentsOfFile:path]; // ...}
This code would probably pass a static analysis
Apple’s GPS Kill Switch
• Discovered by Jonathan Zdziarski in August 2008
• clbl stands for “Core Location Black List”
• Prevent applications from using Core Location
• Apple never acknowledged its existence publicly
• Apple never used it – SpyPhone doesn’t care
$ curl https://iphone-services.apple.com/clbl/unauthorizedApps{! "Date Generated" = "2010-10-31 21:30:28 Etc/GMT";! "BlackListedApps" = {};}
The Spammer
• Write a little breakout game
• Make it available for free on AppStore
• Collect user email addresses + weather cities + user’s interests from keyboard cache
• Collect Address Book emails
• Send them with high scores
The Luxury Products Thief• Write an app for sports
car or luxury watches collectors
• Report the name, phone, area and GPS location of healthy people
• When you can determine that someone is away from home, just rob him
The Real Life Snooper• Could also be named evil competitor, jealous
husband or law enforcement officer
• Requirements: 5 minute physical access to the device, an Apple $99 developer license, a USB cable
• Install SpyPhone, send the report
• Delete the report from sent emails, delete SpyPhone
http://www.flickr.com/photos/11213613@N05/4147756184/
VIPs
François Fillon, French Prime Minister, andRachida Dati, former Justice French Minister
< insert your attack scenario here >
What’s Wrong (1)
• Clearly, the Keyboard cache shouldn’t be readable, it should be a system service instead
• Something like an applicative firewall should inform the user and let her prevent access
• A network firewall should also be available to let the user opt-out from the various analytics frameworks
Device Unique Identifiers• The user should be prompted when an
application attempts to access the UUID
• UUID may be used to link data gathered by different applications and frameworks
• Apple should introduce an app-device identifier, unique for (device, application)
Security Through Obscurity• Apple shouldn’t claim that an
application cannot access data from other applications
• Updates should be available OTA, you should not need iTunes
• Apple actually hired several seniors early 2010
• Ivan Krstić (OPLC)
• Window Snyder (FireFox)
What’s Wrong (2)• Users should be required to grant read-access
to the Address Book, as for the GPS location
• Users should be prompted again if the application attempts to edit the Address Book
• Risk: being overwhelmed with pop-ups
Toward Apple approved Security Policies?
• Android-like applications security policies, approved by AppStore reviewers
App Store
Developer User
Application
Security Policy
Application
Security Policy
Apple's Signature
• Move the burden of security management from the (uneducated) user to the vendor
• Consumers: sorry, there is little you can do…
• Assess risks correctly, especially if they are required to keep secrets (medical staff, bankers, attorney, police officers, …)
• Use Apple’s program for enterprise deployment, which lets administrators define profiles that enforce restrictions.
Cope with this Situation
Conclusion
• Assume that spyware are on the AppStore
• 1$ ecosystem doesn’t help
• Massive privacy breach is a technical possibility, might be just a matter of time
• Sandboxing / App Store reviews are necessary, they should be kept and improved
• Risks must be known and fairly evaluated
Ongoing Research
• Use GMS cell-ids to locate the user
• Get personal data using private APIs (malware won’t refrain)
• Dynamically dump undocumented APIs
• Not allowed on the AppStore
• Even more data available for spywares
Browser APIs at Runtime
NSString *path = @"/System/Library/PrivateFrameworks/Message.framework";BOOL bundleLoaded = [[NSBundle bundleWithPath:path] load]; Class NetworkController = NSClassFromString(@"NetworkController");NSString *IMEI = [[NetworkController sharedInstance] IMEI];
(browse .h files)
http://runtimebrowser.googlecode.com/
Other App Store Frauds
• Quick apps highly ranked and purchased with stolen accounts
• Detect App Farms and other frauds by mining App Store metadata and user comments
http://thenextweb.com/apple/2010/07/04/app-store-hacked/
Recap
• You’ve seen iPhone main privacy issues
• You know which personal data are at risk
• You know how spyware access these data
• You’ve seen some potential attack scenarios
• Contact me: [email protected], Twitter @nst021
• Time for Q&A
Thank you!
Swiss Constitution
Protection of Privacy – Every person has the right to be protected against abuse of personal data (Art. 13 al. 2).
Personal Data
• Personal data : all information relating to an identified or identifiable person.
• Personality profile : permits an assessment of the essential characteristics of the personality of a natural person. Personality profiles are especially protected and strictly regulated.
Laws for Spyware Authors
• May be jailed for up to three years
• May have to pay hefty fines
• This is scarcely applied though
License Agreements
• End users are protected from over reaching End User License Agreements (EULAs).
• The EULA cannot simply state that you agree to send your personal data to bad guys if you do not.
• There must be a real mutual agreement, ruling out the use of potentially misleading terms.