Appknox Blog | AppSec Insights & Trends

Comprehensive iOS App Security: 3 Ways Apple Safeguards Your Data

Written by Abhinav Vasisth | Jan 28, 2021 10:51:19 AM

Apple loves bragging about how secure its devices are. Not without reason: there are many security features you probably use daily, including code autofill, password reuse auditing, Safari built-in privacy, and more. 

The same goes for developers. For example, Apple doesn't release its source code to app developers for security reasons, and iOS device owners can't modify the code on their phones themselves. 

However, there are many other less-known security features Apple uses to prevent their devices from being hacked. 

We will discuss how Apple handles user data protection on its devices and what security measures it takes. I've divided the article into two parts, covering popular iOS security features for user data storage and transportation.

Table of Content

How Apple Handles Secure Data Storing

How Secure is Data Transmission

FAQ

How does Apple handle secure data storing?

Ever wonder how your iPhone reliably keeps your info safe from hackers and nosy apps? Let's look at three key security features for secure data storage and how they shield against real threats.

1. Apple App Sandbox: keeping apps in their lane

Apps are among the most critical elements of security architecture. While they can benefit users' productivity, they may also affect the system's security and user data if handled incorrectly. 

That's why users are supposed to download iPhone, iPad, and iPod touch apps only from the App Store. Any company can create an iOS app, but only apps that comply with App Store guidelines will be published.

These apps run in a sandbox, a directory in which they can store data. The App Sandbox is like putting each app in its protective bubble. It stops apps from accessing stuff they shouldn't.

If an attacker tries to exploit security holes in your app, the sandbox will use a defensive mechanism that limits the app's access to files, preferences, network resources, and hardware.

Common threats it stops:

  • Malware spread

    If you download a game with a virus, the sandbox keeps it from infecting other apps.
  • Data theft

    A sketchy app can't dig through your banking app's files.
  • System tampering

    Apps can't mess up your iPhone's essential system files.

Real example:

Say you download a free flashlight app that's trying to steal data. Thanks to the sandbox:

  • It can't read your contacts without asking,
  • It can't secretly record you and
  • It can't look at files from your other apps

 

2. Data protection API: locking down your info

Data protection features secure app files and prevent unauthorized access to them. It’s enabled as soon as the user sets a passcode for the device. 

This process is automatic and hardware-accelerated, so it is unnoticeable to the user. Users read and edit files the way they always do while the encryption-decryption process happens behind the scenes. 

There are four data protection levels:

  • No protection. The file is not encrypted and is always accessible. 
  • Complete until the first authorization (the default level). The file is encrypted until the user unlocks their device for the first time. It remains decrypted until the device is shut down or rebooted. 
  • Complete unless opened. The file remains encrypted until the app opens it the first time. Then, the data remains decrypted even if the device is locked. 
  • Complete. The file is accessible only when the device is unlocked. 

If you don't choose the protection level when creating a file, iOS automatically applies the default security level. 

Sure, it’s better to use the highest protection level Apple offers. However, if you need to access files in the background while the device stays locked, complete data encryption may not be the best option.

Common threats it stops:

  • Phone theft

    If someone steals your iPhone, they can't read your stuff.
  • Data breaches

    If hackers somehow get your files, they're just gibberish.
  • Unauthorized access

    Apps need your permission to see protected data.

Real example:

When you get a text with your credit card number:

  • The message is automatically encrypted.
  • If someone steals your phone while it's locked, they can't read the text.
  • Even if they connect your phone to a computer, the data stays scrambled.

 

3. Keychain: your secure password vault

The keychain is a secure space to store data bits in an encrypted database. 

Each iOS application gets its own space in the keychain, which no other app can access. You don't need to store encryption keys in your app; you rely on the system to provide the highest security level. 

 

Related Topic: What is Jailbreaking an iPhone? How Does It Work?

 

