MobDojoStart learning free

Mobile Fundamentals · Mobile Operating Systems · Lesson 4 of 4

Sandboxes

The walls that keep one app from reading another's data.

14 min70 XPLab in Pro

Walls between apps

A sandbox is the set of walls the operating system builds around every app. Each app gets its own private storage folder, and by default it can read and write there and nowhere else. The operating system enforces these rules, so an app can't simply decide to ignore them.

The two systems build the walls a little differently. Android gives each app its own Linux user ID when it's installed, and the core of the system, the kernel, keeps apps with different IDs out of each other's files. iOS gives each app its own randomly assigned home folder, and the sandbox stops it reading or changing other apps' data.

When an app genuinely needs something outside its walls, it has to go through the system. To attach a photo, an app can open the system photo picker, which hands over only the pictures you select. It can also ask your permission to see the library.

This is why a shady game can't read your banking app's data or your messages, even though they all sit on the same phone.

On the simulated phone you're looking through TrailSnap's eyes. Try opening each folder.

Breaking out

The sandbox is only as strong as the operating system enforcing it. Underneath, every phone has a root account, an all-powerful administrator that ordinary apps never get. Gaining root access lets you step around the normal rules. On Android this is called rooting. The iPhone version has its own name, borrowed from the idea of breaking out of a locked cell.

They usually happen differently. Many Android phones let you unlock the bootloader, which wipes the phone, and then install a rooting tool. Some makers and carriers block unlocking. iPhones have no official unlock, so breaking out depends on security bugs that Apple keeps patching. Public tools often work only on older iOS versions.

Full control cuts both ways. Malware running with root can reach any app's data, and many banking apps refuse to run on modified phones.

Researchers and forensic examiners use these techniques on purpose. A bug called checkm8, in the startup code of iPhones from the 4S to the X, can't be fixed by a software update. Some forensic tools use it to reach more of a phone's data.

Hands-on lab

Try it on the simulated phone

Browse files as an app and run into the sandbox walls.

Open the lab
Test yourself

Can you answer these?

  1. TrailSnap tries to open the banking app's private files. What happens?
  2. What's it called on an iPhone?

Answer them in the app to earn 70 XP (Pro).

Answer in the app