Mobile platforms and security models · Lesson 2 of 4
iOS security architecture: Secure Enclave, Data Protection classes, BFU and AFU
10 min read
Almost every limit you will meet when examining an iPhone comes from a small number of design choices Apple made in its security architecture. If you understand them, you can predict what an acquisition can recover, explain to a client why some data cannot be recovered, and recognize when a device's state gives you an opportunity that wrong handling will destroy. This lesson covers the boot chain, the Secure Enclave, how Data Protection encrypts files, and the difference between a phone that has never been unlocked since it started and one that has. Most of these mechanisms are documented in Apple's own Apple Platform Security guide.
A chain of trust from the first instruction
When an iPhone starts, the first code to run is the Boot ROM, burned into the system on a chip (SoC) at the factory. The Boot ROM checks that the next stage, the iBoot bootloader, is signed by Apple, iBoot checks the kernel, and the kernel enforces code signing for everything that runs afterward (the secure boot chain). Apple also personalizes each software installation for the individual device, using the device's Exclusive Chip ID (ECID, covered in lesson 1.4), so an old, vulnerable version of iOS cannot simply be reinstalled once Apple stops signing it.
Because the Boot ROM cannot be patched, a flaw in it affects every device with that chip for its whole life. The best-known example is checkm8, published in 2019, which affects only devices with A5 to A11 chips, up to the iPhone 8 and iPhone X. It allows code to run before iOS starts and is the basis of several extraction methods for those older models (lesson 2.4).
The Secure Enclave
Since the A7 chip (iPhone 5s), iPhones include a Secure Enclave: a separate processor inside the SoC with its own secure boot, its own memory and its own small operating system. It handles passcode verification, Face ID and Touch ID data, and the keys that protect user data. The main processor running iOS asks the Secure Enclave to perform operations; it never receives the most important keys itself.
The UID key and passcode entanglement
Each Secure Enclave contains a unique 256-bit key, the UID key, fused into the silicon during manufacturing. No software, including iOS and Apple's own tools, can read it. It can only be used, inside the Secure Enclave, to encrypt and decrypt.
When the user sets a passcode, iOS does not store it. Instead, the passcode is combined with the UID key in a deliberately slow key derivation, calibrated so that one attempt takes roughly 80 milliseconds on the device. The result protects the keys for user data. Two consequences matter for examiners:
- Guessing must happen on the device. Because the UID key never leaves the chip, an attacker cannot copy the data to a fast computer and try passcodes there.
- The Secure Enclave limits guessing. After repeated wrong passcodes, the Secure Enclave enforces growing delays. Apple's current guide lists 1 minute after the fourth failed attempt, rising to 1 hour after the seventh, 3 hours after the eighth and 8 hours after the ninth; after the tenth, the device must be connected to a computer to recover. Older iOS versions used a different, more lenient schedule, so record the version. If the "Erase Data" option is on, ten failures erase the phone. Supported devices also have a secure counter that cannot be reset by restoring storage.
A six-digit numeric passcode has one million possibilities. At 80 milliseconds per attempt with no delays, trying all of them would take about 22 hours; with the Secure Enclave's delays it is far longer. This is why passcode-guessing tools for current iPhones depend on vulnerabilities that bypass these limits, and why their availability changes with every iOS update.
Data Protection: how files are encrypted
iOS encrypts user data with a layered set of keys:
- Every file gets its own random per-file key, which encrypts the file's contents.
- The per-file key is wrapped (encrypted) by one of several class keys, depending on the protection class assigned to the file.
- The class keys are wrapped by keys derived from the UID key and, for classes A, B and C, the passcode.
- File system metadata, including the wrapped per-file keys, is protected by a separate file system key, which can be destroyed instantly to erase the device.
This is how "Erase All Content and Settings" makes all data unreadable in seconds.
The four protection classes
Apple defines four main Data Protection classes for files; developers choose the class for theirs.
| Class | Name | When the class key is available |
|---|---|---|
| A | Complete Protection | Only while the device is unlocked; the key is discarded shortly after locking (10 seconds when Require Passcode is Immediately) |
| B | Protected Unless Open | Files can be created and kept open while locked; existing closed files need an unlock |
| C | Protected Until First User Authentication | From the first unlock after boot until the device restarts or shuts down |
| D | No Protection | Always; protected only by the UID key |
Class C is the default for app data that has no explicit class, so it covers most of what examiners care about: many third-party app databases, much of the system data and many caches. Class A is used for particularly sensitive items, such as some mail data and app files the developer chose to protect strongly. Class D data is still encrypted, but because its key depends only on the UID key, it is available as soon as the phone boots.
The keychain, where iOS stores passwords, tokens and keys for apps, uses similar classes. Items marked "when unlocked" behave like class A. Items marked "after first unlock" behave like class C. Each of these has a "this device only" variant: such items are wrapped with the device's UID key when they are backed up, so they cannot be restored on another device or read on a computer. Items that require a passcode to be set are never backed up.
BFU and AFU: the state that decides what you can get
The protection classes lead directly to the two device states every mobile examiner must recognize.
Before First Unlock (BFU). The phone has been powered on or restarted, but nobody has entered the passcode since. The class A, B and C keys cannot be derived, because the passcode is needed for that. Only class D data and a small amount of system information are readable. A BFU iPhone can still receive calls and show some notifications, so it looks alive although most user data is sealed.
After First Unlock (AFU). The passcode has been entered at least once since boot. The class C keys stay available in the Secure Enclave until the next restart, even while the screen is locked. Class A keys disappear about 10 seconds after each lock, but most user data is class C. An AFU phone is therefore far more valuable to an examiner: an extraction method that can run code on the device may reach most user data without the passcode.
This difference is why the handling decisions in Module 2 matter so much. Letting the battery discharge completely, restarting the phone to "make it respond", or allowing a software update to install, turns an AFU phone into a BFU phone and can make most data unrecoverable.
Inactivity Reboot
Since iOS 18.1, an iPhone that has not been unlocked for about 72 hours restarts on its own. The feature is known as Inactivity Reboot, the name used inside iOS. The restart returns the phone to BFU. The timer runs inside the Secure Enclave, so keeping the phone isolated from networks does not stop it. For an examiner, a seized AFU iPhone running iOS 18.1 or later has a clock running from the last time it was unlocked, not from the time it was seized. Record that time if you can establish it, and plan the acquisition accordingly. Press reports in 2026 described commercial tools said to prevent this restart. Treat such claims as unconfirmed and version-specific: test them, and record their use.
Controls on wired connections
Acquisition tools connect to the phone through its Lightning or USB-C port, so Apple restricts that port when the phone is locked.
- USB Restricted Mode (iOS 11.4.1 to iOS 18) blocks new data connections once the phone has been locked for more than an hour, unless the user has allowed accessories while locked. Within that hour, only accessories already known to the phone are accepted, and an attempt by an unknown accessory disables all accessory data connections until the next unlock. After three days without an accessory connection, new data connections are blocked as soon as the phone locks. Charging still works. Do not connect a locked iPhone to an untested cable, hub or computer.
- Wired Accessories (iOS 26 and later) is the setting that now controls the port, under Settings › Privacy & Security. With the default, Automatically Allow When Unlocked, a new accessory or computer gets a data connection only after the phone is unlocked, and an accessory connected while the phone was unlocked stays connected after it locks. Models with USB-C also offer Always Ask and Ask for New Accessories; Always Allow removes the restriction. Apple's security guide still describes the one-hour and three-day rules, so test the exact iOS version on a reference phone before you rely on either description.
- Trusting a computer requires the phone to be unlocked and, since iOS 11, the passcode to be entered. The phone and the computer then exchange keys and store a pairing record. Pairing records found on a suspect's own computer are evidence too (lesson 2.3).
- Lockdown Mode, an optional mode for people at risk of targeted attacks, blocks wired connections to computers and accessories while the phone is locked.
Record these settings when you can see them safely. They explain why a tool fails.
Other features examiners meet
- Stolen Device Protection. On by default since iOS 26.4 (iOS 26.4.1 on managed devices). When the phone is away from familiar locations, some sensitive actions require Face ID or Touch ID with no passcode fallback, and some security changes also require a one-hour security delay. A laboratory is rarely a familiar location, so the passcode alone may not be enough there; lesson 2.3 covers the effect reported on pairing.
- Encrypted backups. Computer backups, made with Finder on a Mac or with the Apple Devices app or iTunes on Windows, can be protected with a separate backup password. Encrypted backups contain more data, including keychain items and health data, than unencrypted ones (lesson 2.3).
- Advanced Data Protection for iCloud. When enabled, most iCloud data, including backups and photos, is end-to-end encrypted, so Apple cannot provide it (lesson 2.7).
Applying this to the Corvane case
When Corvane collects Lena's iPhone 14 on Day 9, the examiner's first questions come directly from this lesson. Is the phone powered on, and has it been unlocked since it last started? Which iOS version is it running, and when was it last unlocked, given Inactivity Reboot? Is Lena willing to provide the passcode under the company's policy, or does the examiner have to work without it? The iPhone 14 has an A15 chip, so a Boot ROM exploit such as checkm8 does not apply. Here the answers are favorable: the phone runs iOS 26 and was unlocked about an hour before collection, so it is AFU, and Lena provides the passcode. Stolen Device Protection is on, which matters at the trust prompt (lesson 2.3). Whether the photos of the pricing sheet, the WhatsApp database and the location history can be recovered depends mainly on these answers, not on the tool chosen.
Exam focus: Know the four Data Protection classes and when each key is available, especially that class C is the default and survives locking until a restart. Be able to explain BFU versus AFU and what changes them, why passcode guessing must run on the device, and how Inactivity Reboot and the controls on wired connections affect an acquisition.
Practice questions
Check your understanding. These questions do not count towards the exam.
Sign in to save your progress and continue where you left off. It is free. Sign in