Privacy Issues
Every iPhone has an associated unique device Identifier derived from a set of hardware attributes called UDID. It is burned into the device and one cannot remove or change it. However, it can be spoofed with the help of tools like UDID Faker.
UDID of the latest iPhone is computed with the
formula given below -
UDID = SHA1(Serial Number + ECID + LOWERCASE
(WiFi Address) + LOWERCASE(Bluetooth Address))
UDID is exposed to application developers through
an API which would allow them to access the UDID of an iPhone without requiring
the device owner’s permission.
There's a
code snippet which is used to collect the UDID of a device, later which
can used to track the user’s behavior.
Code: NSString *uniqueIdentifier = [device
uniqueIdentifier]
It is known that with the help of UDID, it is
possible to observe the user’s browsing patterns and trace out the user’s geo
location. As it is possible to locate the user’s exact location with the help
of a device UDID, it became a big privacy concern.
Openfient collected device UDID’s and misused
them by linking it to real world user identities (like email address, geo
locations latitude & longitude, Facebook profile picture) and making them
available for public access, resulting in a serious privacy breach.
While penetration testing, observe the network
traffic for UDID transmission. UDID in the network traffic indicates that the
application is collecting the device identifier or might be sending it to a
third party analytic company to track the user’s behaviour. In iOS 5, Apple has
deprecated the API that gives access to the UDID, and it will probably remove
the API completely in future iOS releases. Development best practice is not to
use the API that collects the device UDIDs, as it breaches the privacy of the
user. If the developers want to keep track of the user’s behaviour, create a
unique identifier specific to the application instead of using UDID. The
disadvantage with the application specific identifier is that it only
identifies an installation instance of the application, and it does not
identify the device.
Apart from UDID, applications may transmit
personal identifiable information like age, name, address and location details
to third party analytic companies. Transmitting personal identifiable
information to third party companies without the user’s knowledge also violates
the user’s privacy. So, during penetration testing carefully observe the
network traffic for the transmission of any important data.
Example: Pandora application was used to transmit
user’s age and zip code to a third party analytic company (doubleclick.net) in
clear text. For the applications which require the user’s geo location (ex:
check-in services) to serve the content, it is always recommended to use the
least degree of accuracy necessary. This can be achieved with the help of
accuracy constants defined in core location framework (ex: CLLocationAccuracy
kCLLocationAccuracyNearestTenMeters).
Local data storage
Mobile applications store the data locally on the
device to maintain essential information across the application execution or
for a better performance or offline access. Also, developers use the local
device storage to store information such as user preferences and application
configurations. As device theft is becoming an increasing concern, especially
in the enterprise, insecure local storage is considered to be the top risk in
mobile application threats. A recent survey conducted by Viaforensics revealed
that 76 percent of mobile applications are storing user’s information on the
device. 10 percent of them are even storing the plain text passwords on the
phone.
A few ways from which data stored in iPhone can
be obtained by attacker's are:
From Backups
When an iPhone is connected to iTunes, iTunes
automatically takes a backup of everything on the device. Upon backup,
sensitive files will also end up on the workstation. So an attacker who gets
access to the workstation can read the sensitive information from the stored
backup files.
Physical access to the device
People lose their phones and phones get stolen
very easily. In both cases, an attacker will get physical access to the device
and read the sensitive information stored on the phone. The passcode set to the
device will not protect the information as it is possible to brute force the
iPhone simple passcode within 20-30 minutes.
Malware
Leveraging a security weakness in iOS may allow
an attacker to design a malware which can steal the files on the iPhone
remotely.
iPhone application directory structure
In iOS, applications are treated as a bundle
represented within a directory. The bundle groups all the application
resources, binaries and other related files into a directory. In iPhone,
applications are executed within a jailed environment (sandbox or seatbelt)
with mobile user privileges. Unlike Android UID based segregation, iOS
applications runs as one user. Each and almost every application has access to
the contents of its own sandbox but cannot access other applications’. When an
application is first installed on a device, the system creates the
application’s home directory, sets up some key subdirectories, and sets up the
security privileges for the sandbox“. A sandbox is a restricted environment
that prevents applications from accessing unauthorized resources; however, upon
iPhone JailBreak, sandbox protection gets disabled.
When an application is installed on the iPhone,
it creates a directory with a unique identifier under /var/mobile/Applications
directory. Everything that is required for an application to execute will be
contained in the created home directory. Typical iPhone application home
directory structure is listed below
In iPhone, information could be stored in any of the locations listed below :
1. Plist
files
2. Keychain
2. Keychain
3.
Application’s home directory
4. Cache
5.
Logs.
Property list files
Itis a structured binary formatted file which
contains the essential configuration of a bundle executable in nested key value
pairs. These files are used to store the user preferences and the configuration
information of an application. For example, Gaming applications usually store
game levels and game scores in the Plist files. In general, applications store
the Plist files under [Application's Home Directory]/documents/preferences
folder. Plist can either be in XML format or in binary format. As XML files are
not the most efficient means of storage, most of the applications use binary
formatted Plist files. Binary formatted data stored in the Plist files can be
easily viewed or modified using Plist editors (ex: plutil). Plist editors
convert the binary formatted data into an XML formatted data, later it can be
edited easily. Plist files are primarily designed to store the user preferences
& application configuration; however, the applications may use Plist files
to store clear text usernames, passwords and session related information. So,
while penetration testing, view all the Plist files available under application’s
home directory and look for sensitive information, like usernames, passwords,
user’s personal information and session cookies, etc… Developers can assign any
extension to the Plist files. A Plist file can be easily identified by looking
at the file contents using cat command. The content of a Plist file starts with
bplist’.
Along with the sensitive information storage,
application may also take authentication & authorization decisions based on
the values stored in Plist files. For example, if you notice a Plist entry like
admin=0 during penetration testing, change the admin key value to 1 and open
the application. If the application does not validate the user input properly
and takes the authorization decision based on the Plist entry, you may log into
the application as an administrator. Development best practice is to not store
any sensitive information in Plist files. Also, do not take authentication
& authorization decisions based on the information stored in Plist files.
Plist files contain user controlled input, and it should be validated properly
like any other user input.
WordPress iPhone application used to store clear
text username and password in a Plist file. The video below here demonstrates
the WordPress vulnerability. This vulnerability was reported by SANS and
WordPress fixed it immediately.
Plist can be viewed and modified in both
JailBroken and non JailBroken iPhones.Below are examples of both of them.
Tampering Plist files on a non JailBroken iPhone:
On a non JailBroken iPhone, Plist files can be
viewed & modified using tools like iExplorer and iBackupBot.
Modifying Plist entries with iExplorer
iExplorer (iPhone Explorer) gives access to the
iPhone in disk mode and allows browsing all the folders on the iPhone directly.
Stick Cricket iPhone game is used for the
example.
Stick Cricket iPhone game stores the game score
in a Plist file under application’s home directory. As the application is
storing the game score locally in a Plist file, it can be altered by editing
the Plist file.
Screenshot shown below displays the actual score
before the Plist modification.
Steps shown below will tellthe usage of iExplorer
tool to modify the game scores stored in the Plist file -
1. On your workstation download and install
iExplorer.
2. Connect the iPhone to the workstation over
USB.
3. In iExplorer, browse to Apps->com.sticksports.stickcricket
folder.
4. Navigate to stick cricket
Library->Preferences folder.
5. Copy com.sticksports.stickcricket.Plist file
to the workstation by dragging it to the desktop.
6. On the workstation, open the Plist file using
a Plist editor and modify the yourBest5Overs key value.
7. From iExplorer, delete the
com.sticksports.stickcricket.Plist on the iPhone and drag the newly saved file
onto the iPhone.
8. In iPhone, terminate the Stick Cricket
application and reopen it. The Stick Cricket welcome screen now displays the
modified score as shown in the screenshot below.
Modifying Plist entries with iBackupBot
When the iPhone is connected to a computer,
iTunes takes a backup of everything on the phone including configuration files
(Plist files). iBackupBot tool can be used to view and modify the Plist file
entries on the iPhone backup and restore the modified backup onto the iPhone..
Steps shown below will tell the use of iBackupBot
tool to modify the game scores stored in the Plist file -
1.
Connect
the iPhone to the workstation over USB cable.
2.
On
Workstation, open iTunes and take a backup of the iPhone.
3.
Close
iTunes.
4.
Open
iBackupBot. It automatically identifies the existing backups and displays the
files inside the backup to the user.
5.
Click
on Stick Cricket and open /Library/Preferences/com.sticksports.stickcricket.Plist
file.
6.
Modify
the score stored in the Plist file.
7.
Click
on Export icon to save the modified Plist file.
8.
Click
the restore icon in iBackupBot toolbar. It will restore the iPhone with the
modified backup. Now on iPhone, reopening the Stick Cricket game will display
the modified score.
Tampering Plist files on a JailBroken iPhone:
On a JailBroken iPhone, Plist files can be viewed
& modified using tools like plutil and iFile. Both these tools can be
downloaded from Cydia (packages – com.eric.tool & iFile). iFile would allow
to modify the Plist files directly on the iPhone.
The iPhone camera application is used for the
demo. In iOS camera application, Apple has hidden the panorama mode feature and
planned to include this feature in future iOS versions. Panorama mode basically
allows the users to take continuous photos while panning the camera from left
to right. Apple stored the panorama mode switch in a Plist file. iOS hackers
Conard & Chpwn exposed the panorama mode in iOS 5 by modifying an entry in
com.apple.mobileslideshow.Plist file.
Screenshot shown below displays the list of
options available in the iPhone camera application.
Steps shown below will tell the usage of plutil
tool to change the panorama switch stored in the Plist file -
1.
SSH
to the iPhone and login as a root user (password: alpine).
2.
Navigate
to /private/var/mobile/Library/Preferences/ directory.
3.
View
com.apple.mobileslideshow.Plist file content with the help of plutil
tool.
Plutil com.apple.mobileslideshow.plist
4.
Add
‘EnableFirebreak’ key to the com.apple.mobileslideshow.plist file with
the below command.
Plutil –key EnableFirebreak –value yes com.apple.mobileslideshow.plist
5.
It
turns on the panorama feature in the iPhone camera application.
Screenshot below shows different options available in
the iPhone camera after the modification
Hope you all enjoyed this tutorial and if you have any problem or question then you may ask in comments.
I couldn't install it before reading the blog. Thanks for the chart.
ReplyDeleteHere you can find safty and secured Home security
Penetration Testing With Iphone Applications - Part 2 ~ Pwnscar: Info Sec Research Hub >>>>> Download Now
ReplyDelete>>>>> Download Full
Penetration Testing With Iphone Applications - Part 2 ~ Pwnscar: Info Sec Research Hub >>>>> Download LINK
>>>>> Download Now
Penetration Testing With Iphone Applications - Part 2 ~ Pwnscar: Info Sec Research Hub >>>>> Download Full
>>>>> Download LINK