This feature is great for people who manage many online accounts and (in a perfect world) have a unique password for each. Remembering each new string of letters and numbers is impossible, and writing them down is insecure. The same goes for using one password for multiple accounts. 

The keychain solves this problem by giving users a mechanism to store these chunks of data. It’s not limited to storing passwords, though. Users can also keep such information as credit card details or short notes. 

Common threats it stops:

  • Password theft

    Stops hackers from stealing your login info.
  • Weak passwords

    Keychain suggests strong passwords so you don't have to remember.
  • Phishing

    Keychain helps you avoid fake websites by remembering the real ones.

Real example:

You use the same password everywhere because it's easy to remember. With Keychain:

  • It creates tough passwords like "x7K#mP9$vL" for each app.
  • You don't have to type them - keychain fills them in.
  • If one site gets hacked, your other accounts are safe because they use different passwords

How these features work together

Here's a real-world scenario showing all three features in action:

  1. You download a shopping app
    • Sandbox makes sure it can only access what it needs.
  2. You save your credit card in the app
    • Data Protection encrypts the card info.
    • Keychain securely stores your app password.
  3. If something goes wrong:
    • Sandbox keeps the problem app away from others.
    • Data protection keeps your card info safe.
    • Keychain makes sure no one can log into your account.

Here are a few quick safety tips

  1. Update your iPhone when new iOS versions come out
  2. Only download apps from the App Store
  3. Use Face ID or a good passcode
  4. Let Keychain make strong passwords for you.

How secure is data transmission?

Next to data safety is communication between an app and its remote counterparts. 

Here are the security measures iOS offers for this case:

1. App transport security

There's a networking feature on iOS-powered devices called App Transport Security (ATS for short). ATS requires that all connections use HTTPS and be secured with the Transport Layer Security (TLS) protocol, unlike standard HTTP connections, which aren't encrypted. 

If connections don't meet security specifications, ATS blocks them. However, it can be configured to loosen up these restrictions (which Apple warns against, claiming that "it reduces the security of your app").

 

2. TLS pinning

HTTPS connections are checked by default. The system inspects the server certificate and checks if the certificate is valid for this domain. 

In theory, this should prevent the device from connecting to malicious servers. However, there are loopholes for cyber attackers to perform so-called "man-in-the-middle (MITM)" attacks. They do this by compromising a certificate authority or changing the user's device settings to trust another malicious certificate. 

This way, attackers could access all messages sent between the client and the server. 

TLS pinning restricts which certificates are considered valid for a particular website, ensuring the app communicates only with the verified server. iOS developers implement pinning by adding a list of valid certificates to their app bundle. The app checks if the certificate used by this server is on the list and only then communicates with the server.

 

3. End-to-end encryption

End-to-end encryption provides the highest level of security for data transportation. The information is protected with a key combined with your device passcode—a detail only the owner knows. 

Messages are encrypted so that only the sender or receiver can decrypt them. Neither Apple nor your services can read this data.

Details like Apple card transactions (iOS 12.4 or later), health and home data, search history, payment information, Wi-Fi passwords, and Siri information are stored in iCloud, secured by end-to-end encryption. 

FAQs

1. How does Apple protect user's privacy?

Apple offers iOS users quite a few stringent privacy controls and security features, including those for data storage and transportation. 

2. Is iOS more secure than Android?

Apple offers many security features and doesn't release its source code to developers, which is why its iOS operating system has long been considered more secure than Android. 

Still, that doesn't mean it can't be hacked.

3. How does Apple handle secure data storing?

The best-known iOS features for data storage: 

  • Sandboxing (every app has a sandbox, a directory it can use to store data in)
  • Data protection API (secures app files and prevents unauthorized access to them
  • Keychain (a secure space used to store bits of data)

4. How secure is data transmission?

iOS has the following features for secure data transmission:

  • App Transport Security (requires that all connections use HTTPS with TLS protocol)
  • TLS pinning (restricts which certificates are considered valid for a particular website)
  • End-to-end encryption (protects data with a key combined with the device passcode)