Apple Launches $200,000 Bug Bounty, Details iOS 10 Enclave Defenses

Behind the Scenes of iOS Security — Black Hat

Black Hat

Hardware-enforced key isolation and the physical destruction of cloud signing smart cards ensure user secrets remain technically inaccessible to host operating systems and Apple itself.

AI-assisted summary of Behind the Scenes of iOS Security — original source. Check the original for full context.

Source published:

Key ideas

  • iOS 10 implements execute-only memory (XOM) and dual virtual mappings for WebKit JIT pages, preventing attackers with write-anywhere primitives from directly reading back or executing injected shellcode. (1:04)
  • The Secure Enclave Processor (SEP) isolates Data Protection key derivation using a hardware-bound UID key, enforcing rate limiting and an absolute 10-attempt lockout counter entirely outside the Application Processor's reach. (6:57)
  • iCloud Keychain Backup protects escrow records across HSM clubs using a distributed quorum protocol, terminating firmware updates by physically destroying administrative signing smart cards in a blender. (32:28)
  • Apple launched its first official Security Bounty program with top payouts reaching $200,000 for secure boot firmware vulnerabilities and $100,000 for Secure Enclave extraction, alongside a 1:1 charity donation match. (36:00)

Detailed notes

## Background Published on YouTube by Black Hat on August 16, 2016, this presentation features Apple Head of Security Architecture and Architecture Ivan Krstić delivering a deep-dive technical briefing. According to the page description, the talk covers three core iOS security systems: hardened JIT memory mapping new to iOS 10, Data Protection key derivation using the Secure Enclave Processor, and the cryptographic synchronization fabric backing iCloud Keychain, HomeKit, and Auto Unlock.

## TL;DR Ivan Krstić details the low-level cryptographic engineering that secures modern iOS devices and cross-device secret synchronization. He explains how iOS 10 eliminates writable-and-executable JIT memory mappings using execute-only memory (XOM), how the Secure Enclave Processor isolates master key derivation and brute-force rate-limiting away from the untrusted Application Processor, and how Cloud Key Vault HSM clusters use quorum consensus to safeguard escrowed credentials without Apple holding the decryption keys. Krstić also describes the physical destruction ceremony of the HSM firmware signing smart cards and concludes by officially announcing the launch of the Apple Security Bounty program.

## Atmosphere & style The presentation carries the measured, authoritative, and intensely rigorous tone of a high-stakes engineering masterclass. Krstić speaks with calm confidence and minimal theatricality, letting intricate silicon designs, low-level assembly workflows, and cryptographic primitives command the room's attention. The atmosphere balances executive poise with subtle, dry humor—most notably when showcasing the mechanical destruction of firmware signing cards in a commercial blender labeled the 'Crypto Blender'—and turns strictly guarded during the audience Q&A, where Krstić firmly deflects political controversies to keep the focus locked on verifiable implementation details.

## Bulletin - [01:04](https://www.youtube.com/watch?v=BLGFriOKz6U&t=64s) iOS 10 implements execute-only memory (XOM) and dual virtual mappings for WebKit JIT pages, preventing attackers with write-anywhere primitives from directly reading back or executing injected shellcode. - [06:57](https://www.youtube.com/watch?v=BLGFriOKz6U&t=417s) The Secure Enclave Processor (SEP) isolates Data Protection key derivation using a hardware-bound UID key, enforcing rate limiting and an absolute 10-attempt lockout counter entirely outside the Application Processor's reach. - [32:28](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1948s) iCloud Keychain Backup protects escrow records across HSM clubs using a distributed quorum protocol, terminating firmware updates by physically destroying administrative signing smart cards in a blender. - [36:00](https://www.youtube.com/watch?v=BLGFriOKz6U&t=2160s) Apple launched its first official Security Bounty program with top payouts reaching $200,000 for secure boot firmware vulnerabilities and $100,000 for Secure Enclave extraction, alongside a 1:1 charity donation match.

## Key takeaways - [00:00](https://www.youtube.com/watch?v=BLGFriOKz6U&t=0s) Apple deliberately removed encryption from iOS 10 kernelcaches during performance profiling after concluding it provided no meaningful security boundary. - [02:36](https://www.youtube.com/watch?v=BLGFriOKz6U&t=156s) WebKit JIT in iOS 10 splits the 32 MB buffer into separate readable/executable and readable/writable virtual mappings, hiding the writable address inside an execute-only memcpy routine. - [06:57](https://www.youtube.com/watch?v=BLGFriOKz6U&t=417s) Data Protection treats the Application Processor as potentially compromised, keeping raw master keys and derivation logic isolated inside the Secure Enclave Processor. - [08:58](https://www.youtube.com/watch?v=BLGFriOKz6U&t=538s) The hardware UID key is created at first boot by the SEP's hardware TRNG and cannot be extracted by any mutable software layer. - [10:47](https://www.youtube.com/watch?v=BLGFriOKz6U&t=647s) Key derivation iteration counts in the SEP are dynamically tuned to achieve a target delay of 100 to 150 milliseconds to systematically slow brute-force attacks. - [12:12](https://www.youtube.com/watch?v=BLGFriOKz6U&t=732s) File payloads are encrypted via AES-XTS, and file keys passed to the kernel are ephemerally rewrapped so they become entirely useless upon reboot. - [10:47](https://www.youtube.com/watch?v=BLGFriOKz6U&t=647s) Data Protection Class B relies on Curve25519 asymmetric cryptography, allowing incoming files to be encrypted while the device is locked without exposing the private decryption key. - [19:00](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1140s) Overnight iOS updates utilize One-Time Unlock Tokens minted by the SEP with an 8-hour expiration to finish post-boot database migrations before the user wakes. - [21:34](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1294s) Demoting a production device for hardware debugging permanently exposes an alternate UID key, destroying access to any previously stored user Data Protection keys. - [27:20](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1640s) The Cloud Key Vault escrow architecture relies on zero-knowledge Secure Remote Password (SRP) authentication directly terminated on physical HSMs. - [29:58](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1798s) To prevent partition and offline brute-force attacks, Cloud Key Vault HSMs form five-member clubs requiring quorum consensus before updating failure counters. - [32:28](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1948s) Physical destruction of the Custom Security Code smart cards renders production Cloud Key Vault HSM firmware permanently immutable, eliminating coercion vectors. - [43:11](https://www.youtube.com/watch?v=BLGFriOKz6U&t=2591s) Because existing escrow records cannot be migrated between Cloud Key Vault fleets, software patches require standing up separate new fleets solely for future enrollments. - [36:00](https://www.youtube.com/watch?v=BLGFriOKz6U&t=2160s) Apple's initial Security Bounty program begins by invitation with rewards tiered up to $200,000 for verified Secure Boot exploits.

## Detailed walkthrough ### [00:00](https://www.youtube.com/watch?v=BLGFriOKz6U&t=0s) Introduction and Decrypted Kernelcaches

Ivan Krstić introduces himself as the head of security engineering and architecture at Apple, welcoming the audience to a deep dive into three major iOS security mechanisms—including a brand-new feature debuting in iOS 10. Before jumping into the main agenda, he addresses the widespread speculation surrounding a recent change in the iOS 10 betas: unencrypted kernelcaches. Following laughs from the crowd, Krstić explains that in iOS 10 betas, Apple intentionally shipped unencrypted kernelcaches, and in subsequent betas extended this practice to unencrypted iBoot and boot logos for pre–iPhone 5s devices.

Addressing rumors head-on, he clarifies that this change was deliberate. While conducting general performance optimizations, Apple reviewed the efficacy of specific security controls and concluded that removing this layer of encryption had zero impact on platform security or the protection of user data. As Krstić succinctly frames it: “yes this is on purpose um we from time to time revisit the efficacy of some of our security mechanisms and in this case while doing some other optimizations we took a look and realized that we could simply remove this encryption and uh not in any way impact platform security”.

- The iOS 10 developer betas stopped encrypting kernelcaches, and later betas left iBoot and boot logos unencrypted on pre–iPhone 5s devices. - Apple confirmed the unencrypted kernelcache was a deliberate optimization decision, with no negative bearing on platform security or user data encryption.

---

[01:04](https://www.youtube.com/watch?v=BLGFriOKz6U&t=64s) Hardened WebKit JIT Mapping in iOS 10

Krstić shifts focus to the first major technical topic: hardened WebKit Just-In-Time (JIT) memory mapping in iOS 10. To maintain competitive web performance in Safari, JavaScript execution relies heavily on JIT compilation to produce machine code on the fly. However, iOS strictly enforces mandatory code signing across all executable pages. To accommodate JIT compilation, Apple historically had to relax this rule and grant the Safari JIT engine the ability to emit unsigned native code directly into memory.

In iOS 9 and earlier, this compromise was implemented through a dedicated 32-megabyte memory region mapped as readable, writable, and executable (`RWX`). This configuration presented a serious security hazard: if an attacker discovered a "write-anywhere" primitive via a browser-level JavaScript bug, they could trivially achieve arbitrary code execution by copying shellcode directly into the `RWX` JIT region and redirecting execution to it.

To eliminate this vulnerability vector, iOS 10 leverages execute-only memory (`XOM`). Krstić notes that while ARM processors historically made memory readability implicit whenever execution permissions were granted, the ARMv8 architecture introduced formal support for execute-only pages. Apple integrated the software implementation of execute-only memory directly into the iOS 10 kernel, allowing the operating system to map pages that code can execute, but which the running process cannot inspect or read.

```mermaid flowchart TD accTitle: Evolution of iOS WebKit JIT Mappings accDescr: Visual comparison between iOS 9 RWX JIT memory mapping and iOS 10 dual-mapping using execute-only memory.

subgraph iOS9["iOS 9 Implementation"] Phys9["Physical Memory (32 MB)"] RWX["Single Virtual Mapping: Readable, Writable, Executable (RWX)"] Phys9 --> RWX end

subgraph iOS10["iOS 10 Hardened Architecture"] Phys10["Physical Memory (32 MB)"] ExecMap["Virtual Mapping: Executable (RX)"] WriteMap["Virtual Mapping: Writable (RW)\n(Secret Randomized Address)"] XOM["Execute-Only Page (X)\nSpecialized memcpy\n[Embeds Writable Address]"]

Phys10 --> ExecMap Phys10 --> WriteMap XOM -.->|"Writes JIT code via secret address"| WriteMap end ```

- In iOS 9, Safari maintained a single 32 MB JIT memory region marked `RWX`, allowing an attacker with a memory write primitive to drop shellcode and jump straight to it. - ARMv8 introduced hardware-level support for execute-only memory, which Apple implemented within the iOS 10 kernel to prevent a process from reading its own executing bytes.

---

[02:36](https://www.youtube.com/watch?v=BLGFriOKz6U&t=156s) Dual Virtual Mappings and Execute-Only memcpy

With execute-only memory supported by the kernel, iOS 10 redesigns the WebKit JIT compilation engine by splitting the single physical 32 MB JIT memory buffer into two distinct virtual mappings. One virtual mapping is strictly readable and executable (`RX`), while the second virtual mapping is readable and writable (`RW`). To prevent malicious use, the writable mapping is placed at a secret, randomized virtual address.

To safely write newly compiled code into this hidden memory space without exposing its location to the rest of the application, WebKit generates a specialized `memcpy` routine. The randomized base address of the writable mapping is baked directly into this custom `memcpy` as immediate assembly values. Once generated, Apple marks this `memcpy` function's memory page as execute-only and actively scrubs (zeroes out) the address of the writable region from all other process memory. When WebKit needs to write generated code, it calls this specialized `memcpy`, which uses its internally hardcoded secret address to copy the instructions into the writable alias, making the code appear instantly in the executable alias.

Krstić illustrates this mechanism live on stage by comparing an iPhone running iOS 9.3 against an iPhone running iOS 10: - **iOS 9.3 Demo**: Attaching to the Safari `com.apple.WebKit.WebContent` process reveals guard pages surrounding a unified 32 MB `RWX` JIT region. - **iOS 10 Demo**: Inspection shows the split structure with distinct executable and writable mappings, alongside an execute-only page. Attaching a debugger to inspect the disassembly of the execute-only region reveals immediate values representing the secret address (e.g., `0x1708ac000`), followed by basic memory copy instructions. - **Permission Verification**: Krstić demonstrates that attempting to read bytes from the normal readable/executable mapping succeeds with an error code of zero. However, attempting to read memory bytes directly from the execute-only `memcpy` mapping instantly crashes the debugger with a `bad access` exception, confirming the page is entirely unreadable.

Krstić emphasizes the security impact of this hardening measure: “where this gets us is that an attacker who simply has a right anywhere primitive from the context of uh JavaScript can no longer use it uh by itself for arbitrary code execution in the process instead they have to subvert control flow usually through r or a similar mechanism”.

- Physical JIT memory is aliased to two virtual addresses: one executable mapping and one writable mapping placed at a randomized address. - A tailored `memcpy` routine encodes the secret writable destination address as immediate values and is placed in execute-only memory. - The writable mapping address is zeroed out across the remainder of the address space, denying attackers read access even if they gain arbitrary memory read primitives. - An arbitrary write primitive within WebKit is no longer sufficient on its own to achieve arbitrary native code execution; adversaries are forced into complex control-flow hijacking techniques like Return-Oriented Programming (ROP).

---

[06:57](https://www.youtube.com/watch?v=BLGFriOKz6U&t=417s) Data Protection and the Secure Enclave Processor

Krstić introduces the next foundational topic: iOS Data Protection, the cryptographic system responsible for securing all user data at rest. When architecting Data Protection, Apple established strict security requirements: strong cryptographic keys, hardware-bound protection to rule out offline dictionary attacks, strict hardware rate-limiting to block brute-force passcode guesses, and support for modern alternative authentication vectors like Touch ID and macOS Sierra's Auto Unlock via Apple Watch.

Crucially, the architecture had to assume the host processor could be completely compromised. As Krstić notes: “we also had one more goal which is to entirely sidestep the attack surface for the AP this is the application processor this is the normal uh CPU the trun all uh uh all the rest of the code in the operating system”. To achieve this separation, authentication policies and attempt limits must remain strictly enforceable even when facing a completely adversarial Application Processor (AP). Under this model, long-term master keys are never exposed to the AP; any session-specific keying material released to the AP is strictly ephemeral, bound to the current session, and rendered useless across reboots.

To fulfill these constraints, Apple introduced the Secure Enclave Processor (SEP), beginning with the iPhone 5s. The SEP is an isolated, dedicated silicon co-processor running its own compact Trusted Computing Base (TCB) with dedicated hardware-accelerated cryptographic engines. It features isolated encrypted memory, communicates with the general AP exclusively through a narrow mailbox interface, and relies on factory-paired cryptographic channels to communicate securely with both the Touch ID fingerprint sensor and the Apple Pay Secure Element.

- Data Protection safeguards resting user data against offline decryption and automated online brute-forcing. - The threat model treats the Application Processor (AP) running iOS as untrusted and potentially adversarial. - The Secure Enclave Processor (SEP) operates as an independent cryptographic coprocessor with isolated TCB, encrypted RAM, and dedicated cryptographic hardware. - Factory pairing establishes authenticated, encrypted communication channels between the SEP, the Touch ID sensor, and the Apple Pay Secure Element.

---

[08:58](https://www.youtube.com/watch?v=BLGFriOKz6U&t=538s) UID Keys, Keybags, and Brute-Force Rate Limiting

The internal cryptographic foundation of the SEP begins during manufacturing. The SEP contains an on-chip True Random Number Generator (TRNG) powered by free-running oscillators. The very first time silicon receives power at the factory, the TRNG generates the device Unique ID (UID) key. The UID is a private key that never leaves the hardware boundaries of the Enclave; it cannot be exported, and it can only be utilized by dedicated cryptographic operations burned immutably into secure hardware logic. No mutable software or firmware update can ever expose or alter this root secret.

All higher-level keys protecting user files are organized into "user keybags"—sets of cryptographic keys assigned to each user profile on the device. Every user keybag is encrypted and wrapped by a master key derived using a combination of the user's secret passcode and the hardware UID key inside the SEP.

Because the hardware UID is accessible only via operations executed internally by the SEP, the Enclave maintains absolute authority over passcode evaluation. After ten consecutive incorrect passcode attempts, the SEP locks down and permanently refuses to process any additional key derivation operations against the UID key. Krstić transitions into how keys within a keybag are differentiated into distinct classes (Classes A through D), where certain class keys remain accessible while the device operates in the background, while others are strictly restricted until the device is explicitly unlocked by the user for the first time.

- The hardware UID key is generated internally on first boot via the SEP's hardware TRNG (free-running oscillators) and remains strictly non-exportable. - The UID is only accessible via hardwired silicon cryptographic operations, preventing mutable software from reading it. - Keybags contain user keys wrapped by a master key derived jointly from the user's passcode and the hardware UID. - The SEP enforces a hard limit of 10 failed passcode attempts before permanently disabling further derivation requests. - Data Protection categorizes file keys into Classes A through D, controlling key availability based on lock state and initial post-boot authentication.

[10:47](https://www.youtube.com/watch?v=BLGFriOKz6U&t=647s) Data Protection Classes and Key derivation

Ivan Krstic breaks down the cryptographic specifics of the iOS Data Protection classes, noting that while Class C and Class D are standard, “Class A is stronger; these are only available while the user is actively using the unlocked device.” Classes A, C, and D rely on 256-bit AES keys. Class B takes a radically different architectural approach: rather than a symmetric key, it uses a Curve25519 asymmetric key pair. This public-key setup allows the public key to remain perpetually accessible on the device, while the corresponding private key is strictly wiped and inaccessible whenever the device is locked.

```mermaid flowchart LR accTitle: Class B Cryptographic Asymmetric Operation accDescr: Class B data protection allows writing files while locked using an asymmetric Curve25519 keypair. subgraph ClassB["Curve25519 Class B Keypair"] Pub["Public Key<br/>(Always Available)"] Priv["Private Key<br/>(Unlocked State Only)"] end Pub -->|"Encrypt / Write while locked"| Store["Encrypted Storage (Dropbox mode)"] Store -.->|"Decrypt / Read only when unlocked"| Priv ```

Displaying an annotated keybag taken straight from the file system, Krstic explains the components present on every iOS unit: a version header, the salt, and the iteration count used for the key derivation function (KDF), accompanied by the key identifiers for the wrapped keys and the raw bytes of the Class B public key. Deriving the master key is a deliberate split between software and hardware: userland takes the user passcode and salt, runs it through an initial KDF phase, and hands the output over to the Secure Enclave Processor (SEP). The SEP continues iterating using its hard-wired hardware UID key. Krstic emphasizes that the number of iterations is tuned dynamically to enforce a strict latency target:

> “And the number of iterations is chosen to meet a time goal which is between 100 and 150 milliseconds, so we want it to be the case that derivation takes a certain amount of time.”

- **Class A, C, and D Keys**: 256-bit AES symmetric keys. - **Class B Keypair**: Curve25519 asymmetric key pair; public key stays open, while the private key is held strictly during active unlocked sessions. - **Hardware-bound Iteration**: The SEP hardware UID engine enforces a calculation delay between 100 ms and 150 ms to defeat offline brute-force attacks.

---

[12:12](https://www.youtube.com/watch?v=BLGFriOKz6U&t=732s) File Encryption and Ephemeral Boot Keys

Turning to file-level security, Krstic details how individual file payloads are encrypted using AES-XTS with 128-bit keys. Crucially, every individual file receives its own distinct, cryptographically random key minted directly inside the SEP. These raw keys never surface in cleartext on the Application Processor (AP). Instead, the long-term wrapped file keys live within file metadata, wrapped by the user keybag keys that only the SEP can parse.

```mermaid flowchart TD accTitle: Ephemeral File Key Wrapping Flow accDescr: Step-by-step lifecycle showing how file keys are wrapped with ephemeral boot keys before reaching the kernel and storage controller. subgraph Boot["Boot Initialization"] SEP_Boot["SEP AES Engine"] -->|"Secure Outbound Channel"| NC["NAND Storage Controller"] SEP_Boot -.->|"Stores Ephemeral Key"| NC end

subgraph Access["File Access Pipeline"] Kernel["Kernel"] -->|"1. Fetch wrapped file key"| SEP["SEP (SKS)"] SEP -->|"2. Unwrap via Keybag Key & Rewrap via Ephemeral Key"| SEP SEP -->|"3. Ephemerally wrapped key"| Kernel Kernel -->|"4. Send wrapped key"| NC NC -->|"5. Unwrap via Ephemeral Key & Decrypt data"| Nand["NAND Flash"] NC -->|"6. Cleartext data"| Kernel end ```

When an active device requests a file, the kernel pulls the wrapped key from the file system metadata and submits it to the SEP. The SEP unwraps the key using the user keybag key, but it does not return the plaintext key to the operating system. Instead, it rewraps the key using an ephemeral AES key created by the SEP at boot and pushed over a dedicated outbound hardware channel to the NAND storage controller. The kernel receives only an ephemerally wrapped key, passes it along to the storage controller, and the controller decrypts the key on-chip to read the ciphertext off flash and return cleartext back into kernel space. Krstic points out the profound architectural benefit:

> “What's important about this is that if you look at the keys that are exposed to the kernel, none of them have any long-term value; after the device is rebooted, that ephemerally wrapped key simply serves no purpose.”

- **Per-file Encryption**: AES-XTS-128 using SEP-generated random keys. - **Boot Session Binding**: The storage controller receives an ephemeral master key via an isolated secure channel at early boot. - **Zero Kernel Exposure**: Even an attacker with complete kernel code execution inspects only ephemerally wrapped keys useless across reboots.

---

[14:03](https://www.youtube.com/watch?v=BLGFriOKz6U&t=843s) Device Boot Sequence and Effaceable Storage

Achieving Apple’s data protection goals demands intricate hardware and daemon handoffs from the moment power is applied. When the kernel boots from the read-only system partition, the AppleKeyStore driver retrieves the Class D key out of *effaceable storage*—a dedicated area of NAND flash silicon configured to forbid wear leveling or block relocation, ensuring data placed in those sectors can be securely zeroed out on demand. The encrypted Class D key is piped into the SEP, decrypted via the hardware UID key, and registered into the Secure Key Store (SKS) application running within the Secure Enclave.

```mermaid flowchart TD accTitle: Boot Sequence and Early Keystore Unwrapping accDescr: Early boot transitions from effaceable storage loading to launchd and keybagd initialization. subgraph Effaceable["Effaceable Storage (No Wear-Leveling)"] DKey["Class D Key (Encrypted)"] MediaKey["Media Key"] ProtKey["Protection Key"] end

DKey -->|"Load into SEP"| SKS["SEP SKS Keyring"] MediaKey -->|"Decrypt metadata"| FS["File System Metadata"] ProtKey -->|"Decrypt System Keybag"| KeybagD["keybagd Daemon"]

FS --> Launchd["launchd"] Launchd --> KeybagD SKS -->|"Unwrap Class D"| KeybagD KeybagD -->|"Load Class B Public Key"| SKS ```

The kernel then decrypts overall file system metadata using an effaceable-storage Media Key, allowing `launchd` to launch, mount the user partition, and fire up `keybagd`. Because the Class D key is now unlocked in the SKS keyring, `keybagd` can read the system keybag file off the disk, decrypt it using a third effaceable value called the Protection Key, and hand it to SKS to register the Curve25519 Class B public key.

At this stage, the user has entered zero credentials. Classes A and C, along with the Class B private key, remain completely undecryptable. However, this state gives iOS a functional “Dropbox mechanism”: the device can boot up background services, read Class D operational files, and receive incoming content—such as incoming email attachments or messages—by writing files protected under the Class B public key, guaranteed unreadable until the owner arrives to unlock the screen.

---

[16:27](https://www.youtube.com/watch?v=BLGFriOKz6U&t=987s) First Unlock, Lock State, and Biometric Integration

When a user interacts with the lock screen after a cold boot, SpringBoard captures the passcode and transmits it to the SEP. Combining this passcode with the burned-in hardware UID key, the SEP reconstructs the raw master key, instantly unwrapping the remaining Class A, Class B (private), and Class C keys into the SKS keyring.

```mermaid flowchart TD accTitle: Touch ID Biometric Keyring Reconstitution accDescr: Shows the relationship between SKS, s_bio, and the random secret during device lock and biometric unlock. subgraph FirstUnlock["First Unlock Flow"] Master["Master Key"] -->|"Encrypt with Random Secret"| EncMaster["Encrypted Master Key"] Secret["Random Secret"] -->|"Sent to isolated app"| SBio["s_bio App (Biometric)"] EncMaster -->|"Stored in memory"| SKS["SKS (Raw Master Key Wiped)"] end

subgraph SensorMatch["Touch ID Fingerprint Match"] Finger["Home Button Sensor Image"] --> SBio SBio -->|"Valid Match: Return Secret"| SKS SKS -->|"Decrypt Master Key"| Ring["Reconstitute Class A & B Private Keys"] end ```

To support Touch ID without keeping the sensitive master key exposed in raw SEP memory, the SEP creates a single-use random secret, encrypts the master key with it, and hands *only* the secret to `s_bio` (the isolated biometric matching daemon within the Secure Enclave). The raw master key is immediately wiped:

> “After this, SKS will securely destroy the master key, the raw master key from its memory, holding on only to the encrypted version with the secret that it's sent to `s_bio`.”

When the device locks, the SKS simply purges the Class A and Class B private keys from its keyring. The Class C key remains loaded (as it is accessible after first unlock), alongside Class D and the Class B public key. When a finger depresses the home button sensor, the sensor streams the fingerprint raster directly to `s_bio`. If `s_bio` validates the biometric print, it releases the random secret back to SKS, which temporarily unseals the master key, re-derives the Class A and Class B private keys, restores them to the active keyring, and immediately destroys the cleartext master key once more.

---

[19:00](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1140s) One-Time Unlock Tokens and the Demotion Mechanism

Krstic introduces an advanced lifecycle feature introduced to make background updates painless: “Update Later” (install overnight). Historically, applying an update required a full reboot that stripped all encryption keys, leaving the device sitting uselessly at a cold-boot lock screen until the user awoke to type their passcode. With "Update Later," iOS prompts for the user's passcode upfront to authorize an OTUT (One-Time Unlock Token) inside the SEP.

Using the predictive machine-learning heuristics built into Apple's proactive assistant engine, the system determines the user's downtime habits:

```mermaid flowchart TD accTitle: Update Later Token Lifecycle accDescr: The generation, persistence, and execution flow of the One-Time Unlock Token across overnight software updates. Passcode["Passcode Entry + Install Later"] -->|"Authorize"| SEP_OTUT["SEP Authorizes OTUT"] Proactive["Proactive Engine Prediction"] -->|"Detect Final Bedtime Unlock"| Mint["SEP Generates OTUT"] Mint -->|"Persist + Start 8-Hour Expiration"| SUSub["Software Update Subsystem"] SUSub -->|"3:00 AM Execution"| Reboot["Run Update & Reboot System"] Reboot -->|"Consume OTUT"| Keyring["Unwrap User Data / Run Migrations"] Keyring --> Ready["Device Fully Unlocked & Updated for Morning"] ```

When the proactive assistant identifies what is likely the user’s final unlock before sleep, the SEP mints the actual OTUT. The software update subsystem takes custody of the persisted token and sets an uncompromising 8-hour hardware-enforced expiration timer. Around 3:00 AM, the OS executes the update, reboots the hardware, and supplies the OTUT to the SEP to restore access to the protected user keybag. The system can immediately run essential post-boot database migrations, presenting the owner with a fully refreshed, ready-to-use phone the following morning.

Krstic transitions to maintenance mechanisms, introducing the "demotion" process. Because Apple supports over one billion active consumer devices, engineers require concrete, robust debugging abilities to diagnose edge-case failures on production silicon without undermining or dismantling the Data Protection security perimeter.

- **OTUT (One-Time Unlock Token)**: Ephemeral authorization allowing an automated reboot to decrypt userland for post-update migrations. - **8-Hour Expiry**: The token self-destructs if software update cycles fail to complete within the 8-hour operating window. - **Proactive Scheduling**: Tokens are minted dynamically on the predicted final pre-bedtime unlock rather than sitting idle for extended periods.

[21:34](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1294s) Secure Enclave Processor Demotion and Data Protection Wrap-up

Ivan Krstic explains how Apple handles debugging on production hardware through a mechanism known as "demotion." The demotion feature allows a production device to enable lower-level debugging functionality—such as JTAG and the capability to load development software—specifically on the Application Processor (AP), while strictly excluding the Secure Enclave Processor (SEP). To trigger this mode, the device must first be authorized by an Apple personalization server, which mandates that the target unit be completely wiped and re-imaged with a fresh operating system.

Crucially, this transition enforces a hardware-level shift in the device's cryptographic identity. When demotion occurs, the hardware automatically exposes a completely different Unique ID (UID) key to the SEP. As a direct consequence, the original UID that was used to derive the device's master Data Protection key disappears entirely from mutable software reach. “In other words, if a production device is demoted, the UID key that was used in deriving the master key that protects any user data previously on that device is simply unavailable to any software—a different UID key turns up,” Krstic points out. This architectural barrier ensures that physical access combined with factory-style debugging privileges cannot retroactively reconstruct or decrypt existing user data, satisfying all of Apple's baseline Data Protection security requirements.

[22:40](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1360s) The Challenges and Design Goals of Synchronizing Secrets

Moving beyond single-device Data Protection, Krstic pivots to the problem of moving secrets across multiple devices within a user's ecosystem. Modern operating system features heavily rely on seamless cryptographic sharing: - **Safari Autofill**: Synchronizing stored web passwords and credit card credentials across phones, tablets, and Macs. - **Auto Unlock**: Securely provisioning and passing ephemeral keys between an Apple Watch and a paired Mac to unlock the computer without a password. - **HomeKit**: Replicating authorization keys to every approved device so that a homeowner can manage smart devices like door locks from whichever screen is at hand.

Krstic analyzes the two historical approaches to distributed secret storage and explains why both fail consumers. The first standard approach relies on generating an ultra-strong, random key to encrypt everything in transit. While cryptographically sound, this yields an unworkable user experience because individuals are forced to transcribe, print, or store recovery phrases in obscure locations. The second approach derives transit keys directly from a user's master account password. However, this model breaks down because users notoriously pick weak passwords, immediately putting the cloud provider's backend into a privileged position where it can brute-force the credential and seize the underlying payload. Displaying an excerpt from a cryptography text noting that humans are inherently poor at generating high-entropy keys, Krstic outlines Apple’s five strict design criteria for iCloud secret synchronization:

1. **Selective Availability**: Necessary secrets must be reachable on all designated user devices. 2. **Strong Cryptography**: Data must be shielded by robust cryptographic keys. 3. **Frictionless Recovery**: Users must be able to restore secrets after losing all hardware without having to write down emergency recovery keys and stash them in a sock drawer. 4. **Zero Knowledge**: Secrets must never be exposed to Apple at any stage. 5. **Brute-Force Immunity**: The recovery pipeline must prevent brute-force attacks against lower-entropy credentials even if an adversary gains full control of the cloud backend.

[24:57](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1497s) iCloud Keychain Circles and Cloud Escrow Architecture

To satisfy standard day-to-day synchronization, Apple developed the iCloud Keychain synchronization circle. Every device admitted into the circle generates a dedicated, high-entropy key pair locally. When a user introduces a new piece of hardware, the new device cannot unilaterally join; it must receive explicit cryptographic approval from an existing, already-enrolled device. The Apple Cloud backend serves purely as an untrusted message broker and storage relay. Because messages remain encrypted under keys generated exclusively on endpoints, Apple retains zero visibility into the synchronized payloads.

```mermaid flowchart TD accTitle: iCloud Keychain Circle and Cloud Key Vault Escrow accDescr: Diagram showing how a trusted device uses iCloud Keychain circles for peer sync and routes escrow backups through HSMs.

subgraph Circle ["Device-to-Device Circle"] DevA["Trusted Device A"] DevB["New Device B"] CloudMsg["Apple Cloud Relay\n(Untrusted Storage)"]

DevA -->|"Approves enrollment"| DevB DevA <-->|"E2E encrypted sync"| CloudMsg DevB <-->|"E2E encrypted sync"| CloudMsg end

subgraph Escrow ["iCloud Keychain Backup & Escrow"] UserSecret["Keychain Secrets"] EscrowKey["Random Escrow Key"] iSC["iCloud Security Code\n(Device Passcode)"] HSM["Cloud Key Vault\n(Fleet HSM Cluster)"]

UserSecret -->|"Encrypted with"| EscrowKey EscrowKey & iSC -->|"SRP verifier + record"| HSM end ```

The model becomes far more complex when a user loses all active devices and must recover their secrets from scratch. To resolve this, Apple introduced the iCloud Keychain Backup flow. This introduces an auxiliary credential dubbed the iCloud Security Code (iSC), which is most often configured as the local device passcode—a secret never disclosed to Apple. The system generates an ephemeral, high-entropy random key termed the "escrow key," encrypts the user's keychain contents with this escrow key, and then wraps the escrow key itself with a key derived from the iSC. The wrapped package and encrypted payload are subsequently uploaded to Apple's infrastructure.

While this covers standard data recovery, it introduces a dangerous vulnerability: because passcodes typically have limited entropy (such as a 6-digit numeric PIN with only one million possible combinations), an adversarial cloud backend could trivially brute-force the iSC to expose the underlying escrow key. To prevent this, Apple mandated that unwrapping the escrow key must take place exclusively inside specialized Hardware Security Modules (HSMs) capable of enforcing rate-limiting and authorization policies.

[27:20](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1640s) Cloud Key Vault Fleet and Secure Remote Password Verification

Apple's solution to secure cloud escrow is an internal architecture known as the "Cloud Key Vault." This system consists of an extensive fleet of paired units, where an individual host machine connects directly to a tamper-resistant HSM cryptographic co-processor. These HSMs run custom, cryptographically signed firmware that prevents keys from being exported in plaintext and exposes strictly constrained cryptographic APIs.

The entire Cloud Key Vault fleet operates its own isolated internal Certificate Authority (CA), whose root private key never leaves the physical hardware of the HSMs. Each iOS device in the field ships with the public certificate of this fleet CA hardcoded into the OS. To control execution, the HSM strictly validates two critical keys: 1. **Custom Secure Code Signing Key**: Authorizes and validates the deployment of verified software builds into the HSM. 2. **Service Key**: Grants the capability to process and unwrap incoming user escrow records.

Krstic breaks down the precise contents of a user's escrow record: - The user's strong, randomly generated **escrow key**. - A **Secure Remote Password (SRP) verifier** derived from their iCloud Security Code / device passcode. - A **maximum failure count** setting a ceiling on the total number of permitted incorrect passcode attempts.

The entire record is encrypted directly to the public Cloud Key Vault service key. Krstic observes: “Where does this get us? Well, we've effectively built a kind of Data Protection, but for escrow records.” When a user initiates recovery, their device contacts Apple Cloud, fetches the encrypted escrow record, and opens a cryptographic SRP session to the Cloud Key Vault. The HSM unpacks the record internally and initiates the zero-knowledge SRP handshake. If the user presents the correct iSC, the HSM yields the decrypted escrow key. If SRP authentication fails, a hardware-enforced monotonic counter increments; once the count matches the maximum failure limit, the record is flagged as permanently terminal, and the Cloud Key Vault refuses all future recovery attempts.

[29:58](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1798s) HSM Clubs and Quorum Consensus against Partitioning Attacks

```mermaid flowchart LR accTitle: HSM Club Quorum Commit Architecture accDescr: Flowchart illustrating how a club of five HSMs participates in a quorum consensus vote before recording failure attempts.

Proxy["Escrow Service Proxy"] --> Unit1["Originator HSM\n(Club Member 1)"]

subgraph Club ["HSM Club of 5 (Shared Service Key)"] Unit1 Unit2["HSM Member 2"] Unit3["HSM Member 3"] Unit4["HSM Member 4"] Unit5["HSM Member 5"] end

Unit1 -->|"Propose attempt / vote"| Unit2 Unit1 -->|"Propose attempt / vote"| Unit3 Unit1 -->|"Propose attempt / vote"| Unit4 Unit1 -->|"Propose attempt / vote"| Unit5

Unit2 & Unit3 & Unit4 -.->|"Majority Quorum Consensus"| Unit1 ```

Relying on a single HSM per user poses obvious reliability challenges, as hardware failures could permanently lock users out of their data. However, simply duplicating an escrow record across multiple separate HSMs creates an unacceptable security risk: backing up to five standalone units would multiply the brute-force attack budget by five, expanding a strict 10-guess ceiling into 50 attempts.

To resolve this trade-off between reliability and brute-force resistance, Apple groups the Cloud Key Vault fleet into clusters called "clubs" of five HSM units that share a single unified service key. An escrow record is certified against a specific club identified by the fleet CA. While clustering solves hardware redundancy, it introduces the threat of network partitioning attacks: an attacker with internal infrastructure access could physically isolate individual club members one by one, exhaust the full 10-attempt limit against each unit in isolation, and accumulate the combined failure threshold across the whole club.

Apple prevents this by enforcing a distributed quorum commit protocol directly across the HSM firmware: - Each individual club member maintains an independent, tamper-proof failure log for every escrow record. - Any incoming recovery transaction forces the HSMs to conduct a real-time distributed vote. - An attempt can only proceed if a strict majority quorum within the five-member club agrees to process the transaction and log the attempt state.

The physical architecture places an iCloud Escrow Service proxy at the front edge to receive client traffic, authenticated object storage at the back end, and the partitioned HSM clubs in between. Whenever an escrow transaction initiates, one HSM in the targeted club is chosen as the originator to formally propose the verification attempt to its peers.

- Production AP demotion forces an irreversible hardware switch to an alternate SEP UID, rendering previous Data Protection keys permanently unrecoverable. - iCloud Keychain sync relies on end-to-end device circles where incoming devices must be authorized by an already trusted device. - iCloud Security Codes map to the user's local device passcode, ensuring Apple never learns the underlying secret. - Cloud Key Vault HSMs leverage a fleet-wide Certificate Authority whose private keys are physically generated and locked inside the HSM silicon. - Escrow attempts utilize Secure Remote Password (SRP) verification to validate passcodes without leaking credentials in transit. - HSM clubs use groups of five hardware units bound by a majority quorum consensus to guarantee fault tolerance while eliminating network partitioning attacks.

[31:49](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1909s) Quorum Agreement and Failure Counter Updates in Cloud Key Vault

Ivan Krstic completes the technical walkthrough of the consensus protocol used across Hardware Security Modules (HSMs) in Cloud Key Vault. When an update to an escrow record's failure counter is initiated, the originating HSM queries the cluster: "Update, please give me your failure count for a specific escrow record." The peer units respond by transmitting their current counter values and casting affirmative votes, confirming they are not entangled in conflicting transactions. Once the originator verifies that a majority quorum has responded and that none of the nodes hold a record indicating a terminal failure count, it directs the peers to prepare to advance the counter—for instance, to five. Each participant validates the quorum, signals readiness, and executes the increment, with all club members ultimately confirming to the originator that their internal records reflect the newly committed counter value.

```mermaid flowchart TD accTitle: Cloud Key Vault Quorum Protocol accDescr: Step-by-step transaction flow between the originating HSM and peer members to update an escrow failure counter.

subgraph Phase1["Phase 1: Query & Voting"] A["Originating HSM"] -->|"Query counter & request vote"| B["Peer HSM Units"] B -->|"Return counter & vote YES"| A end

subgraph Phase2["Phase 2: Quorum Check & Prepare"] A -->|"Majority quorum verified: Prepare update"| B B -->|"Verify quorum & acknowledge ready"| A end

subgraph Phase3["Phase 3: Commit & Confirmation"] A -->|"Execute counter increment"| B B -->|"Confirm new failure counter value"| A end ```

[32:28](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1948s) The Smart Card Ceremony and Physical Destruction via the "Crypto Blender"

The firmware running on the HSMs underpinning Cloud Key Vault is governed by a Custom Security Code (CSC) signing key. Krstic outlines the physical administrative controls safeguarding this key: signing new firmware images requires a physical quorum of smart cards. When creating a new HSM fleet, Apple conducts an elaborate provisioning ceremony in which three administrative smart cards capable of unlocking the CSC signing key are sealed inside tamper-evident bags and distributed to three separate Apple organizations, which lock them inside three independent physical safes.

Addressing the obvious threat model—whether an adversary or rogue insider who gathered all three cards could sign malicious code to bypass security boundaries and brute-force user escrow records—Krstic delivers an emphatic negative. Before any Cloud Key Vault fleet enters production, representatives from all three organizations convene in a secure facility. They cross-check bag serial numbers against the original ceremony logs and record formal attestations swearing to their presence at creation, confirming no duplicate cards were struck, and certifying the tamper-evident seals remained unbroken throughout custody.

The cards are then combined not through a software operation, but using what Krstic jokingly introduces to audience laughter and applause as “a novel physical one-way hash function”—a commercial blender labeled the "Crypto Blender." Following this physical destruction, final formal attestations are recorded certifying that all administrative smart cards have been obliterated, that no unauthorized firmware images were signed while the cards existed, and that no residual administrative backdoors remain to modify the custom secure code loaded on the production fleet.

```mermaid flowchart LR accTitle: Administrative Smart Card Lifecycle accDescr: The lifecycle of admin smart cards from creation through attestation and destruction in the Crypto Blender. subgraph Provisioning["1. Provisioning"] A["Generate CSC Key"] --> B["Split to 3 Admin Cards"] B --> C["Seal in Evidence Bags"] C --> D["Store in 3 Separate Safes"] end subgraph Verification["2. Verification & Attestation"] D --> E["Inspect Serial Numbers & Seals"] E --> F["Record Formal Attestations"] end subgraph Destruction["3. Irrevocable Destruction"] F --> G["Crypto Blender"] G --> H["Cards Destroyed"] H --> I["Attest: No Cards Exist & Code Locked"] end ```

[35:00](https://www.youtube.com/watch?v=BLGFriOKz6U&t=2100s) Unequivocal Trust and Cloud Boundary Guarantees

Krstic explains why Apple adopts such an extreme, unusual procedure for destroying the administrative smart cards. While on-device features like Data Protection and the Secure Enclave Processor rely on deep silicon engineering to protect user assets, data in transit to off-device cloud infrastructure demands a higher evidentiary standard. Krstic emphasizes that maintaining long-term customer trust requires absolute technical finality: “So here when we make a statement like your secrets are not exposed to Apple when they're being synchronized, we have to be able to make it unequivocally and if we still retain possession of these admin cards there's the possibility that that's not true.” By mechanically destroying the root provisioning material, Apple eliminates the capacity to compromise the Cloud Key Vault even under internal or external coercion.

- Apple views security when data leaves the device as having even higher stakes than on-device storage. - Retaining administrative signing cards leaves an ongoing risk that claims of zero access could be rendered false. - The irreversible destruction protocol is designed to provide an absolute guarantee that Apple cannot read synchronized secrets.

[36:00](https://www.youtube.com/watch?v=BLGFriOKz6U&t=2160s) Announcing the Apple Security Bounty Program

Concluding his prepared remarks, Krstic announces the launch of the Apple Security Bounty program, which is met with immediate applause from the audience. Acknowledging the essential role played by external security researchers and Apple’s internal red team, Krstic observes that as core platform defenses have matured, finding high-impact exploits has become substantially more difficult. The bounty program is engineered to offer compensation matching the technical investment and creativity required to break modern iOS defenses, alongside public recognition for participating researchers.

The program includes four on-device vulnerability tiers and one cloud tier covering unauthorized access to iCloud account data hosted on Apple servers:

| Bounty Category | Target / Scope | Maximum Payout | |:--- |:--- |:--- | | Secure Boot Firmware Components | Extraction of confidential material from Secure Boot | Up to $200,000 | | Secure Enclave Processor (SEP) | Extraction of sensitive data from SEP execution environment | Up to $100,000 | | Kernel Code Execution | Execution of arbitrary kernel code with kernel privileges | Up to $50,000 | | Unauthorized iCloud Data Access | Access to unauthorized iCloud account data on Apple servers | Up to $50,000 | | Sandboxed Process Access | Process sandbox escape accessing sensitive user data | Up to $25,000 |

- Researchers who elect to donate their bounty payouts to an eligible charity receive an optional one-for-one match from Apple, doubling the total donation. - Listed payouts represent maximum award tiers; exact amounts depend on report clarity, a reproducible proof-of-concept, exploitation novelty, and the degree of user interaction required. - Exploits must function against the latest iOS release on the latest device hardware. - The bounty program launches in September 2016, beginning by invitation with a few dozen active researchers to refine triage workflows before expanding to wider submissions.

[39:40](https://www.youtube.com/watch?v=BLGFriOKz6U&t=2380s) Audience Q&A: Government Access, Trust Revocation, and Hardware Architecture

Opening the floor to questions, Krstic responds to inquiries from attendees:

- **FBI Device Unlocking Inquiries:** A researcher asks whether recent high-profile conflicts with the FBI influenced the security architecture in iOS 10. Krstic declines to discuss political matters: “I'm an engineer; I'm happy to answer technical questions about what I've covered today.” - **Device Trust Revocation:** An attendee asks if users can inspect and revoke specific trusted devices that share an iCloud Keychain circle to guard against an unlocked phone being linked without consent. Krstic clarifies that keybags themselves are never synced. He notes that changing the primary iCloud account password invalidates the trust pairing fabric as documented in the public iOS Security Guide, but confirms that viewing an active synchronized device management list is not currently supported in that workflow. - **Timing of Architecture Disclosures:** When asked why Apple chose to disclose deep Data Protection details and launch the bounty program now, Krstic points out that foundational architectures have long appeared in the public iOS Security Guide. He explains that today's presentation was meant to offer an unprecedented level of low-level technical detail for the security community, while the bounty program arrives specifically because the difficulty of locating critical vulnerabilities has escalated to the point of warranting direct financial rewards. - **Apple Pay Secure Element Separation:** An attendee asks about the architectural history behind keeping the Apple Pay Secure Element as a separate physical hardware module rather than embedding it inside the Secure Enclave Processor. Krstic declines to expand into unannounced hardware design rationale, reiterating his focus on the technical mechanisms presented during the talk.

[43:11](https://www.youtube.com/watch?v=BLGFriOKz6U&t=2591s) FIPS Certification and Cloud Key Vault Fleet Lifecycle

During the audience Q&A session, an attendee inquires whether Apple's cryptographic systems and methods are validated under FIPS 140-2. After locating the speaker in the room, Ivan Krstic points out that the precise status of Apple's FIPS validation is documented in the published iOS Security Guide, summarizing: “essentially some of it is validated and some is not.”

A follow-up question shifts back to the Cloud Key Vault hardware security modules, asking how software or firmware updates can be deployed once the code-signing key has been deliberately destroyed. Krstic clarifies that updating running hardware in place is fundamentally impossible by design: “there's not in fact that's the very purpose of destroying that uh that signing key”. When pressed on what happens if a zero-day or critical vulnerability is uncovered in production, Krstic explains the operational recovery protocol:

> “if a critical vulnerability were to be discovered in the Cloud Keychain Fleet we would have to stand up a new Fleet that has the patch software and then over time migrate new user enrollments to that Fleet”

Another audience member draws a comparison to Apple’s hardened posture against government access, asking what mitigations keep the chip from being forced to run modified software that might leak key material. Krstic gently clarifies the hardware terminology—noting the question concerns the Secure Enclave Processor (SEP) rather than the Secure Element (SE)—and states: “the software that runs on the SEP is covered by the same secure boot chain that validates all the rest of the software that's running on iOS devices.”

```mermaid flowchart TD accTitle: Cloud Key Vault Fleet Replacement Lifecycle accDescr: Flow showing how Apple handles vulnerabilities in the Cloud Key Vault fleet without updating existing hardware. subgraph FleetOps["Fleet Operations"] V["Vulnerability Identified in Fleet A"] --> N["Stand Up New Fleet B with Patched Firmware"] N --> U["Issue iOS Update with New Fleet B CA Certificate"] end subgraph Enrollment["Client Enrollment"] U --> M["New User Enrollments Directed to Fleet B"] E["Existing Escrow Records"] -->|"Locked permanently to"| O["Original Fleet A HSMs"] end ```

[45:09](https://www.youtube.com/watch?v=BLGFriOKz6U&t=2709s) Apple Watch Auto Unlock and Escrow Migration Boundaries

The conversation turns to the physical security of Auto Unlock. An attendee asks how the rest of a user’s devices or accounts remain safe if their Apple Watch is lost or stolen. Krstic asks if the person wears one themselves; when they admit they do not, Krstic smiles and remarks, “if you did you would know that uh when you uh set up your Apple watch you actually have to pick a passcode for it”. He explains that while a paired iPhone can assist in unlocking the watch, the watch hardware contains sensors that immediately detect when it is removed from the wrist. The moment wrist contact is lost, the watch locks instantly, requiring either a nearby paired iPhone unlock or manual entry of the watch passcode before it can authorize anything else.

Building on the earlier discussion of Cloud Key Vault fleets, an attendee asks what prevents an adversary or law enforcement agency—specifically naming the FBI—from forcing Apple to migrate existing user escrow keys over to a compromised or government-controlled fleet. Krstic explains that such an attack vector is architecturally impossible:

> “there is no ability to migrate an existing record to a new Fleet that's simply not possible what we can do is stand up a new Fleet and migrate new enrollments into that Fleet”

Krstic emphasizes that an existing escrow record can only ever be decrypted by the specific hardware security module cluster to which the user committed it. Introducing a new fleet requires deploying the new fleet's root CA certificate directly onto user devices via an iOS software update. When asked whether existing devices would stay attached to older fleets, Krstic notes that devices target the best fleet available to their current software version, underscoring that “more than 90% of our user base is using the latest version of iOS so that's a good place to be”.

[47:19](https://www.youtube.com/watch?v=BLGFriOKz6U&t=2839s) SEP Passcode Rate Limiting and Biometric Spoofing

An attendee asks about the enforcement mechanism behind the 10-attempt passcode limit before an iOS device wipes or locks out, asking whether that counter is maintained within the Secure Enclave or stored in external memory. Krstic confirms that the process is completely isolated:

> “it is enforced fully in the SEP the SEP has a secure monotonically increasing counter and if uh that counter reaches 10 incorrect passcode attempts it will simply refuse to use the UID key any further for that user key bag”

The next question raises concerns over fingerprint spoofing research and large-scale biometric credential theft, citing the Office of Personnel Management (OPM) breach. The attendee wonders whether Apple has considered mitigations against fabricated fingers or allowing end users to shorten the 48-hour passcode fallback window. Krstic acknowledges the inherent challenges of biometric authentication:

> “for uh Biometrics in general I think uh these uh vulnerabilities are to some degree inherent and we do the the very best we can with both our sensor and how it's used”

He reminds the audience that all Touch ID template matching occurs strictly inside the Secure Enclave and never touches the Application Processor (AP), adding that Apple actively monitors public biometric research to iteratively strengthen hardware and algorithmic defenses.

[49:00](https://www.youtube.com/watch?v=BLGFriOKz6U&t=2940s) Research Inquiries and Closing Remarks

The remaining questions touch on various security domains, though Krstic keeps the scope tightly bounded: - **iOS 10 Watchtower:** When asked to elaborate on the internal architecture of iOS 10’s Watchtower feature, Krstic politely declines, stating he wants to remain focused on the topics presented during the talk. - **Hardware Side Channels:** In response to an inquiry about side-channel defenses against electromagnetic (EM), power analysis, or acoustic monitoring attacks, Krstic notes he is unsure how much is detailed in the current iOS Security Guide, but encourages the researcher to email the security team so they can evaluate expanding that documentation. - **Top Threat Vector:** An attendee humorously asks what single security issue Krstic finds most persistent in iOS. Krstic jokingly reacts to the difficulty of the question by playing to the crowd with a deadpan “tough audience questions thank you”, drawing laughter and applause before quieting them with a smile: “no really don't thank you”. - **Vulnerability Response Times:** A researcher representing a security team from China raises a concern that reports submitted to Apple Product Security have faced long turnaround times, sometimes stretching toward a year. Krstic responds that while Apple receives an extraordinary volume of inbound reports, the vast majority receive very prompt responses: “if you have issues that for some reason you're having trouble with please send another email you should not be encountering that kind of issue”.

Krstic concludes the presentation by thanking the audience for attending and expressing his hope that they enjoyed the deep technical dive into iOS security internals.

## Notable quotes > [21:34](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1294s) if a production device is demoted, the UID key that was used in deriving the master key that protects any user data previously on that device is simply unavailable to any software—a different UID key turns up. — Ivan Krstic

## Mentioned Apple, AppleKeyStore, Apple Pay, Apple Security Bounty, Apple Watch, Application Processor (AP), ARM, ARMv8, Auto Unlock, Cloud Key Vault, Crypto Blender, Custom Security Code (CSC), Federal Bureau of Investigation (FBI), FIPS 140-2, Hardware Security Module (HSM), HomeKit, iCloud Keychain, iCloud Security Code (iSC), iOS 9, iOS 10, iOS Security Guide, iPhone, iPhone 5s, Ivan Krstić, keybagd, macOS Sierra, Office of Personnel Management (OPM), s_bio, Safari, Secure Boot, Secure Element, Secure Enclave Processor (SEP), Secure Key Store (SKS), Secure Remote Password (SRP), SpringBoard, Touch ID, Watchtower, WebKit

## Video description by Ivan Krstic

With over a billion active devices and in-depth security protections spanning every layer from silicon to software, Apple works to advance the state of the art in mobile security with every release of iOS. We will discuss three iOS security mechanisms in unprecedented technical detail, offering the first public discussion of one of them new to iOS 10.

HomeKit, Auto Unlock and iCloud Keychain are three Apple technologies that handle exceptionally sensitive user data – controlling devices (including locks) in the user's home, the ability to unlock a user's Mac from an Apple Watch, and the user's passwords and credit card information, respectively. We will discuss the cryptographic design and implementation of our novel secure synchronization fabric which moves confidential data between devices without exposing it to Apple, while affording the user the ability to recover data in case of device loss.

Data Protection is the cryptographic system protecting user data on all iOS devices. We will discuss the Secure Enclave Processor present in iPhone 5S and later devices and explain how it enabled a new approach to Data Protection key derivation and brute force rate limiting within a small TCB, making no intermediate or derived keys available to the normal Application Processor.

Traditional browser-based vulnerabilities are becoming harder to exploit due to increasingly sophisticated mitigation techniques. We will discuss a unique JIT hardening mechanism in iOS 10 that makes the iOS Safari JIT a more difficult target.

[Source](https://www.youtube.com/watch?v=BLGFriOKz6U)

中文简报

苹果推出20万美元漏洞赏金计划,详解iOS 10安全隔区防御机制 硬件级密钥隔离以及对云端签名智能卡的物理销毁,确保主机操作系统及苹果自身在技术上均无法访问用户机密。 Ivan Krstić详细介绍了保护现代iOS设备以及跨设备机密同步的底层密码工程。他解释了iOS 10如何利用仅执行内存(XOM)消除可写且可执行的JIT内存映射;安全隔区处理器(SEP)如何将主密钥衍生和防暴力破解的速率限制与不可信的应用处理器隔离开来;以及Cloud Key Vault HSM集群如何在苹果不持有解密密钥的情况下,利用法定人数共识保护托管凭据。Krstić还描述了对HSM固件签名智能卡进行物理销毁的仪式,并最终正式宣布推出苹果安全赏金计划。 iOS 10针对WebKit JIT页面实现了仅执行内存(XOM)和双虚拟映射,从而防止具备任意写入原语的攻击者直接读回或执行注入的shellcode。 (1:04) 安全隔区处理器(SEP)利用与硬件绑定的UID密钥隔离数据保护密钥的衍生过程,完全在应用处理器无法触及的范围之外强制执行速率限制和10次尝试的绝对锁定计数器。 (6:57) iCloud钥匙串备份通过分布式法定人数协议跨HSM俱乐部保护托管记录,并通过在搅拌机中物理销毁管理签名智能卡来终止固件更新。 (32:28) 苹果推出了首个官方安全赏金计划,针对安全启动固件漏洞的最高奖金达20万美元,安全隔区提取漏洞最高达10万美元,并提供1:1的慈善捐赠配捐。 (36:00)

Reading summary

At Black Hat, Apple's head of security engineering Ivan Krstić outlined how iOS mitigates software and hardware compromises across browser execution, on-device encryption, and cloud secret synchronization. Krstić argued that effective defense requires hardware-enforced boundaries that limit trust even against compromised application processors or subpoenaed server backends. Hardening WebKit JIT via Execute-Only Memory (1:04) To eliminate high-severity browser exploitation vectors in iOS 10, Apple restructured Safari's Just-In-Time (JIT) memory management. In iOS 9, JIT compilation relied on a single 32-megabyte memory region marked as readable, writable, and executable (RWX), allowing adversaries with a memory-write primitive to inject shellcode directly into native execution pathways. Dual Virtual Mappings and Hidden Destination Copies (2:36) Using hardware execute-only memory (XOM) introduced in ARMv8, the iOS 10 kernel splits physical JIT storage into two distinct virtual mappings: one strictly executable (RX) and the other writable (RW) at a randomized virtual address. WebKit writes newly compiled code via a specialized `memcpy` routine placed on an execute-only page, with the target address embedded as immediate assembly values. The destination address is wiped elsewhere from memory, ensuring an arbitrary write primitive alone cannot achieve arbitrary native code execution without control-flow hijacking. On-Device Cryptography and the Secure Enclave (6:57) Apple’s Data Protection architecture treats the Application Processor (AP) running iOS as untrusted and potentially adversarial. Long-term secrets derive from a non-exportable hardware Unique ID (UID) generated at the factory inside the Secure Enclave Processor (SEP) by a true random number generator. The SEP strictly enforces a rate-limiting policy of 10 failed passcode attempts before permanently disabling further key derivations against the UID. Ephemeral Storage Keys and Class Protections (12:12) Files are individually protected with 128-bit AES-XTS keys generated in the SEP and categorized into access classes, including Class B which uses asymmetric Curve25519 pairs so background services can write files without active unlock privileges. When a file is accessed, the SEP unwraps the key and rewraps it under an ephemeral session key shared solely with the NAND storage controller over an isolated channel. Even full kernel compromise exposes only ephemeral keys that are useless across device reboots. Cloud Key Vault HSMs and Irrevocable Code Locks (27:20) To back up iCloud Keychain secrets without exposing raw credentials to cloud infrastructure, Apple uses Hardware Security Modules (HSMs) organized in clubs of five that require a majority quorum consensus for every recovery attempt. Passcodes authenticate using Secure Remote Password (SRP) verification against hardware-enforced monotonic counters to prevent offline brute-force attacks. Physical Destruction of Root Signing Cards (32:28) To provide absolute assurance that Apple cannot covertly deploy modified HSM firmware to bypass rate limits, the administrative smart cards required to sign custom security code are subjected to a verification ceremony and physically destroyed in an industrial blender. Krstić explained that because administrative code-signing keys are obliterated, zero-day vulnerabilities cannot be patched in place; instead, Apple must stand up an entirely new HSM fleet and migrate new user enrollments onto it. Apple coupled these architectural disclosures with the announcement of the Apple Security Bounty, offering up to $200,000 for secure boot exploits and $100,000 for SEP compromises, reflecting the escalating technical difficulty of compromising modern iOS defenses. During audience questioning, Krstić reiterated technical boundaries, acknowledging inherent vulnerabilities in biometric matching while clarifying that existing iCloud escrow records cannot be administratively transferred to new or compromised server fleets.

精炼阅读摘要

Apple安全工程与架构负责人Ivan Krstić在Black Hat大会上阐述了iOS核心安全体系,说明平台如何通过内核级执行保护、硬件隔离的本地数据保护机制以及基于硬件安全模块的云端密钥库,在假定应用处理器甚至云端后端受损的威胁模型下保障用户资产与机密数据。 WebKit JIT双重映射与仅执行内存 (1:04) 在iOS 9及更早版本中,Safari为支持JavaScript的JIT即时编译,分配了一块32 MB且兼具可读、可写、可执行(RWX)权限的内存区域。这种设计带来显著风险:攻击者若通过浏览器漏洞获得任意内存写入能力,便可直接将shellcode注入该区域并执行。为此,iOS 10利用ARMv8架构的硬件特性,在内核中实现了仅执行内存(XOM),即进程可以执行指令但完全无法读取这些页面的自身字节。 在iOS 10中,物理32 MB的JIT缓冲区被解耦为两个虚拟映射:一个严格为可读且可执行(RX),另一个则为可读且可写(RW)并放置在随机隐藏地址。系统生成专用的memcpy例程,将该随机可写地址以立即数形式硬编码在汇编代码中,并将该例程所在页面标记为仅执行,同时从整个地址空间清除该写入地址。现场演示显示,直接读取XOM页面会触发bad access异常而崩溃。Krstić指出,该机制使得攻击者仅凭任意写原语已无法直接完成任意代码执行,被迫转向ROP等更复杂的控制流劫持手段。 安全隔区与基于硬件的数据保护 (6:57) iOS数据保护(Data Protection)的设计前提是将运行操作系统的主应用处理器(AP)视为潜在不受信乃至恶意环境。自iPhone 5s起,Apple引入了独立的硬件协同处理器安全隔区(SEP)。SEP拥有专用的加密内存、独立的可信计算基(TCB)及硬件加密引擎,与AP仅通过严格的邮箱接口通信。在出厂通电初期,SEP内置的真随机数发生器(TRNG)会生成唯一的硬件UID密钥,该私钥完全固化在硬件中,无法被任何可变固件导出或修改。 设备上的文件加密采用AES-XTS-128,每个文件均拥有独立的随机密钥,这些密钥由SEP管理的用户密钥包包裹,分为A至D类保护等级。例如Class A密钥仅在设备解锁使用时解密,Class B采用Curve25519非对称密钥对以允许锁屏时写入数据,Class C在首次解锁后维持可用。在启动流程中,系统利用不可磨损均衡的易抹除存储(Effaceable Storage)引导基础密钥。为防范离线暴力破解,SEP在硬件层严格限制密码尝试次数,连续10次错误将永久阻断UID派生请求,且每次派生强制施加100至150毫秒的硬件计算延迟。 生命周期密钥管理与生产设备降级隔离 (12:12) 为兼顾用户体验与安全性,iOS在密钥流转上实施了严格的会话隔离。内核在请求文件解密时,SEP使用密钥包密钥解包文件密钥后,绝不向内核暴露明文,而是使用引导时由SEP生成并通过独立硬件通道推送到存储控制器的临时AES密钥进行重包裹;一旦设备重启,暴露给内核的会话密钥即刻失效。针对夜间自动系统更新(Update Later),系统利用主动预测引擎预估用户入睡前的最后一次解锁,由SEP签发具有8小时硬件强制过期限制的一次性解锁令牌(OTUT),使设备能在凌晨3点重启应用更新后完成必要的数据迁移。 针对量产设备的硬件调试需求,Apple设计了“降级”(demotion)机制。该功能允许特定授权设备在AP上启用JTAG等底层调试接口并加载开发镜像,但必须经过Apple个性化服务器授权并强制全盘抹除重装。更关键的是,硬件在降级触发时会自动向SEP切换并暴露完全不同的硬件UID,使得原有用户数据保护主密钥在物理与逻辑层均无法被任何软件或调试手段追溯重建。 Cloud Key Vault与仲裁容灾体系 (24:57) 当用户跨设备同步机密时,iCloud Keychain在端到端设备圈内通过点对点批准进行同步,Apple云端仅充当不可视的加密中继。而在全设备丢失的灾难恢复场景中,Apple引入了Cloud Key Vault体系,使用用户设备密码派生的iCloud安全代码(iSC)包装托管密钥,并配合SRP协议在专用硬件安全模块(HSM)内进行安全验证。由于数字密码熵值较低,为杜绝云端爆破,解包操作必须完全在受信任的HSM内部执行,并由单调递增计数器强行限制尝试次数。 为兼顾硬件高可用与防止针对单机的网络分区隔离攻击,Apple将HSM编组为5台一组的“俱乐部”(Club),共享统一服务密钥。当发生验证失败更新计数器时,发起方HSM必须通过分布式共识协议向组内节点发起查询与投票,只有获得严格多数派法定人数(Quorum)同意且无一节点标记终止时,计数器才能集体递增并提交。这一设计从架构上消除了攻击者逐台切断网络以累积破解尝试额度的隐患。 物理销毁仪式与云端信任边界保障 (32:28) Cloud Key Vault集群运行的自定义固件由专属自定义安全代码(CSC)签名密钥管控。在集群初始化时,Apple执行了严格的供应仪式:解锁该签名密钥所需的3张物理智能卡被封入防篡改证据袋,分发至3个独立部门并锁入各自保险箱。在正式上线投产前,各方代表复核防篡改封条与批次记录,并在确认不存在副本后,使用被戏称为“Crypto Blender”的商用搅拌机将3张管理卡进行不可逆的物理粉碎。 Krstić强调,之所以采取如此极端的物理销毁流程,是因为当数据离开本地设备进入云端时,用户信任需要绝对的技术终局性证明。一旦保留签名管理卡,Apple便无法在受到内部或外部胁迫时绝对保证无法接触同步数据。由于签名密钥已被物理终结,生产中的HSM无法在原机热修复漏洞;若发现严重缺陷,Apple的应对策略是利用新密钥部署全新集群,并通过iOS系统更新分发新集群的根CA证书,逐步迁移新用户,而既有托管记录则永远受限于原集群的物理边界。 Krstić借由宣布设立Apple安全赏金计划(最高单项达20万美元)强调现代防御体系已大幅抬高攻破门槛。然而在问答环节中,面对关于Apple Watch脱腕锁定的物理信任依赖、针对生物识别物理伪造的固有挑战、以及老旧Cloud Key Vault集群中存量数据不可迁移等现实约束,系统展现出高安全等级与运维复杂度、物理攻击面之间的持续技术权衡。

Detailed notes — zh

## Background 该内容由 Black Hat 官方频道于 2016 年 8 月 16 日在 YouTube 平台发布,主讲人为 Apple 安全工程与架构负责人 Ivan Krstic。视频简介指出,演讲围绕 iOS 系统的底层安全纵深防御展开,以前所未有的工程细节公开了 iOS 10 的 WebKit JIT 硬化机制、基于安全隔区(SEP)的数据保护(Data Protection)密码学设计,以及支撑 HomeKit、Auto Unlock 和 iCloud 钥匙串的端到端跨设备安全同步架构。 ## TL;DR Ivan Krstic 在演讲中首先阐明了 iOS 10 测试版未加密内核缓存的工程考量,并详细拆解了利用 ARMv8 纯执行内存(XOM)防御 WebKit JIT 内存破坏漏洞的双重映射技术。随后,他深入剖析了由 Secure Enclave 硬件 UID、临时包装密钥与单调硬件计数器构建的文件级数据保护机制,展示了即便在应用处理器(AP)沦陷时如何将暴力破解限制在 10 次以内。接着,他介绍了由 5 节点 HSM 俱乐部与多数派共识协议支撑的云端密钥保险库(Cloud Key Vault),并披露了物理粉碎代码签名智能卡的极端安全仪式。最后,Apple 宣布正式推出最高奖金达 20 万美元的漏洞赏金计划(Apple Security Bounty),并在现场问答中直面了关于地缘政治、生物识别缺陷与固件升级等尖锐议题。 ## Atmosphere & style 整场演讲呈现出顶尖工程技术大会特有的严谨、克制与极高信息密度,Ivan Krstic 的讲解沉稳干练,将复杂的密码学流水线与芯片级硬件设计拆解得丝丝入扣。现场气氛既有探讨硬核内存防护和分布式仲裁时的全神贯注,也有当主讲人展示用‘物理单向散列函数’(搅拌机)粉碎管理员智能卡时的会心大笑与喝彩。问答环节则暗流涌动,面对关于 FBI 圣贝纳迪诺博弈等敏感争议,主讲人展现出技术人员守住纯工程边界的坚定与机智,整体观感既像是一场透明公开底层防御的硬核技术白皮书宣讲,又处处散发着顶尖安全攻防对决的戏剧张力。 ## Bulletin - [01:04](https://www.youtube.com/watch?v=BLGFriOKz6U&t=64s) iOS 10 引入了基于 ARMv8 纯执行内存(XOM)的 WebKit JIT 双重硬化映射机制,彻底终结了凭借单一任意写原语即可执行 Shellcode 的攻击路径。 - [06:57](https://www.youtube.com/watch?v=BLGFriOKz6U&t=417s) 安全隔区(SEP)构建了独立于应用处理器(AP)的极小可信计算基,通过硬件 UID 绑定与不可变的单调计数器强制执行 10 次密码错误熔断限制。 - [29:58](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1798s) 云端密钥保险库(Cloud Key Vault)采用由 5 台 HSM 构成的“俱乐部”架构与分布式仲裁提交协议,配合物理粉碎管理员智能卡的操作,杜绝了后端对用户凭据的暴力破解与私钥滥用。 - [35:59](https://www.youtube.com/watch?v=BLGFriOKz6U&t=2159s) 苹果正式推出安全漏洞赏金计划(Apple Security Bounty),单项漏洞最高奖励达 20 万美元,并将对向合格慈善机构捐赠赏金的研究人员提供 1:1 等额配捐。 ## Key takeaways - [00:00](https://www.youtube.com/watch?v=BLGFriOKz6U&t=0s) iOS 10 测试版公开发布未加密的 Kernelcache 与引导组件是经过评估后的工程优化,对平台与用户数据加密安全无负面影响。 - [01:04](https://www.youtube.com/watch?v=BLGFriOKz6U&t=64s) iOS 10 WebKit JIT 借助 ARMv8 纯执行内存(XOM)将可读写映射的物理地址硬编码为隐藏立即数,强制攻击者必须依赖 ROP 等更复杂的控制流劫持链条。 - [06:57](https://www.youtube.com/watch?v=BLGFriOKz6U&t=417s) 数据保护(Data Protection)的威胁模型假设应用处理器(AP)已被完全攻破,因此长期主密钥绝不经过 AP,仅向其暴露设备重启即失效的临时会话密钥。 - [08:58](https://www.youtube.com/watch?v=BLGFriOKz6U&t=538s) SEP 的硬件 UID 密钥在工厂首次上电时由 TRNG 独立生成且物理不可导出,仅能通过出厂固化且不可变的 Secure ROM 调用执行密码学运算。 - [10:47](https://www.youtube.com/watch?v=BLGFriOKz6U&t=647s) 用户 Keybag 派生主密钥将数字密码与硬件 UID 混合计算,KDF 迭代次数严格校准在 100 至 150 毫秒之间以延缓离线破解。 - [12:12](https://www.youtube.com/watch?v=BLGFriOKz6U&t=732s) 文件级加密采用 AES-XTS 模式配合单文件独立随机密钥,运行时由 SEP 解包并以安全通道直接烧入 NAND 控制器的开机临时密钥二次包装。 - [14:03](https://www.youtube.com/watch?v=BLGFriOKz6U&t=843s) NAND 中的易失存储(Effaceable Storage)被严格禁止进行磨损均衡与区块重定位,确保抹掉数据时具备硬件级的物理不可恢复性。 - [16:25](https://www.youtube.com/watch?v=BLGFriOKz6U&t=985s) 设备锁定后 SEP 立即从内存抹除 Class A 密钥与 Class B 私钥,Touch ID 仅通过受保护的随机 Secret 经由独立匹配应用恢复主密钥。 - [19:00](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1140s) 夜间自动更新机制借助一次性解锁令牌(OTAT)与用户行为预测,在维持 8 小时倒计时窗口的前提下实现无人值守重启与数据迁移。 - [21:34](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1294s) 生产设备降级(Demotion)用于底层调试,但芯片硬件会在降级时向 SEP 呈现完全不同的 UID 密钥,物理阻断对历史用户数据的解密。 - [24:57](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1497s) iCloud 钥匙串采用基于多端公私钥对的同步环,云端仅充当盲中继管道,在任何形态下均不持有用户明文数据。 - [29:58](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1798s) Cloud Key Vault 集群将 5 台 HSM 编为一组共享服务密钥,利用多数派仲裁提交协议防止攻击者通过网络分区放大密码尝试次数。 - [32:28](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1948s) 苹果在仪式中将 3 张能够解锁固件签名密钥的管理员智能卡通过搅拌机物理粉碎,确保没有任何机制可向生产集群注入自定固件以导出密钥。 - [43:11](https://www.youtube.com/watch?v=BLGFriOKz6U&t=2591s) 当云端 HSM 集群发现严重漏洞时,苹果不会对旧集群进行固件热更新,而是直接部署新集群并通过 iOS 系统更新下发新信任根证书实现流量迁移。 - [45:05](https://www.youtube.com/watch?v=BLGFriOKz6U&t=2705s) Apple Watch 依赖离腕传感器在离开手腕瞬间立刻锁定,防止设备遗失后被攻击者利用蓝牙信任链发起未授权跨设备解锁。 - [47:19](https://www.youtube.com/watch?v=BLGFriOKz6U&t=2839s) 10 次密码错误熔断限制完全由 SEP 内部的安全单调递增计数器强制执行,达到上限后硬件状态机拒绝调用硬件 UID,杜绝暴力破解可能。 ## Detailed walkthrough ### [00:00](https://www.youtube.com/watch?v=BLGFriOKz6U&t=0s) 开场:解密内核缓存(Kernelcache)的技术澄清 Apple 安全工程与架构负责人 Ivan Krstic 登台向与会者问好,并表示非常高兴能深入介绍三项 iOS 安全机制,其中一项更是 iOS 10 的全新特性。在正式切入正题前,针对社区和开发者群体中近期最热门的疑问,他首先主动回应了关于 iOS 10 测试版中解密内核缓存(Kernelcache)的问题。台下随即传来会心的笑声。 在 iOS 10 的早期测试版中,Apple 直接发布了未加密的内核缓存;随后的测试版中,针对 iPhone 5s 之前的机型,甚至连 iBoot 和开机启动图标(Boot Logos)也以未加密形式分发。Ivan 明确证实这是官方有意为之,并非疏忽泄露。他解释道,Apple 会定期重新评估各项安全防护机制的实际有效性;在推进其他底层系统优化的过程中,安全团队经过评估意识到,移除对这些系统镜像的加密,对设备平台的安全性根本没有任何负面影响。这种做法纯粹是一项工程优化,既不降低攻击门槛,也绝不会削弱对用户个人数据的端到端加密保护。 - **内核解密覆盖范围**:iOS 10 内核缓存(Kernelcache),以及针对 pre-iPhone 5s 设备的 iBoot 引导加载程序与 Boot Logos。 - **改动性质**:定期安全机制效能复审与工程优化,对平台与用户数据加密体系无安全影响。 --- ### [01:04](https://www.youtube.com/watch?v=BLGFriOKz6U&t=64s) 硬化 WebKit JIT 映射机制(Hardened WebKit JIT Mapping) Ivan 随后切入本次分享的首个核心技术主题:iOS 10 引入的 WebKit JIT 硬化映射机制。在架构背景上,iOS 上的 Safari 为保证 JavaScript 的极限执行性能,必须依赖 JIT(即时编译)技术;但与此同时,iOS 平台在安全设计上严格推行“代码签名”策略,即每一个可执行内存页都必须附带合法签名。JIT 必须动态生成并执行全新的原生代码,这与代码签名策略产生了直接冲突。为了让 Safari 能够运行 JIT,iOS 历史架构中不得不放宽代码签名限制,允许 JIT 引擎生成并执行未经签名的机器码。 在 iOS 9 及更早的实现中,系统为 JIT 分配了一块 32MB 的独立内存区域,该区域的权限被配置为同时可读、可写、可执行(RWX)。这种权限模型构成了显著的安全短板:攻击者只要能从 JavaScript 上下文中利用内存漏洞构造出“任意写”(Write-anywhere)原语,就能直接将恶意 Shellcode 写入这块 32MB 的 JIT 区域,然后劫持控制流直接跳转执行,从而实现进程内的任意代码执行。 针对这一攻击面,Apple 借助硬件层面的演进进行了底层重构。以往在 ARM 处理器上,内存页表权限中的读(Read)权限往往是隐式的(即只要具备执行权限通常就天然可读)。但从 ARMv8 架构开始,硬件正式引入了对“纯执行内存”(Execute-Only Memory, XOM)的原生支持。iOS 10 内核在此基础上构建了软件层面的配套支持,从而实现了一种极其独特的安全机制:系统可以将机密数据直接硬编码到某一块内存页中,该页面允许进程去“执行”,但进程自身无论如何尝试都无法“读取”其中的内容。 Ivan 对该机制的实现逻辑做出了精辟概括: > “So what this lets us do is pretty interesting: we can now emit secret data into a page that the process can execute, but the process itself cannot read.” > (所以这让我们能做一件非常有意思的事:我们现在可以把机密数据写入一个页面,该页面进程可以执行,但进程自身却根本无法读取。) ```mermaid flowchart TD accTitle: WebKit JIT Hardening Architecture accDescr: iOS 10 WebKit JIT dual-mapping architecture using Execute-Only Memory for safe code emission. subgraph UserProcess["Web 内容进程 (Web Content Process)"] JIT["JIT 引擎"] Buffer["待写入代码 Buffer"] end subgraph XOMPage["纯执行内存 (Execute-Only Page)"] Memcpy["特化 memcpy 函数<br/>(硬编码秘密写入地址立即数)"] end subgraph PhysicalMem["物理 JIT 内存 (Physical Memory)"] PhysMem["同一块 32MB 物理内存空间"] end subgraph VirtMappings["虚拟内存双重映射 (Virtual Mappings)"] ExecMap["可执行映射 (RX)<br/>正常地址 / 进程可跳转"] WriteMap["秘密可写映射 (RW)<br/>随机秘密地址 / 进程不可读写"] end JIT -->|"调用并传入"| Buffer Buffer -->|"输入给"| Memcpy Memcpy -->|"利用内部隐藏立即数写入"| WriteMap WriteMap -.->|"映射至同一物理页"| PhysMem PhysMem -.->|"内容同步反映至"| ExecMap JIT -->|"直接跳转执行"| ExecMap classDef xom fill:#ffebee,stroke:#c62828,stroke-width:2px; class Memcpy,XOMPage xom; ``` iOS 10 充分利用这一硬件特性重构了 JIT 映射机制。对于同一块 32MB 的物理 JIT 内存,系统在虚拟内存中创建了两个完全不同的映射: 1. **可执行映射**:常规可见,权限仅为只读/可执行(RX)。 2. **秘密可写映射**:放置于一个随机构建的秘密地址空间,权限仅为可写(RW)。 系统随后动态生成一个高度特化的 `memcpy` 复制函数,将该秘密可写区域的虚拟地址直接作为机器指令的“立即数”(Immediate Values)硬编码在 `memcpy` 代码段内。生成完成后,内核将承载该 `memcpy` 的页面标记为“纯执行”(Execute-Only),并将进程内存中其他所有记录了秘密可写地址的变量与指针全部清零擦除。JIT 引擎在需要写入新编译代码时,只能将包含原生代码的 Buffer 作为参数传入这个特化的 `memcpy`。`memcpy` 利用内部隐藏的立即数地址把数据写入秘密可写映射;由于双重映射共享底层物理内存,写入的数据会立即出现在可执行映射中供 CPU 跳转执行。而除了处于纯执行页内的 `memcpy` 指令自身,整个进程完全不知道可写映射的基地址在何处。 - **iOS 9 传统实现**:单一 32MB 虚拟内存映射,权限标记为 RWX(同时具备可读、可写、可执行权限)。 - **iOS 10 硬化实现**:分离映射机制,包含 1 个 RX 映射、1 个随机秘密地址的 RW 映射、以及 1 个 XOM(纯执行)`memcpy` 辅助映射。 - **内核安全保障**:一旦设置完毕,除了嵌入在纯执行指令中的立即数外,进程其他上下文中该秘密地址被彻底归零(Zero out)。 --- ### [04:22](https://www.youtube.com/watch?v=BLGFriOKz6U&t=262s) 现场调试演示与防御成效 为了让观众清晰看到内存布局的真实变化,Ivan 在现场连接了两部真机进行动态调试对比。第一部手机运行 iOS 9.3,通过查看其 Web Content 进程(包含 Safari JIT)的虚拟内存映射表,屏幕上清晰显示出两个保护页(Guard Pages)之间夹着一块完整的 32MB 内存,权限直接标记为 `rwx`。 随后 Ivan 切换到运行 iOS 10 的 iPhone。内存映射表中同样存在保护页,但原本单一的 `rwx` 区域已经分裂:屏幕上出现了一个单独的可执行映射、一个处于不同地址的可写映射,以及一个独特的 Execute-Only(纯执行)映射。 Ivan 现场将调试器(Debugger)挂载到 iOS 10 的 Web Content 进程中,读取纯执行区域的汇编指令。反汇编结果显示,ARM 汇编代码中直接以立即数形式拼装出目标地址(从下往上反向读取为 `0x1708ac0000`),该数值精准对应上方内存映射表里可写区域的真实基地址;指令的其余部分则是标准的内存拷贝逻辑。为了验证访问控制的效果,Ivan 现场演示了两种内存读取操作: 1. **读取可读/可执行映射**:通过进程上下文尝试读取其内容,命令成功执行并返回错误码 `0`。 2. **读取纯执行映射**:尝试直接从包含 `memcpy` 及地址机密的纯执行内存页读取数据,系统立即拦截并抛出错误——直接触发 `EXC_BAD_ACCESS` 异常。 关于该机制带来的防御成效,Ivan 总结指出: > “So where this gets us is that an attacker who simply has a write-anywhere primitive from the context of JavaScript can no longer use it by itself for arbitrary code execution in the process. Instead, they have to subvert control flow usually through ROP or a similar mechanism. It's kind of a nice mitigation that raises the cost of exploiting memory corruption bugs in particular in WebKit.” > (因此这一机制带来的改变是:攻击者若仅仅在 JavaScript 上下文中掌握了任意写原语,再也无法单凭它在进程内实现任意代码执行。相反,他们必须转而通过 ROP 或类似机制来劫持控制流。这是一种非常漂亮的缓解措施,显著提高了利用内存破坏漏洞——特别是 WebKit 中漏洞——的攻击成本。) - **异常拦截表现**:用户态或攻击代码一旦尝试对纯执行页执行 `read` 读取操作,内核与硬件 MMU 立即触发 `bad access` 异常中断。 - **攻击门槛变化**:彻底终结了“任意写即得代码执行”的简易利用路径,强制要求攻击者必须串联 ROP(返回导向编程)或控制流劫持链条。 --- ### [06:57](https://www.youtube.com/watch?v=BLGFriOKz6U&t=417s) 数据保护(Data Protection)与安全隔区处理器(SEP)架构 随后,Ivan 将议题转向 iOS 的核心存储安全基石——数据保护(Data Protection),以及其如何深度整合硬件级安全隔区处理器(Secure Enclave Processor, SEP)。Data Protection 是负责保护 iOS 设备上所有静态存储数据(Data at rest)的加密系统。在设计之初,安全团队确立了明确的设计目标: 1. **强密码学保护**:使用高强度的加密密钥全面护航用户数据。 2. **抵御离线攻击**:保护数据的根密钥必须与硬件物理绑定,杜绝攻击者将闪存颗粒拆下放入超级计算机进行离线暴力破解的可能。 3. **彻底防范在线爆破**:设置极其严格且无法绕过的密码错误重试上限(Hard limit)。 4. **扩展安全解锁体系**:作为 Touch ID 生物识别认证,以及 macOS Sierra 中通过 Apple Watch 实现 Mac 自动解锁(Auto Unlock)等安全认证技术的基础支撑底座。 除上述目标外,该架构还有一个至关重要的核心目标:“彻底规避应用处理器(AP)的攻击面”(Entirely sidestep the attack surface for the AP)。AP 作为运行整个操作系统和常规第三方代码的主处理器,其代码库庞大、攻击面宽广。在安全团队的威胁模型中,必须假设 AP 本身完全处于被敌对势力掌控(Adversarial AP)的极端情况。这意味着即便 AP 的内核被完全攻破,系统原定的认证策略(如错误密码尝试硬上限)也必须继续强制生效;AP 绝对不能接触到任何长期主密钥材料,其所能短暂接触的临时密钥也必须与当前会话短暂绑定,一旦设备重启便立刻失效。 为实现这一目标,Apple 从硬件层引入了专用的安全隔区处理器(Secure Enclave Processor, SEP)。SEP 是一块独立的芯片物理单元,拥有极小且可信的可信计算基(TCB),充当整机硬件级加密协处理器。SEP 配备专用的硬件加速加密引擎,是设备上所有用户数据访问决策的最终仲裁者(Arbiter)。它拥有独立于 AP 的专用加密内存体系,并通过一条极窄的硬件总线接口与 AP 通信。在工厂制造阶段,Apple 会在物理产线上为 SEP 与 Touch ID 传感器芯片、安全元件(Secure Element,用于承载 Apple Pay 交易)之间执行严格的密钥配对,建立互相认证的端到端硬件加密通信信道。 ```mermaid flowchart LR accTitle: Secure Enclave Processor Architecture accDescr: Architectural boundary between Application Processor and Secure Enclave Processor. subgraph AdversarialAP["常规应用处理器 (AP) - 假定处于敌对状态"] AP_OS["iOS 操作系统 / 应用"] AP_Key["仅短暂持有临时会话密钥<br/>(重启立即失效,严禁触碰长期密钥)"] end subgraph HardwareSensors["工厂硬件密钥配对"] TouchID["Touch ID 指纹传感器"] SE["Secure Element<br/>(Apple Pay 交易安全芯片)"] end subgraph SEP_Boundary["安全隔区处理器 (SEP) - 独立可信硬件"] SEP_Core["SEP 核心微控制单元<br/>(最小可信计算基 TCB)"] TRNG["硬件真随机数发生器 (TRNG)<br/>自由振荡器 (Free-running oscillators)"] SEP_Crypto["专用硬件加密引擎<br/>(内置固化 Secure ROM)"] SEP_Mem["SEP 独立加密内存"] UID["UID 私钥<br/>(硬件级唯一、永不出芯片)"] end TouchID <==|"配对硬件安全信道"|==> SEP_Core SE <==|"配对硬件安全信道"|==> SEP_Core TRNG -->|"工厂初次上电生成"| UID UID --- SEP_Crypto SEP_Core --- SEP_Mem AP_OS <==|"极窄通信接口<br/>(强制执行 10 次密码错误上限)"|==> SEP_Core ``` - **SEP 物理与逻辑边界**:独立微处理器架构、专用独立加密内存、极窄硬件交互接口。 - **工厂配对信道**:出厂硬件配对确保 SEP 与 Touch ID 及 Secure Element 之间的通信具备防窃听与防重放能力。 - **威胁假设机制**:在 AP 全盘陷落并受黑客直接操控的极端场景下,SEP 依然独立维系重试限制与密钥隔离。 --- ### [08:58](https://www.youtube.com/watch?v=BLGFriOKz6U&t=538s) 硬件 UID、密钥层级与用户 Keybags 为了彻底阻断跨芯片的密钥提取,SEP 芯片内部集成了一个硬件真随机数发生器(TRNG),由内部自由振荡器(Free-running oscillators)提供物理熵源。在工厂生产线上,当 SEP 芯片首次上电运行时,TRNG 会立即在内部生成设备唯一的私有密钥——UID 密钥。该密钥被永久封存且物理限制在安全隔区内部,没有任何调试接口或软件指令能够将其导出(Not exportable)。 更关键的是,UID 密钥的调用路径受到绝对限制。Ivan 强调,UID 密钥唯一的使用途径,是通过出厂前烧录在硬件内部、完全不可变(Immutable)的 Secure ROM 所暴露出来的受限密码学操作。任何可变更的软件层(无论 AP 内核还是 SEP 固件)都绝无可能读取到 UID 密钥本身,所有的密码学运算均由硬件核心内部闭环执行并输出结果。 以 UID 密钥作为整机根信任基石,系统逐级推导设备上所有后续密钥层级。具体到直接用于加密用户数据的密钥时,iOS 将其统一组织并封装在用户密钥包(User Keybags)中。针对设备上的每一个用户,系统都会生成一组专属的密钥包。这些密钥包由一个派生主密钥(Master Key)进行强加密封包包裹(Wrapped),而该主密钥则是由用户的锁屏数字密码(Passcode)与芯片硬件内的 UID 密钥共同混合计算派生而成。 这种将硬件 UID 与用户密码物理绑定的机制,为防爆破策略提供了坚不可摧的底层保障: > “So this lets us make it a case that after 10 incorrect passcode attempts, the SEP will simply refuse to process any further attempts. And so long as it refuses to do so, as it's the only thing that can ask for cryptographic operations to take place on the UID key, it is not possible to make any more attempts.” > (因此这确保了当出现 10 次不正确的密码尝试后,SEP 可以干脆拒绝处理任何后续尝试。只要它拒绝处理,由于它是全系统唯一能够请求对 UID 密钥进行密码学运算的实体,攻击者就根本不可能再进行任何尝试。) 在具体的加密实践中,用户 Keybag 内部包含针对不同场景细分的多种密钥集合,它们被称为“Class 密钥”(A 类至 D 类密钥,Class Keys A through D)。这些 Class 密钥具有不同的生命周期与可用时序:部分密钥(如 Class D)在系统开机运行阶段即始终可用以维系基础通信;而保护敏感用户隐私的核心密钥(如 Class A),则必须在用户开机后至少成功输入并解锁一次设备之后,才会被 SEP 解密释放并加载生效。 - **UID 密钥特性**:工厂初次上电通过 TRNG 硬件生成;完全非导出(Non-exportable);仅能由出厂不可变的 Secure ROM 指令调用。 - **Keybag 包装机制**:由用户 Passcode 与硬件 UID 联合派生的主密钥统一 Wrap 加密;未解锁前长期保持密文状态。 - **错误密码熔断机制**:10 次错误尝试后 SEP 物理级拒绝后续调用,使针对用户锁屏密码的纯软件字典攻击完全失效。 - **Class 密钥分级**:划分 Class A 至 Class D 等级,依系统启动态、首次解锁态(After first unlock)等不同状态按需授予权限。 ### [10:47](https://www.youtube.com/watch?v=BLGFriOKz6U&t=647s) 数据保护类与密钥袋(Keybag)结构 在 iOS 数据保护(Data Protection)的设计中,不同保护类别的密钥体系存在关键差异。Ivan Krstic 指出,Class A 的安全性更强,因为这些密钥“仅在用户主动使用已解锁设备时才可用”(“only available while the user is actively using the unlocked device”)。从加密算法的实现来看,Class A、Class C 和 Class D 均采用标准的 256 位 AES 密钥,而 Class B 则独具一格地采用了 Curve25519 密钥对。这种非对称设计带来了一个核心能力:公钥始终可用,而私钥仅在设备解锁时才可被解出。 存放在每台 iOS 设备文件系统中的用户密钥袋(Keybag)记录了密钥体系的元数据。它明确定义了数据保护的版本、用于密钥派生的 KDF 盐值(salt)与迭代轮数(iteration count),以及包装各类密钥(wrapped keys)所需的标识符;对于 Class B 保护类,Keybag 中直接存储了其 Curve25519 公钥的原始字节。 在主密钥(Master Key)的派生过程上,整个流程环环相扣: 1. **用户空间处理**:在用户态下,系统获取用户密码(passcode)与密钥袋盐值,输入密钥派生函数进行初阶段运算。 2. **硬件交接与迭代**:初阶段运算结果被传入硬件端,由 Secure Enclave 处理器(SEP)结合硬件烧录的 UID 密钥继续执行迭代。 3. **耗时控制目标**:密码迭代次数经过专门校准,用于达成严格的时间目标。Ivan Krstic 说明道:“派生迭代次数的选择是为了满足一个时间目标,即介于 100 到 150 毫秒之间,我们希望派生过程必须耗费一定的时间”(“the number of iterations is chosen to meet a time goal which is between 100 and 150 milliseconds, so we want it to be the case that derivation takes a certain amount of time”)。这种机制从物理和算力层面上有效延缓了针对离线密码的暴力破解尝试。 --- ### [12:12](https://www.youtube.com/watch?v=BLGFriOKz6U&t=732s) 文件级加密与临时密钥(Ephemeral Key)机制 理解了各保护类别的密钥之后,iOS 如何将其落地到实际文件系统的数据保护中?在底层,文件内容(File blobs)使用带有 128 位密钥的 AES-XTS 模式进行加密。然而其精妙之处在于粒度控制:系统中的每个文件都由 SEP 单独生成一个专属且完全随机的独立密钥(Raw file key)。 这些原始文件密钥绝不会暴露给常规的应用处理器(AP)。在长期存储状态下,原始文件密钥由用户 Keybag 中的类密钥进行包装(wrap),而这些类密钥只能由 SEP 解包。更为精巧的是系统运行时的动态保护机制:文件密钥还会与当前手机启动会话(boot session)强绑定的临时密钥(Ephemeral key)结合使用。 ```mermaid flowchart TD accTitle: 临时密钥文件解密流程 accDescr: 展示 SEP、AP 内核、存储控制器与 NAND 闪存之间交互的临时包装文件密钥解密过程。 subgraph BootStage["开机阶段"] A["SEP 内置 AES 引擎"] -->|"生成临时密钥并经安全通道发送"| B["存储控制器 (NAND Controller)"] end subgraph ReadStage["文件访问与解包阶段"] C["应用处理器内核 (Kernel)"] -->|"提取元数据中被包装的文件密钥"| D["Secure Enclave (SEP)"] D -->|"使用 Keybag 类密钥解包,并以启动临时密钥重新包装"| D D -->|"返回经临时密钥包装的文件密钥"| C C -->|"转交临时包装的文件密钥"| B B -->|"使用临时密钥解包,获取原始文件密钥"| B B -->|"读取密文并解密出明文"| E["NAND Flash 存储"] B -->|"将解密后的明文数据送回"| C end ``` 这种机制在防御内存转储攻击方面具有极高的安全性。当系统启动时,SEP 内的 AES 引擎生成一个临时密钥,并通过专用的安全出站通道直接烧入 NAND 存储控制器。当设备运行时打开某个文件,内核从文件元数据提取被类密钥包装的文件密钥并送入 SEP;SEP 用 Keybag 密钥解包后,立刻用开机临时密钥重新包装,并将结果回传给内核,内核再交由存储控制器处理。存储控制器利用启动时获得的临时密钥解出真实文件密钥,读取闪存密文并送回明文。Ivan Krstic 总结了这种设计的关键价值:“如果你审视那些暴露给内核的密钥,就会发现它们在设备重启之后没有任何长期价值;那个被临时包装的密钥在重启后完全没有任何作用”(“if you look at the keys that are exposed to the kernel, none of them have any long-term value after the device is rebooted, that ephemerally wrapped key simply serves no purpose”)。 --- ### [14:03](https://www.youtube.com/watch?v=BLGFriOKz6U&t=843s) 系统启动时序与易失存储(Effaceable Storage) 为了满足数据保护的目标,系统引导过程中必须精确协调多方组件。引导链的初始工作由内核、只读防磨损区域以及 SEP 协同完成: - **易失存储(Effaceable Storage)**:这是 NAND Flash 中一段专门保留的物理区域,系统严格禁止对其进行磨损均衡(wear leveling)和区块重定位(block relocation),这意味着写入该区域的数据可以被物理上真正安全抹除。 - **引导解密链条**: 1. 系统分区加载内核,AppleKeyStore 驱动从易失存储中读出被加密的 Class D 密钥(D key)。 2. Class D 密钥传入 SEP,SEP 调动硬件 UID 密钥对其进行解密,并送入 SKS(Secure Key Store / Secure Key Service,安全密钥服务)钥匙环。 3. 内核利用易失存储中的媒体密钥(Media key)解密文件系统元数据。 4. 系统守护进程 `launchd` 挂载用户分区并启动守护进程 `keybagd`。 5. 此时 Class D 密钥已处于可用状态,`keybagd` 从文件系统中读取系统密钥袋,配合易失存储中的“保护密钥”(Protection key)解密,并把数据推入 SEP 的 SKS,解包设备密钥袋,将 Class B 公钥加载进 SKS 钥匙环。 这种设计使得设备在“启动完毕但尚未输入密码”时处于特殊的受限状态:由于缺少用户密码,Class A、Class C 密钥以及 Class B 的私钥无法生成,系统无法读取这几类受保护文件;但系统已经可以读取所有受 Class D 保护的文件,并能凭借 Class B 公钥写入全新的加密文件(只有等用户输入密码后 Class B 私钥就位才能读取)。Ivan Krstic 将这种利用非对称密钥单向写入的特性形象地比作“一种投递箱机制”(“it's kind of a Dropbox mechanism”)。 --- ### [16:25](https://www.youtube.com/watch?v=BLGFriOKz6U&t=985s) 首次解锁、设备锁定与 Touch ID 生物识别链路 当设备引导至图形界面后,生命周期的解锁与锁定遵循高度受控的密钥流通路径: ```mermaid flowchart TD accTitle: 首次解锁与 Touch ID 认证流 accDescr: 展示用户输入密码与后续 Touch ID 认证恢复密钥的具体交互过程。 subgraph FirstUnlock["首次解锁 (First Unlock)"] A["SpringBoard 获取用户密码"] -->|"传递密码"| B["SEP 硬件结合 UID 派生 Master Key"] B -->|"解包所有类密钥"| C["SKS 钥匙环 (Keyring)"] B -->|"生成随机 Secret 盲化加密 Master Key"| D["密文保留在 SKS"] B -->|"仅将随机 Secret 传给"| E["Touch ID 匹配应用 (s_bio)"] B -.->|"SKS 内存彻底销毁原始 Master Key"| F["Raw Master Key Erased"] end subgraph LockEvent["设备锁定 (Device Lock)"] G["系统发出锁定通知"] --> H["SEP 从钥匙环完全清除 Class A 和 Class B 私钥"] H --> I["保留 Class B 公钥、Class C 密钥及 Class D 密钥"] end subgraph TouchIDUnlock["Touch ID 解锁"] J["Home 键传感器采集指纹图像"] -->|"图像送入"| E E -->|"比对成功,释放回传"| K["随机 Secret"] K -->|"提供给 SKS 解密密文"| D D -->|"重新还原 Master Key 并补全所有类密钥"| C D -.->|"SKS 再次安全销毁原始 Master Key"| L["Raw Master Key Erased"] end ``` 在首次解锁时,用户界面组件 SpringBoard 收集用户输入的密码并传递给 SEP。SEP 利用密码和硬件 UID 派生出主密钥,解包用户密钥袋中的全部保护类密钥并注入钥匙环。紧接着,SEP 会执行一个关键步骤:它生成一个随机秘密值(random secret),将主密钥加密;随后仅把这个随机秘密值传给 SEP 内部专门运行生物特征匹配的独立应用 `s_bio`,而加密后的主密钥由 SKS 本地持有。随后,SKS 立即从内存中彻底销毁原始主密钥。 当设备锁屏时,流程清晰而决绝:系统向 SEP 发出通知,SEP 立即从钥匙环中抹去 Class A 密钥与 Class B 私钥,仅保留 Class B 公钥、Class C 密钥(依据定义,只要设备自启动后解锁过一次就保持可用)以及 Class D 密钥。 当用户通过 Touch ID 解锁时: 1. 按压 Home 键唤醒传感器,传感器捕获指纹图像并传送给 SEP 内的 `s_bio` 容器。 2. `s_bio` 在硬件飞地内比对指纹特征。确认吻合后,它将先前保存的随机秘密值递还给 SKS。 3. SKS 借由此秘密值瞬间解密先前保存的主密钥密文,再次解开被卸下的各保护类密钥并重新注入钥匙环,随后立即将内存中的原始主密钥二次安全擦除。 --- ### [19:00](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1140s) 夜间自动更新与一次性解锁令牌(OTAT) 数据保护体系与 Secure Enclave 的紧密结合,还为兼顾体验与安全的系统功能提供了基石,典型代表就是“稍后安装更新”(Update Later)。当用户在白天收到系统更新通知并选择“稍后安装”时,设备会立即验证用户密码,并授权 SEP 签发一种被称为 OTAT(One-Time Unlock Token,一次性解锁令牌)的特殊凭据。 整个夜间更新机制在后台精密运行: - **主动式行为预测**:系统在设备本地利用与“主动式助手”(Proactive Assistant)相同的预测算法,分析用户行为习惯,预测用户在何时最不可能使用手机且设备处于接通电源状态(例如凌晨 3:00)。 - **捕捉最后一次解锁窗口**:当用户在入睡前最后一次解锁手机时,系统依据更新时间窗口判定这很可能是夜间闲置前的最后一次操作,正式指示 SEP 实体化生成 OTAT。 - **8 小时限时生命周期**:软件更新子系统持久化保存该 OTAT,同时启动严格的 8 小时倒计时计时器;若 8 小时内未使用,该令牌将被物理销毁。 - **无缝夜间重启与迁移**:进入更新窗口后,设备自动执行系统更新并重启。重启完成后,更新系统使用该 OTAT 临时解开对用户加密数据的访问权限,执行可能伴随新版系统发生的数据迁移。当用户早晨醒来拿起手机时,免去了“设备刚重启过、所有数据处于冷锁状态”的窘境,呈现在面前的是一台已迁移完毕、开箱即用的更新系统。 在阐述完这一机制后,Ivan Krstic 将话题切入诊断调试机制,谈及被称为“降级模式”(demotion)的生产安全模式。面对全球十亿台活跃设备的规模,工程团队必须在维持不可妥协的硬件安全防线的同时,保留对量产硬件展开底层调试的可能性。 ### [21:34](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1294s) 生产设备降级与硬件级 UID 隔离 在生产环境中,苹果设计了一种称为“降级(Demotion)”的功能。该机制允许将一台生产设备转换为开启部分调试特性的状态,比如启用 JTAG 调试接口,或者在应用处理器(Application Processor)上加载开发版本的系统软件——但 Secure Enclave 处理器(SEP)绝不包含在内。降级过程有极其严苛的前提条件:必须先获得苹果个性化服务器(Personalization Server)的官方授权,随后整台设备必须被完全擦除数据,并重新烧录全新的操作系统。 这项机制在硬件层面设置了决定性的安全屏障。当生产设备被降级时,硬件逻辑会强制向 SEP 呈现一个完全不同的 UID 密钥。这意味着,此前用于派生设备主密钥并保护用户数据的原始 UID 密钥,在物理层面上对任何软件都变得彻底不可见、不可访问。Ivan Krstic 强调,正是通过这种基于芯片硬件的设计,苹果才得以完美兑现先前为数据保护(Data Protection)设定的全部严苛目标: > “In other words, if a production device is demoted, the UID key that was used in deriving the master key that protects any user data previously on that device is simply unavailable to any software; a different UID key turns up.” - **降级授权要求**:必须经由苹果个性化服务器签名授权,且强制全盘抹掉数据并重刷系统。 - **调试权限限制**:仅开放应用处理器的 JTAG 及开发版软件加载权限,SEP 固件环境依然被严格锁定。 - **硬件级 UID 切换**:降级触发芯片硬件逻辑直接向 SEP 提供备用 UID,物理阻断对历史用户数据解密的可能性。 --- ### [22:40](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1360s) 机密同步的困境与设计目标 随着生态系统扩展,在多个设备间无缝且安全地转移敏感凭据变得至关重要。这涵盖了 Safari 中保存的网站密码和信用卡信息、用于通过 Apple Watch 免密解锁 Mac 的 Auto Unlock 密钥,以及控制智能门锁和家庭配件的 HomeKit 密钥。回顾历史上机密同步的实现方式,行业内长期只有两条走不通的极端路径:第一种是生成一个高强度的随机密钥来加密所有数据,但这要求用户把长密钥打印或抄写在纸上,虽然具备足够的密码学强度,但用户体验极其糟糕;第二种则是直接用用户的登录密码派生加密密钥,其致命缺陷在于人类非常不擅长挑选强密码,且托管账户的后端服务器处于特权地位,极易对密码进行离线暴力破解从而窃取所有机密。 为了突破这一两难困境,苹果团队从 Data Protection 的架构中汲取灵感,为现代机密同步机制设立了五大严苛的设计目标: 1. **多端可用**:所选的用户机密必须能在所有授权设备间随时可用; 2. **强密码学保护**:传输与存储必须由高强度密码学密钥全程保护; 3. **免抄写灾难恢复**:即使丢失所有设备,用户也能轻松恢复数据,而无需在抽屉里翻找纸质恢复密钥; 4. **零知识披露**:用户机密在任何阶段、任何形态下都绝不能泄露给苹果公司; 5. **绝对防暴力破解**:杜绝后端或窃贼实施密码暴力破解攻击的可能。 引用密码学经典著作的观点,Ivan Krstic 幽默地指出人类在生成随机性方面的天然缺陷:“Humans are not very good at this.”(人类确实很不擅长做这件事),这也是为什么系统设计必须在不依赖用户记忆复杂长密钥的前提下,提供工业级的密码学保障。 --- ### [24:57](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1497s) iCloud 钥匙串同步环与备份恢复机制 针对多端同步,苹果构建了 iCloud 钥匙串(iCloud Keychain)体系。每个加入同步的设备都会在本地生成一对高强度的 iCloud 钥匙串同步密钥对(Synchronization Key Pair)。当用户购入新设备需要同步机密时,必须在已信任的现有设备上显式点击批准,新设备才能加入这个被称为“同步环(Synchronization Circle)”的信任网络。在这个架构中,苹果云端仅充当消息中继和盲存储管道,由于所有凭据都在端侧由强公私钥对加密,云端后端完全处于非特权地位,没有任何途径窥探明文。 为了应对用户丢失全部设备、或者在新设备无法接触旧设备的极限场景,苹果设计了 iCloud 钥匙串备份(iCloud Keychain Backup)机制。该机制引入了一个全新的凭证——iCloud 安全码(iCloud Security Code),通常直接复用用户的设备锁屏密码(Passcode)。设备会在本地生成一个高强度的随机托管密钥(Escrow Key),并使用从 iCloud 安全码派生的密钥对托管密钥进行多层包装包裹(Wrap)。随后,被保护的托管密钥连同由其加密的钥匙串机密副本一同上传至苹果云端。只要用户掌握自己的 iCloud 账户密码以及该设备安全码,就能在任何全新设备上重建钥匙串。 ```mermaid flowchart TD accTitle: iCloud钥匙串备份与恢复流 accDescr: 展示从设备锁屏密码到托管密钥,再到云端备份存储与恢复验证的完整流程。 subgraph Client["本地设备端 (Client Device)"] A["iCloud 安全码 / 设备锁屏密码"] -->|"密钥派生"| B["派生包装密钥"] C["强随机托管密钥 (Escrow Key)"] -->|"加密"| D["钥匙串机密数据"] C -->|"由派生密钥包裹 (Wrap)"| E["被包裹的托管密钥"] end subgraph AppleCloud["苹果云端存储 (Apple Cloud Backend)"] E -->|"上传备份"| F["托管记录存储 (盲数据)"] D -->|"上传备份"| G["加密机密副本"] end subgraph Recovery["异地灾难恢复"] F -.->|"输入账户密码 + 安全码"| H["解包 Escrow Key 并恢复"] G -.-> H end ``` 前四项设计目标借此得以圆满实现,然而最后一个目标——防范暴力破解——却带来了最棘手的工程挑战。因为作为安全码的设备锁屏密码通常只有 4 到 6 位数字(仅约 100 万种可能),若直接保存在通用服务器后端,拥有特权的后端或入侵者轻而易举就能在纳秒级时间内暴力破解出托管密钥。 --- ### [26:44](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1604s) 云端密钥保险库(Cloud Key Vault)与硬件安全模块 为了在不可信或面临敌对威胁的云端环境中杜绝暴力破解,苹果将 Secure Enclave 的硬件限速理念搬到了云端数据中心,提出了由专用硬件强制执行安全策略的设想:“如果解包托管密钥的过程只能在硬件安全模块内部完成呢?”苹果在后端部署了一整套被称为“云端密钥保险库(Cloud Key Vault)”的基础设施。Cloud Key Vault 本质上是由大批高性能硬件安全模块(Hardware Security Module, HSM)组成的服务器集群。这些 HSM 充当密码协处理器,能安全生成且永不出芯的私钥,所有敏感密码学计算仅在芯片内部进行,且集群内部运行着经过苹果专门签名固化的安全代码。 该集群拥有独立的专用证书颁发机构(Certificate Authority, CA),其根私钥终生禁锢在 HSM 硬件内部;与此同时,全球每一台出厂的 iOS 设备中都内置硬编码了该 CA 的信任证书。在体系中,单台 Cloud Key Vault 节点由一台宿主机(Host)与一块 HSM 物理卡配对构成,HSM 严密守护着两项核心密钥:一是定制安全代码的签名校验密钥(确保任何未授权固件无法加载),二是服务私钥(Service Key,用于解包用户的托管记录)。 ```mermaid flowchart LR accTitle: Cloud Key Vault 单节点结构与托管解密 accDescr: 展示宿主机、HSM 安全模块、服务私钥以及 SRP 身份验证的交互流程。 subgraph Node["Cloud Key Vault 单元"] H["宿主机 (Host)"] <--> HSM["硬件安全模块 (HSM)"] subgraph InsideHSM["HSM 内部安全隔离区"] SK["服务私钥 (Service Key)"] SC["固件签名校验公钥"] Counter["安全硬件计数器"] end end Record["加密托管记录 (Escrow Record)"] --> H H --> HSM HSM -->|"SRP 协议验证安全码"| Result{"验证结果"} Result -->|"成功且未超限"| OK["释放强随机 Escrow Key"] Result -->|"失败"| Fail["计数器自增 +1 / 锁死"] ``` 用户上传的托管记录(Escrow Record)实际上包含三部分内容:强随机生成的托管密钥、iCloud 安全码的 SRP(Secure Remote Password)验证元数据,以及一个硬性限制的最大失败重试次数。这整份记录使用 Cloud Key Vault 集群的公钥进行非对称加密。在恢复机密时,设备先从云端拉取记录,与 HSM 建立端到端的 SRP 认证会话。HSM 在芯片内解密该记录,只要用户在限额内输入正确的安全码,HSM 才会释放托管密钥;若输入错误,HSM 内部的安全硬件计数器立即递增,一旦达到最大失败次数,该记录便被永久标记为作废(Terminal),硬件彻底拒绝处理针对该记录的后续任何尝试。 --- ### [29:58](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1798s) 五节点俱乐部集群与防分区多数派仲裁 在实际生产运营中,用户绝不能只依赖单一的 HSM 单元,因为任何单点硬件都有损坏故障的风险。然而,简单的多节点备份会直接摧毁防暴力破解的数学模型——如果将同一份记录分别托管给 5 个独立的 HSM 单元,原本设定的 10 次密码尝试上限就会被累加放大到 50 次。更严重的是,攻击者可能发动“成员分区攻击(Partitioning Attack)”:恶意将 5 台 HSM 逐一与网络隔离,在第一台上试错 10 次耗尽额度后换下一台,最终依然能将容错次数翻倍放大。 为了在提供高冗余度的同时彻底杜绝分区破解,苹果将 Cloud Key Vault 节点划分为每组 5 台 HSM 组成的“俱乐部(Club of 5)”。一个俱乐部的 5 个成员共享同一组服务密钥,设备端生成的托管记录直接指定并绑定该俱乐部,且该俱乐部已由集群 CA 颁发签名认证。为消解网络分区威胁,系统引入了分布式仲裁提交协议(Quorum Commit Scheme): - 俱乐部中的每一台 HSM 成员,都在内部独立维护同一份托管记录的尝试失败计数值; - 当托管恢复请求发起时,必须在俱乐部内部发起跨节点投票; - 只有获得超过半数法定人数(Majority Quorum,即 5 台中的至少 3 台)一致批准和计数同步,恢复会话才能继续执行; - 前端设有 iCloud 托管服务代理(iCloud Escrow Service Proxy),后端连接带身份认证的对象存储,每次事务由被选中的一台 Cloud Key Vault 发起仲裁提案并推进。 通过该机制,即便个别节点断网或遭受针对性物理隔离,攻击者也绝无可能绕过多数派共识去单边消耗重试次数。这既保证了数据中心级别的高可用灾备能力,又在数学上锁死了暴力破解尝试的最大绝对上限。 ### [31:49](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1909s) iCloud 密钥保险库(Cloud Key Vault)的共识更新协议 Ivan Krstic 详细还原了硬件安全模块(HSM)集群内部如何协同推进失败计数器的更新流程。当发生验证请求时,发起节点(Originator)首先向集群中的其他单元广播消息,请求获取特定托管记录(Escrow Record)当前的失败计数值。收到请求的各单元评估自身状态后响应:“这是我的计数值,我赞成执行此次更新,因为我当前没有参与其他事务,可以处理该操作。” ```mermaid flowchart TD accTitle: HSM 仲裁计数更新流程 accDescr: 展示发起节点与仲裁组成员在增加失败计数器时经历的四阶段协商确认过程 subgraph Phase1["阶段一:状态查询与投票"] A["发起节点 (Originator)"] -->|"请求特定记录的失败计数值"| B["集群成员 (Club Members)"] B -->|"返回当前计数值并投赞成票"| A end subgraph Phase2["阶段二:法定人数确认与准备"] A -->|"已达多数仲裁,准备更新计数至 5"| B B -->|"验证多数仲裁成立,准备就绪"| A end subgraph Phase3["阶段三:正式提交与确认"] A -->|"执行计数器递增"| B B -->|"确认新失败计数已生效为 5"| A end ``` 在收到足够多的支持响应后,发起节点确认已形成绝大多数法定人数(Majority Quorum),且没有任何节点的记录处于终止锁定状态,随后发出准备指令,指示所有成员将失败计数更新为指定数值(例如增加至 5)。集群成员独立核实验证仲裁成立后,回复准备完毕。最后,发起节点下达正式执行递增的指令,所有成员同步完成写入,并向发起节点确认当前记录的失败计数已正式更新为 5。 - 发起节点必须确保集群达成多数仲裁,且没有任何单一节点的记录达到不可逆的终止(Terminal)状态。 - 每个 HSM 成员仅在没有并发冲突事务的情况下才会投出赞成票,以防止分布式竞态攻击。 ### [32:28](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1948s) 硬件管理智能卡的生成与仪式性物理销毁 管理运行于这些 HSM 之上固件的权力,集中在名为“自定安全代码签名密钥”(Custom Security Code Signing Key, CSCSK)的最高特权凭证上。该密钥拥有对 HSM 固件签名的绝对权力。为了防止单点滥用,使用该密钥需要智能卡的实体法定人数(Physical Quorum)。在建立新的硬件集群时,苹果会举行高度规范的安全仪式:3 张能够解锁 CSCSK 的管理员智能卡会被装入防篡改物证袋中,分别交由苹果公司内部 3 个完全独立的组织持有,并锁入 3 个完全独立的实体保险箱内。 面对听众可能产生的合理质疑——“如果有人搜集了全部三张管理员卡,是否就能自行编译恶意固件绕过计数限制、暴力破解 iCloud 凭证?”,Krstic 给出了断然否定的回答:“不,让我来告诉你为什么。”在硬件集群正式上线生产环境之前,这三个组织的持卡人必须共同前往一处高度受控的安全设施。他们会严格比对原始物证袋的封签序列号与卡片编号,记录正式的书面背书声明:证实自己亲历了智能卡生成的仪式、确认期间未制造任何多余副本、物证袋全程完好无损,且眼前呈现的正是当初制造的原件。 随后,现场人员使用被 Krstic 戏称为“实体单向散列函数”(Physical One-Way Hash Function)的设备——实际上是一台特制的粉碎搅拌机(Crypto Blender)——当场将这 3 张管理员智能卡物理粉碎。这一幽默的比喻引得全场会心大笑与热烈鼓掌。粉碎完毕后,全体见证人员记录最终背书,签字证明所有卡片均已被不可逆地销毁、期间从未被用于签署任何未授权的代码镜像,且世界上再无任何已知机制可向该集群刷入自定代码。 > “在数据同步过程中,当我们向用户做出‘你的机密不会暴露给苹果’这样的承诺时,我们必须能够毫无保留、掷地有声地讲出这句话;而如果我们手中仍持有这些管理员卡,这种承诺在逻辑上就可能不成立。正因如此,我们选择销毁这些卡片。”——Ivan Krstic ### [35:59](https://www.youtube.com/watch?v=BLGFriOKz6U&t=2159s) 苹果漏洞赏金计划(Apple Security Bounty)正式发布 在总结了 iOS 10 的三大核心安全机制后,Krstic 宣布了一项重大决定:苹果正式推出“苹果漏洞赏金计划”(Apple Security Bounty)。现场顿时爆发出持久的欢呼与掌声。Krstic 坦言,长期以来苹果红蓝对抗团队以及外部安全研究人员的反馈高度一致:随着设备底层硬件与软件防御机制的不断加固,挖掘最具威胁的关键级安全漏洞的成本呈指数级上升。这项计划正是为了酬谢那些选择负责任披露漏洞的顶尖研究人员。 该计划将于同年 9 月正式启动,初期采取受邀制,首批邀请数十位知名研究人员参与,以便工程团队能高质量地跟进与处理每一个案例。然而,Krstic 强调这绝非排他性的封闭组织,任何未受邀的外部黑客只要提交符合标准的有效报告,苹果不仅会同样发放奖金,更会直接邀请其加入该计划。所有确认的漏洞将享有最优先的修复排期,并获得公开鸣谢。此外,苹果还推出了配捐机制:研究人员若将赏金捐赠给合格的慈善机构,苹果将进行 1:1 的等额配捐,使捐款总额直接翻倍。 | 漏洞攻击面类别 | 最高赏金上限 | 评估要求与说明 | |:--- |:--- |:--- | | 安全启动固件组件绕过(Secure Boot Firmware) | $200,000 | 突破底层信任链,破坏硬件引导流程 | | 从 Secure Enclave Processor (SEP) 提取机密 | $100,000 | 成功跨越硬件隔离区提取密钥或用户敏感信息 | | 内核权限执行任意代码(Kernel Code Execution) | $50,000 | 在特权内核上下文取得未授权的代码执行权限 | | 访问沙盒外的受限用户数据 | $25,000 | 绕过 iOS 沙盒机制窃取受保护的用户隐私 | | 苹果服务器端未授权访问 iCloud 账户数据 | $100,000 | 在服务端无需凭证横向跨越租户边界访问数据 | - 报告必须包含清晰的说明文档以及可重现的漏洞概念验证(PoC)。 - 漏洞必须能够在最新版本的 iOS 系统及适用的最新硬件配置上成功复现。 - 定价取决于漏洞本身的创新度(Novelty)以及利用所需的交互成本(用户需参与交互的程度越低,评级越高)。 ### [39:23](https://www.youtube.com/watch?v=BLGFriOKz6U&t=2363s) 现场问答环节:从政府博弈到架构细节的边界 在开放提问环节,首位提问者直接抛出敏感的地缘政治与法律问题,询问苹果与 FBI 在圣贝纳迪诺案中关于设备解锁的技术博弈在多大程度上影响了 iOS 10 的安全架构设计。Krstic 对此极为克制地挡了回去:“我是一名工程师,今天我只回答与所讲内容相关的纯技术问题。”迅速化解了政治层面的争端。 随后,现场围绕设备信任与公开发布的透明度展开了多角度的技术探讨: - **受信任设备链的审计与撤销**:有听众担心他人趁手机未锁屏时私自将未授权设备配对加入信任链,并询问普通用户如何审计或单独注销这些设备。Krstic 澄清 Keychain 的“密钥包(Keybags)绝不会直接同步”,并指出用户更改 iCloud 账户密码即可主动打断并使所有密钥链配对关系失效。但当被追问目前系统中是否提供了查看所有受信任设备的审计列表时,Krstic 明确承认:“就目前而言,该功能尚未提供。” - **首次深度公开安全架构的原因**:针对听众提问为何选择在此时首次对外详细拆解 Data Protection 与 SEP,以及为何现在推出赏金计划,Krstic 澄清这并非苹果首次阐述安全机制,官方发布的《iOS 安全指南》(iOS Security Guide)长期以来一直详细收录底层机制,本次演讲旨在面向高度专业的顶级安全圈子分享更多此前未公开的工程细节。而设立赏金的原因则在于“找到这些关键类别漏洞的难度一直在不断攀升”,苹果必须用切实的利益奖励研究人员的付出与创造力。 - **Secure Enclave 与 Apple Pay 硬件隔离的历史成因**:有参会者探究为何 Apple Pay 使用独立的 Secure Element(安全元件),而不是直接集成在 SEP 之中。Krstic 坦承这是一个非常复杂且涉及历史沿革的深度架构问题,婉拒在当天的演讲现场展开讨论,建议提问者通过工程邮件渠道作进一步交流。 ### [43:11](https://www.youtube.com/watch?v=BLGFriOKz6U&t=2591s) FIPS 认证与云端硬件集群(Cloud Fleet)安全架构 在提问环节刚开始时,有现场参会者询问 Apple 系统的加密方法是否通过了 FIPS 140-2 认证。Ivan Krstic 环顾现场确认提问者位置后表示,关于 FIPS 认证的具体状态可以在公开的《iOS Security Guide》中查阅,总体情况是“其中一部分通过了验证,一部分没有”。 随后,一位参会者针对此前演讲中提到的“销毁代码签名密钥(Code Signing Key)”提出追问:一旦销毁了该密钥,Apple 还有没有办法更新云端 HSM/集群上运行的固件或软件?如果之后发现了漏洞,是否必须将整套集群完全抹除并重启?Ivan Krstic 斩钉截铁地回答:“无法更新,事实上销毁签名密钥的目的恰恰就是为了这一点。”针对漏洞应对,他解释道:“如果在云端钥匙串集群中发现了严重漏洞,我们将不得不搭建一套运行已打补丁软件的新集群,并随着时间推移,将新用户的注册迁移到该新集群中。” 紧接着,有提问者谈到 Apple 为防止密钥遭滥用采取的极端防御手段,并追问有何种缓解措施能防止安全元件(Secure Element)被强制运行恶意软件从而泄露内部密钥。Ivan Krstic 首先纠正了提问者的术语,指出这里指的是 Secure Enclave 而非 Secure Element,并指出:“SCP(Secure Enclave Processor)上运行的软件受相同的安全启动链(Secure Boot Chain)保护,该启动链验证了 iOS 设备上运行的所有其他软件。” ```mermaid flowchart TD accTitle: 云端钥匙串集群漏洞应对流程 accDescr: 当旧集群发现漏洞时,由于签名密钥已销毁无法热补丁,Apple通过部署新集群并更新系统CA证书进行隔离迁移。 subgraph OldFleet["旧云端集群 (Old Fleet)"] A["固件代码签名密钥已销毁<br/>(不可在原硬件上更新固件)"] B["已存管的历史恢复记录<br/>(仅旧集群私钥可解密)"] end subgraph NewFleet["新云端集群 (New Fleet)"] C["部署修复补丁的新集群"] D["内置新集群 CA 根证书"] end subgraph Client["iOS 客户端设备"] E["iOS 系统软件更新"] F["后续新用户注册 / 新记录托管"] end A -.->|"发现严重漏洞"| C C -->|"分发新集群 CA 证书"| E E --> F F -->|"接入新集群"| D B -.->|"历史数据不可迁移到新集群"| B ``` - **FIPS 140-2 验证范围**:加密协议与实现的部分组件通过了 FIPS 认证,具体模块认证清单以官方《iOS Security Guide》为准。 - **云端固件无法原地更新**:销毁签名密钥杜绝了 Apple 内部或外部攻击者推送恶意固件导出密钥的可能性。 - **冷启动新集群机制**:发现漏洞时不清除历史数据,而是部署全新的硬软件集群,并通过 iOS 系统更新推送新信任锚点。 --- ### [45:05](https://www.youtube.com/watch?v=BLGFriOKz6U&t=2705s) Apple Watch 离开手腕锁定机制与旧集群托管防劫持 现场观众提到了跨设备解锁场景:“如果 Apple Watch 可以解锁 Mac 和 iPhone,一旦手表遗失,如何保护与之关联的其他设备与账户安全?”Ivan Krstic 笑着询问对方是否佩戴 Apple Watch,得到否定回答后,他打趣道:“如果你用过,你就会知道,在设置 Apple Watch 时必须为其设置一个密码。”他进一步解释,虽然配对的 iPhone 可以协助解锁手表,但 Apple Watch 配备了手腕检测传感器(Wrist Detection),一旦离开手腕就会瞬间自动锁定;重新戴上手腕后,用户必须在手表屏幕上手动输入密码,或使用配对的手机进行解锁,因此单纯拾得遗失的手表无法直接解锁其他设备。 另一位参会者紧扣之前的集群迁移问题继续发难:如果由于漏洞必须迁移至新集群,有什么防御机制能防止类似 FBI 这样的执法机构直接将所有用户的托管密钥整体“迁移”到他们自己控制的集群中,从而实现全局破解?Ivan Krstic 明确否认了这种风险的存在,并剖析了托管记录(Escrow Records)与集群硬件的绑定逻辑: > “根本没有能力将现有的记录迁移到新的集群中,这绝对不可能。我们能做的只是建立一个新的集群,并将新的用户注册引导至该新集群。” Ivan 强调,现存的所有托管记录在密码学上只能由最初生成该记录的特定硬件“俱乐部(Club)”解密。新的设备注册要转向新集群,前提是设备必须拥有新集群的 CA 证书,而这一证书只能通过 iOS 软件更新下发。对于现有设备,在更新系统前仍会与当前版本支持的最佳集群进行通信;得益于 Apple 体系极高的新系统更新率(超过 90% 的活跃用户运行最新 iOS 版本),新集群策略得以快速推行。 - **手腕离体感应防护**:离开手腕瞬间立刻触发密码锁定状态,阻断未授权的跨设备蓝牙自动解锁请求。 - **托管记录密码学绑定**:历史托管记录完全使用旧集群公钥加密,任何第三方均无法在不拥有旧集群私钥的情况下批量重签或转移数据。 - **证书锁定与系统更新协同**:iOS 设备访问新集群必须依赖随固件更新引入的 CA 信任链,无法被网络劫持或中间人伪造指向未授权服务器。 --- ### [47:19](https://www.youtube.com/watch?v=BLGFriOKz6U&t=2839s) Secure Enclave 硬件计数器与 Touch ID 生物识别抗伪造探讨 现场研究员关注了 iOS 设备的暴力破解防御限制,询问防范密码爆破的“10次错误尝试即抹掉数据/失效”这一限制是在 Secure Enclave Processor(SEP)内部强制执行,还是将计数值保存在 SEP 外部。Ivan Krstic 回答得非常具体: > “该限制完全在 SEP 内部强制执行。SEP 拥有一个安全的单调递增计数器(Secure Monotonically Increasing Counter)。” 他指出,该计数器并不保存在外部内存中,一旦该计数器记录到连续 10 次不正确的密码尝试,SEP 硬件逻辑将直接拒绝继续为该用户的钥匙袋(User Keybag)调用设备的 UID 硬件密钥,从而从根源上彻底锁死派生途径。 随后,一位参会者提出了生物识别安全性问题:随着近年来利用人造指纹薄膜、以及美国人事管理办公室(OPM)海量指纹数据泄露事件的发生,攻击者完全可能克隆受害者的物理指纹,并在 Touch ID 的 48 小时免密输入窗口期内解锁设备。提问者询问 Apple 是否考虑过对抗恶意假指纹扫描的技术,或者向终端用户开放配置选项以缩短 48 小时的免密周期。Ivan Krstic 坦言生物识别本身具有固有局限性:“我认为对于一般的生物识别技术而言,这些漏洞在某种程度上是其固有的特性,我们已经在传感器本身及其使用方式上竭尽所能。”他重申,所有的指纹特征匹配操作完全局限在 Secure Enclave 内部执行,原始数据和模板图像绝不会暴露给应用处理器(Application Processor),团队会持续跟踪该学术领域的前沿研究并不断改进传感器算法。 - **单调硬件计数器**:由 SEP 内部电路维护,具备抗重放和防篡改特性,不依赖外部 Flash 或 DRAM 存储。 - **UID 访问熔断机制**:达到 10 次密码错误上限后,SEP 内部通过硬件状态机拒绝使用硬件 UID,导致用户密钥无法被计算派生。 - **Touch ID 架构隔离**:指纹传感器数据直接走隔离通道送入 Secure Enclave 进行模板匹配,应用处理器无法读取生物特征基准数据。 --- ### [49:00](https://www.youtube.com/watch?v=BLGFriOKz6U&t=2940s) 旁路攻击、未来技术规划及漏洞反馈响应机制回应 在问答环节后半段,观众提出了一系列更为发散的技术与流程问题。当被问及 iOS 10 中备受关注的“Watchtower”特性及其底层架构设计时,Ivan Krstic 礼貌地回避了未发布的技术细节,表示当天仅聚焦于本次演讲所公开的主题。 另一位观众询问 iOS 针对侧信道攻击(Side-Channel Attacks,如电磁辐射 EM、功耗分析 Power、声学分析 Sound)的具体防御措施。Ivan Krstic 表示自己不确定《iOS Security Guide》当前对这些内容的覆盖程度达到何种细节,但如果官方白皮书尚未详细收录,这是一个非常值得考虑补充的课题,并欢迎安全研究社区通过邮件与 Apple 安全工程团队深入交流探讨。 随后有人询问 Apple 在维护 iOS 系统时面临的“最顽固、最持久的安全问题是什么”。面对这个尖锐的问题,Ivan Krstic 笑着感慨道:“真是刁钻的听众提问(Tough audience questions)”,引来全场哄堂大笑与掌声,随后他幽默地示意大家“千万别捧场”。 在提问尾声,一名来自中国安全团队的研究人员提出了沟通流程方面的困扰。他表示自己的团队作为 Apple 安全领域的新兴研究团队,从去年开始向 Apple 提交安全漏洞报告,但遇到了响应异常缓慢的情况,个别漏洞的处理周期甚至长达约一年,询问 Apple 内部如何解决这种响应延迟。Ivan Krstic 澄清后回答: > “我们收到了大量的安全报告,绝大多数问题都能得到非常迅速的答复。如果你遇到了某些原因导致沟通不畅的问题,请再发一封邮件,你不应该遇到这种问题。” 在解答完该问题后,Ivan Krstic 宣布答疑时间截止,感谢所有安全从业者到场参加本次 iOS 底层安全架构分享,并在全场掌声中结束了演讲。 - **侧信道防御沟通渠道**:Apple 鼓励安全研究人员就微架构功耗、电磁侧信道等深层芯片攻击防御与安全架构团队通过邮件直接交流。 - **安全漏洞响应机制**:Apple 设立有专职的安全响应团队对接外部提报,Ivan 承诺对极个别跟进延迟的报告提供再次跟进渠道,以确保漏洞修复时效。 ## Notable quotes > [21:34](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1294s) In other words, if a production device is demoted, the UID key that was used in deriving the master key that protects any user data previously on that device is simply unavailable to any software; a different UID key turns up. — Ivan Krstic > [12:12](https://www.youtube.com/watch?v=BLGFriOKz6U&t=732s) if you look at the keys that are exposed to the kernel, none of them have any long-term value after the device is rebooted, that ephemerally wrapped key simply serves no purpose — Ivan Krstic > [32:28](https://www.youtube.com/watch?v=BLGFriOKz6U&t=1948s) 在数据同步过程中,当我们向用户做出‘你的机密不会暴露给苹果’这样的承诺时,我们必须能够毫无保留、掷地有声地讲出这句话;而如果我们手中仍持有这些管理员卡,这种承诺在逻辑上就可能不成立。正因如此,我们选择销毁这些卡片。 — Ivan Krstic > [45:05](https://www.youtube.com/watch?v=BLGFriOKz6U&t=2705s) 根本没有能力将现有的记录迁移到新的集群中,这绝对不可能。我们能做的只是建立一个新的集群,并将新的用户注册引导至该新集群。 — Ivan Krstic > [47:19](https://www.youtube.com/watch?v=BLGFriOKz6U&t=2839s) 该限制完全在 SEP 内部强制执行。SEP 拥有一个安全的单调递增计数器(Secure Monotonically Increasing Counter)。 — Ivan Krstic > [01:04](https://www.youtube.com/watch?v=BLGFriOKz6U&t=64s) So what this lets us do is pretty interesting: we can now emit secret data into a page that the process can execute, but the process itself cannot read. — Ivan Krstic > [10:47](https://www.youtube.com/watch?v=BLGFriOKz6U&t=647s) the number of iterations is chosen to meet a time goal which is between 100 and 150 milliseconds, so we want it to be the case that derivation takes a certain amount of time — Ivan Krstic > [43:11](https://www.youtube.com/watch?v=BLGFriOKz6U&t=2591s) 如果在云端钥匙串集群中发现了严重漏洞,我们将不得不搭建一套运行已打补丁软件的新集群,并随着时间推移,将新用户的注册迁移到该新集群中。 — Ivan Krstic ## Mentioned Ivan Krstic, Apple, Black Hat, iOS, iOS 10, iOS 9, macOS Sierra, WebKit, Safari, Secure Enclave Processor (SEP), Secure Element, Touch ID, HomeKit, Auto Unlock, iCloud Keychain, Cloud Key Vault, Apple Security Bounty, FBI ## Video description by Ivan Krstic With over a billion active devices and in-depth security protections spanning every layer from silicon to software, Apple works to advance the state of the art in mobile security with every release of iOS. We will discuss three iOS security mechanisms in unprecedented technical detail, offering the first public discussion of one of them new to iOS 10. HomeKit, Auto Unlock and iCloud Keychain are three Apple technologies that handle exceptionally sensitive user data – controlling devices (including locks) in the user's home, the ability to unlock a user's Mac from an Apple Watch, and the user's passwords and credit card information, respectively. We will discuss the cryptographic design and implementation of our novel secure synchronization fabric which moves confidential data between devices without exposing it to Apple, while affording the user the ability to recover data in case of device loss. Data Protection is the cryptographic system protecting user data on all iOS devices. We will discuss the Secure Enclave Processor present in iPhone 5S and later devices and explain how it enabled a new approach to Data Protection key derivation and brute force rate limiting within a small TCB, making no intermediate or derived keys available to the normal Application Processor. Traditional browser-based vulnerabilities are becoming harder to exploit due to increasingly sophisticated mitigation techniques. We will discuss a unique JIT hardening mechanism in iOS 10 that makes the iOS Safari JIT a more difficult target. [Source](https://www.youtube.com/watch?v=BLGFriOKz6U)

Source quotes

[21:34] Ivan Krstic: In other words, if a production device is demoted, the UID key that was used in deriving the master key that protects any user data previously on that device is simply unavailable to any software; a different UID key turns up. [12:12] Ivan Krstic: if you look at the keys that are exposed to the kernel, none of them have any long-term value after the device is rebooted, that ephemerally wrapped key simply serves no purpose [32:28] Ivan Krstic: 在数据同步过程中,当我们向用户做出‘你的机密不会暴露给苹果’这样的承诺时,我们必须能够毫无保留、掷地有声地讲出这句话;而如果我们手中仍持有这些管理员卡,这种承诺在逻辑上就可能不成立。正因如此,我们选择销毁这些卡片。 [45:05] Ivan Krstic: 根本没有能力将现有的记录迁移到新的集群中,这绝对不可能。我们能做的只是建立一个新的集群,并将新的用户注册引导至该新集群。 [47:19] Ivan Krstic: 该限制完全在 SEP 内部强制执行。SEP 拥有一个安全的单调递增计数器(Secure Monotonically Increasing Counter)。 [1:04] Ivan Krstic: So what this lets us do is pretty interesting: we can now emit secret data into a page that the process can execute, but the process itself cannot read. [10:47] Ivan Krstic: the number of iterations is chosen to meet a time goal which is between 100 and 150 milliseconds, so we want it to be the case that derivation takes a certain amount of time [43:11] Ivan Krstic: 如果在云端钥匙串集群中发现了严重漏洞,我们将不得不搭建一套运行已打补丁软件的新集群,并随着时间推移,将新用户的注册迁移到该新集群中。

Source quotes

[21:34] Ivan Krstic: if a production device is demoted, the UID key that was used in deriving the master key that protects any user data previously on that device is simply unavailable to any software—a different UID key turns up.

Original transcript

[0:00] thanks all for coming my name is Ivan [0:01] christic and I head security engineering [0:03] and architecture for Apple really really [0:05] happy to be here and tell you about [0:08] three iOS security mechanisms one of [0:10] which is new to iOS 10 uh in a pretty [0:12] great level of detail but before I do [0:15] that because everyone has been asking [0:17] let's talk about decrypted kernel [0:22] caches so as most of you know sounds [0:24] like by the laughter in the iOS 10 betas [0:27] we shipped uh Colonel CES unencrypted [0:31] and then in the subsequent beta we [0:32] actually shipped for pre iPhone 5S [0:34] devices even iboot and boot logos [0:36] unencrypted so yes this is on purpose um [0:40] we from time to time revisit the [0:41] efficacy of some of our security [0:42] mechanisms and in this case while doing [0:44] some other optimizations we took a look [0:47] and realized that we could simply remove [0:48] this encryption and uh not in any way [0:51] impact platform security so there is uh [0:54] no impact to the encryption of user data [0:57] it was simply a way to do an [0:58] optimization and that's really all there [1:00] is to it so with that let's talk about [1:04] hardened webkit jit mapping this is a [1:06] new feature in iOS [1:08] 10 and as background so you understand [1:10] where this is coming from uh JavaScript [1:13] on iOS uh in Safari requires just in [1:17] time compilation to give a really great [1:19] uh JavaScript performance but IOS as a [1:22] platform normally enforces code signing [1:24] on every executable page so clearly this [1:26] is a conflict and in order to bring the [1:29] jit to safario iOS we've had to relax [1:32] the normal code signing policy and allow [1:34] the jit to emit new unsigned native code [1:38] and the way they used to work in iOS 9 [1:40] is there was this uh 32 megabyte uh jit [1:43] memory region uh it was readable [1:45] writable and executable and what that [1:48] meant is that an attacker who had a [1:50] right anyware primitive that was uh [1:52] exploitable from JavaScript could [1:54] actually use it for arbitrary code [1:56] execution because they could take their [1:57] shell code they could put it into the uh [2:00] jit region and simply jump to [2:05] it on arm processors it used to be the [2:09] case that the read bit for uh memory [2:12] page protections was implicit every page [2:14] was readable but in rv8 that changed [2:16] they actually introduced support for [2:17] execute only memory and we built the [2:20] software side of this in the iOS 10 [2:22] kernel so what this lets us do is pretty [2:24] interesting we can now emit secret data [2:27] into a page that the process can execute [2:30] but the process itself cannot [2:34] read so what are we going to do with [2:36] this well we're going to take our jit [2:37] memory region and that same physical jit [2:40] memory we're actually going to create [2:41] two virtual mappings one of them is [2:43] going to be executable one of them is [2:45] going to be writeable and the writeable [2:48] mapping will be at a secret [2:51] location here's what I mean we create [2:54] these two mappings we put the writable [2:56] mapping at a random secret address then [2:59] we create a specialized mem copy that [3:02] actually has the address of the secret [3:04] writable region as immediate values [3:06] inside this new mem copy that we're [3:08] emitting we then make that M Copy [3:10] execute only and discard the address of [3:12] the writable mapping from elsewhere in [3:14] the process now we use this specialized [3:16] nem copy for all of our jit Rite [3:20] operations so here's the replicate code [3:22] that does this the green uh shows where [3:24] we actually Mark our new mem copy as [3:26] execute only and then later on in the [3:29] code we simply zero out the address of [3:32] the writable mapping from elsewhere in [3:34] that [3:35] process so if this is hard to visualize [3:38] here's what it looks like this is IOS 9 [3:39] single region read write execute iOS 10 [3:42] still one physical memory region but two [3:44] different mappings the executable one on [3:46] the left the writable one on the right [3:48] and then in the red you can see our [3:51] execute only page that has the [3:52] specialized M Copy we've emitted and the [3:54] way this works is you call the M Copy [3:57] with a buffer this is what the jit [3:59] normally does it uses the secret address [4:02] of the rable region that's inside of it [4:04] to actually move the buffer into the [4:06] rable region because these are two [4:08] mappings pointing to the same memory [4:10] that makes it appear in the executable [4:12] region to which we can simply jump but [4:16] the process other than the M Copy [4:17] function doesn't know where the rable [4:19] region is so let me actually show you [4:22] what this looks like [4:31] I have two phones here and the one we're [4:34] connected to right now when the top [4:36] piece goes away here let me show you [4:39] here so this is an iPhone running uh iOS [4:43] 93 and if we look at the memory map for [4:46] the web content process which includes [4:48] the Safari jit you'll basically see [4:50] these two guard pages and then you'll [4:52] see one 32 megabyte region that's [4:54] readable writable and executable and [4:56] this is our normal jit region but if I [4:59] switch to the iOS 10 [5:02] phone it looks a little bit different we [5:05] still have our guard pages but we now [5:07] have one mapping that's executable one [5:09] mapping that's writable and we have this [5:12] execute only mapping so let me show you [5:14] what's in there I'm going to attach a [5:16] debugger to the web content [5:20] process and we'll take the address of [5:22] our executor only [5:24] region and see what's [5:28] there so what we do here is as immediate [5:31] values we'll encode the address you read [5:33] this from the bottom up 1708 a c0000 [5:37] that is the address if I scroll up of [5:39] our writable region right [5:41] there and then the rest of this is [5:43] effectively just the mem copy you would [5:45] expect and the way this works from [5:47] inside the process if we take a look at [5:49] for example the readable and executable [5:52] region and from the context of the [5:55] process we attempt to read what's in it [6:03] that'll succeed it'll return a zero [6:05] error code but if I take our execute [6:08] only mapping which has the mem copy [6:10] function which includes the [6:15] secret that simply fails bad access [6:18] exception the memory is not readable [6:20] only executable [6:32] so where this gets us is that an [6:35] attacker who simply has a right anywhere [6:37] primitive from the context of uh [6:39] JavaScript can no longer use it uh by [6:41] itself for arbitrary code execution in [6:43] the process instead they have to subvert [6:45] control flow usually through r or a [6:47] similar mechanism it's kind of a nice [6:49] mitigation that raises the cost of [6:51] exploiting memory corruption bugs in [6:53] particular in [6:57] webkit so I want to move on to uh the [6:59] future I'm going to be talking about [7:00] which is data protection and [7:01] specifically how it uses the secure [7:03] Enclave processor in iOS [7:07] devices data protection is the name for [7:10] the feature that protects all user data [7:12] add rest on our devices and when we set [7:15] out to design this we had a pretty clear [7:17] set of goals in mind we wanted user data [7:20] to be protected with strong [7:21] cryptographic Keys No offline attacks [7:23] which meant that the keys protecting [7:25] user data had to be bound to the [7:26] hardware no Brute Force so hard limit on [7:29] the number of incorrect passcard [7:30] attempts and we wanted to build [7:33] something that could be used as a base [7:34] for secure alternative unlock mechanisms [7:37] like Biometrics in touch ID and the auto [7:39] unlock feature which is new to Mac OS [7:41] Sierra and lets you unlock your Mac from [7:43] your Apple [7:45] watch but we also had one more goal [7:47] which is to entirely sidestep the attack [7:50] surface for the AP this is the [7:51] application processor this is the normal [7:53] uh CPU the trun all uh uh all the rest [7:56] of the code in the operating system and [7:59] so what did does this mean to sidestep [8:00] the surface well it means that the [8:01] authentication policies that I described [8:03] such as our hard limits they need to [8:05] apply even under an adversarial AP and [8:09] no long-term key material should ever be [8:11] exposed to the AP any short-term key [8:13] material that's exposed needs to be [8:14] ephemeral and needs to be bound to the [8:16] session which means it basically stops [8:18] being valid after the device is [8:21] rebooted so the way we set out to do [8:23] this is we introduced the secure Enclave [8:24] processor which is dedicated silicon [8:27] running a small trusted Computing base [8:29] that serves as our cryptographic [8:31] co-processor it has Hardware accelerated [8:33] uh crypto on it and arbiter is the [8:35] Arbiter of all user data access on these [8:38] devices has its own encrypted memory has [8:40] a very narrow interface with which it [8:41] communicates to the normal um AP and in [8:44] the factory we actually do uh key [8:46] pairing so that the SCP has secure [8:49] channels to both the touch ID sensor and [8:51] the secure element which is what's used [8:53] for Apple pay [8:58] transactions the the SCP also has a true [9:01] random number generator on board this is [9:04] a free running oscillators and the very [9:07] first time the SCP is powered in the [9:09] factory it uses this true random number [9:11] generator to generate what we call the [9:13] uid key this is a unique private key [9:15] that will always stay within uh that [9:18] Enclave processor and is not exportable [9:20] in fact the only way that the uid key [9:22] can be used is through cryptographic [9:24] operations that are exposed by the [9:26] secure um which is burned into the hard [9:29] at the factory and is not mutable so no [9:32] mutable software ever gets to see this [9:34] key material and it originated from [9:36] within the core [9:39] itself now that we have the uid key that [9:41] forms the root device key that will be [9:43] used in deriving all the rest of the [9:45] keys and when it comes to keys that are [9:47] actually used to directly protect user [9:49] data we group them in what we call user [9:51] key bags so user key bags are sets of [9:54] keys generated for each user and they're [9:56] wrapped by a master key which is derived [9:59] from a combination of the user passcode [10:01] and the uid key in the [10:03] hardware so this lets us make it a case [10:06] that after 10 incorrect passcode [10:07] attempts the SCP will simply refuse to [10:10] process any further attempts and so long [10:12] as it refuses to do so as it's the only [10:14] thing that can ask for cryptographic [10:16] operations to take place on the uid key [10:18] it is not possible to uh make any more [10:21] attempts now for the user keyack Keys um [10:24] I mentioned it's a set of them this is [10:25] because they're used for different [10:27] purposes and they're available at [10:28] different time times so this is [10:30] effectively uh the key list they're [10:33] class Keys we call them a through D and [10:37] uh some of these are keys that are [10:39] always available when the uh system is [10:41] uh is running and then some of them are [10:43] only available after the user has [10:45] unlocked their device at least once and [10:47] uh yet Class A is stronger these are [10:49] only available while the user is [10:51] actively using the unlocked device now [10:53] mind you classes AC and D these are [10:55] 256bit a keys uh for class B it's [10:59] actually a key pair with curve 25519 and [11:02] what that lets us do is make the public [11:04] key always available but the private key [11:06] is only available while the device is [11:09] unlocked so I'll explain about that in a [11:11] moment meanwhile here's just in case [11:13] you're curious what an actual annotated [11:15] keyag looks like uh this sits on uh the [11:17] file system of every iOS device just Els [11:20] us the version the kdf salt iteration [11:22] count used to uh Drive the keys and then [11:25] actually has the key identifiers uh for [11:27] the wrapped Keys themselves and in the [11:29] case of the Class B key the raw bites of [11:32] the public key for class [11:41] B so I mentioned that the master key is [11:43] derived from a combination of the user [11:45] passcode and the uid key um this is a [11:47] very straightforward process effectively [11:49] we take the user passcode and the salt [11:51] in userland we run it through key [11:53] derivation function and then we move it [11:55] over to the hardware side where the SCP [11:56] will continue iterating on it using the [11:58] uid key [11:59] and the number of iterations uh is [12:03] chosen to meet a time goal which is [12:05] between 100 and 150 MC so we want it to [12:08] be the case that derivation takes a [12:09] certain amount of [12:12] time so now that you understand how the [12:14] keys work the question is how do we use [12:16] this to actually protect file system [12:18] data file blogs themselves are encrypted [12:20] with axts uh in with 128 bit keys but [12:24] the thing to know is that each file [12:26] actually has its own unique random key [12:29] that is generated by the SCP for it and [12:31] those raw file keys are never exposed to [12:34] the normal application processor instead [12:37] they're wrapped with a key from the user [12:39] keyag for long-term storage and remember [12:41] those keys are only uh can only be [12:43] unwrapped by the SCP and then while the [12:46] system is in use they're also wrapped [12:48] with an ephemeral key that is bound to [12:50] that boot session of the phone so this [12:52] is kind of an interesting thing to think [12:54] about let me show you what it looks like [12:56] at boot of the device the as engine in [12:59] the SCP generates an ephemeral key and [13:02] through a secure outbound Channel sends [13:04] it to the storage controller this is the [13:06] nand controller for the unit then later [13:08] when the phone is running or the device [13:10] is running and you attempt to open a [13:13] file the uh Colonel will fetch the [13:16] wrapped file key from the metadata we'll [13:19] send it over to the SCP which will use [13:21] the uh user keyack key to unwrap it and [13:25] then it'll rewrap it to that ephemeral [13:27] key that was chosen at boot [13:30] and it's this ephemerally wrapped file [13:32] key that is sent back into the kernel [13:35] from where it's sent into the storage [13:36] controller which can now use the Emeral [13:39] key to um unwrap the real file key [13:43] retrieve the cipher text from The nand [13:45] Flash and send the clear tax text back [13:48] back into the kernel what's important [13:51] about this is that if you look at the [13:52] keys that are exposed to the kernel none [13:54] of them have any long-term value after [13:55] the device is rebooted that ephemerally [13:57] wrapped key uh simply serves no [14:01] purpose [14:03] so hitting the goals we set out for data [14:06] protection actually requires quite a few [14:08] moving parts and uh I wanted to walk you [14:11] through what it actually looks like when [14:14] a device boots when a device is first [14:17] unlocked when it's locked and then [14:18] finally when we use a touch ID [14:22] unlock the first thing that happens is [14:24] that the kernel boots this is coming off [14:26] the system [14:27] partition and the apple key store will [14:30] load what we call the D key this is the [14:32] uh class D key out of effaceable storage [14:35] and effable storage is if you're not [14:37] familiar with it a part of our n flash [14:39] where we allow no wear leveling and no [14:41] relocation of blocks which means we can [14:42] securely erase things that are in that [14:44] section of uh the flash so this uh D key [14:47] is retrieved and sent into the uh SCP [14:51] which decrypts it using the uid key and [14:54] hardware and loads it into the SKS [14:56] keuring SKS is the application on the [14:58] SEC secure Enclave that um handles our [15:01] data protection Keys it's called a [15:02] secure key store secure key service and [15:05] so now this decrypted class D key is [15:07] loaded into the key [15:09] ring the kernel will decrypt file system [15:12] metadata using a media key media key is [15:14] another key that stored in aable [15:16] storage and at this point laun D kicks [15:18] in mounts the user partition and starts [15:21] a demon called keyag d keybag d loads [15:24] the system keyag which is just sitting [15:26] as a file in the file system and it can [15:28] do so now because our class D key is [15:31] available decrypts this key bag using [15:33] yet another key from aable sto storage [15:35] called the protection key and send it [15:38] into SKS where finally the device keyack [15:41] can be unwrapped the class B public key [15:44] loaded into the key [15:46] ring so if you look at what this [15:51] means normal class Keys A and C in [15:55] particular and the private key for class [15:56] B those are not decryptable on until the [15:59] user can present their passcode and the [16:01] master key can be derived but the device [16:03] in this state can read all class d [16:05] protected files and can use the class B [16:08] keys to write files that are only [16:11] readable after the user unlocks the [16:14] device it's kind of a Dropbox [16:19] mechanism after this laun D will simply [16:21] permit user space to continue [16:25] booting now let's talk about first [16:27] unlock [16:33] first springboard which is the um uh [16:37] user-facing user interface on uh um on [16:40] the device will acquire the passcode [16:42] from the user and it'll send it to the [16:44] SCP which will generate the uh master [16:48] key using a combination of the passcode [16:49] I just received and the uid hardware [16:55] key now that we have the master key we [16:57] can take the user key bag and the RP all [16:59] of the class keys and add them to the [17:00] key [17:02] ring but we'll do one more step we'll [17:04] take our master key we'll generate a [17:06] random secret and we'll encrypt the [17:08] master key with that random [17:11] secret the random secret will be sent to [17:13] sbio which is another app running on the [17:16] SCP which is responsible for doing [17:19] biometric matching for the touch ID [17:20] sensor mind you it's not the master key [17:23] or even the encrypted master key that [17:24] sent over just the random secret it's [17:26] SKS that still holds on to the master [17:29] key encrypted with that [17:30] secret after this SKS will securely [17:33] destroy the master key the raw master [17:35] key from its memory holding on only to [17:37] the encrypted version with the secret [17:39] that it's sent to as [17:41] bio you'll see how we use that in a [17:43] second but first because lock is simple [17:46] let me show you what happens here once [17:48] the device locks we simply notify the [17:50] SCP it purges the class A and B private [17:53] keys from its key ring and that leaves [17:55] the public key for class B Class C which [17:58] if if you remember is meant to be [18:00] accessible anytime the user has unlocked [18:02] the device at least once and finally the [18:04] class D [18:06] key so here's how Touch ID Works in this [18:15] model pressing the home button starts [18:17] the [18:18] sensor and the sensor acquires an image [18:21] and sends it to the S bio app in the [18:25] SCP this app actually performs the match [18:28] and determines whether the uh [18:30] fingerprint that was just acquired [18:31] matches the fingerprint of the [18:32] authorized user if so it takes the [18:35] random secret that we handed it earlier [18:37] and sents it back to SKS to the secure [18:39] key store that lets SKS decrypt the [18:43] master key yet again and upon that [18:46] decrypt all the rest of the class keys [18:48] and add them to the [18:51] keuring after that the raw master key is [18:55] once again securely destroyed [18:59] I want to mention one more thing which [19:00] is that data protection and uh how it [19:03] interacts with the secure Enclave also [19:05] enabled us to securely do a feature um [19:08] called update later which is basically [19:10] that when a user logs in and unlocks [19:12] their device uh they're notified that [19:14] there's a software update available and [19:15] they can choose to do the update right [19:17] then and there but they can also say [19:18] install [19:19] later and if they choose install later [19:22] we'll prompt them for their passcode and [19:24] if we can verify that it's the correct [19:25] one we will enable the creation of what [19:27] we call an OT this is a onetime unlock [19:30] token and it's a token that the SCP [19:33] creates after this the user is going to [19:35] log their device but once the user set [19:38] install later we use on device the same [19:41] predictive technology that underlies our [19:43] proactive assistant to make a best guess [19:47] of a time of day when the user is not [19:50] going to be using their device and the [19:51] device is going to likely have [19:53] power so once we've made that uh [19:56] prediction the user is interacting with [19:58] their device over the course of the day [20:00] and at some point they'll have unlocked [20:01] the device and based on our prediction [20:03] of the right um update window time we [20:06] will conclude that this is likely the [20:08] last time they're unlocking their device [20:10] before eventually they will hit the [20:12] update window later so because of this [20:15] and because we enabled creation of theat [20:17] earlier we will actually create an otat [20:19] at this [20:20] time the software update sub system will [20:23] say there's an OT created please persist [20:25] it for me and it'll also start an 8 hour [20:27] timer um if a OT is not used for 8 hours [20:29] uh it'll be destroyed and the user niser [20:33] is continuing to use their device and [20:34] will at some point lock it and probably [20:35] go to bed but at this point we're [20:38] persisting that otat which means that [20:40] when we hit the update window time in [20:41] this case we guess that 3:00 a.m. is a [20:43] good time the software update can run on [20:46] the [20:46] device and after it's finished it can [20:49] reboot the device and use the [20:53] otot to unwrap uh access to user data [20:57] once again to to finish doing things [20:59] like migrating data uh if required by [21:01] the new software update so that when the [21:03] user next goes to use their device [21:05] rather than a software update having [21:06] taken place and their device being fully [21:08] locked as if they had rebooted it uh [21:10] instead they get a fully working device [21:12] ready to go with the latest software on [21:17] it there's one more thing I want to call [21:19] out about this which is something we [21:20] call thec security mode um we have a [21:23] feature called the motion and this is [21:25] because if you think about it we have a [21:26] billion active devices out there and uh [21:29] we need to have some ability to be able [21:30] to debug a production device and [21:34] so the demotion feature is a way to take [21:37] a production device and enable some [21:39] debugging functionality like JTAG and [21:41] the ability to load development software [21:43] on the application processor though not [21:45] the SCP this requires both that um after [21:49] being authorized for this on the [21:50] personalization server the uh device to [21:53] be demoted is fully erased and a new um [21:56] OS loaded on it but the key thing about [21:58] it is that it also forces a different [22:01] uid key to show up to the SCP and this [22:04] is done in Hardware in other words if a [22:06] production device is demoted the uid key [22:09] that was used in deriving the master key [22:11] that protects any user data previously [22:13] on that device is simply unavailable to [22:15] any software a different uid key turns [22:20] up so if you remember the goals that we [22:22] set out uh for ourselves for data [22:24] protection this is how we manage to meet [22:27] every single one of them [22:40] what I want to talk about next is [22:41] synchronizing [22:44] secrets we have a number of features [22:46] where it's really really useful to be [22:48] able to move the user secret between [22:51] their different devices passwords and [22:53] credit card information for Safari are a [22:55] good example but also some new features [22:57] like Auto unlock which I mentioned [22:59] earlier which wants to be able to move [23:01] securely move cryptographic Keys between [23:02] a user's Mac and their Apple watch and [23:05] then homekit is another good example [23:07] where uh we want all cryptographic keys [23:09] to be available on all of the users [23:10] devices so they can control their [23:11] homekit devices and of course there's [23:15] bound to be many more uses for uh um the [23:18] ability to do this and if you look at [23:21] how synchronizing Secrets has [23:23] traditionally been done there's [23:24] basically been two approaches either you [23:27] generate a strong random key that's [23:29] going to be protecting all the secrets [23:30] all the rest of the secrets as they're [23:31] moving which means that usually the user [23:34] has to print a key or write it down uh [23:37] and so it has the right cryptographic [23:38] security level but not an acceptable [23:40] user experience or the second option is [23:43] to derive a key that'll be used to [23:46] protect the rest of the secrets from the [23:47] user's [23:48] password which is a problem because uh [23:53] users tend to not choose [23:54] cryptographically strong passwords and [23:56] if this is a password that belongs to [23:58] some account account they have it [23:59] usually means that the account provider [24:00] backend is in a privileged position they [24:02] may be able to bruteforce the password [24:04] uh and therefore um access all of the [24:07] users uh Secrets as [24:09] well why don't users uh just pick strong [24:13] keys [24:16] well this is from um a book on [24:19] cryptography humans are not very good at [24:24] this so when we looked at synchronizing [24:26] secrets and what the goals are for a [24:28] mechanis to do this we were actually [24:29] pretty inspired about what we've done [24:31] with data protection we wanted selected [24:34] user Secrets available on all devices we [24:36] wanted strong cryptographic Keys [24:37] protecting them we wanted the user to be [24:39] able to recover this even if they lose [24:41] their devices without having to write [24:43] down uh a key and put it in their sock [24:46] drawer and we wanted the user secrets to [24:48] not be exposed to Apple at any point we [24:51] also wanted no Brute Force [24:54] ability so here is how we approach this [24:57] with iCloud keychain we have every [24:58] device that participates generate an [25:00] iCloud keychain synchronization key pair [25:02] this is a strong key pair and when a [25:05] user has a new device that they want to [25:07] have uh received their secrets they [25:08] actually have to explicitly approve it [25:11] from a device that they already started [25:13] with and once that [25:17] happens the devices can start receiving [25:19] all of the rest of the secrets now the [25:20] way this synchronization Circle works is [25:23] it uses the Apple Cloud backend for [25:25] message passing and for storage but the [25:28] backend is in no way in a privileged [25:29] position because again this is protected [25:31] by what was a locally generated strong [25:33] key pair so this is one part of the [25:35] story but what if the user loses all of [25:38] their devices or what if they need to [25:39] configure a new device without actually [25:41] having access to the old one so for this [25:44] we have a feature called iCloud keychain [25:46] backup and here's what we [25:48] do we have a new credential the iCloud [25:51] security code and most often this is the [25:53] device passcode the passcode of the [25:55] actual device this is a credential [25:57] that's clearly unknown to [25:59] Apple we then generate a strong random [26:02] key which we call the escro key and we [26:05] will wrap this escrow key with a key [26:08] derived from that iCloud security code [26:10] most commonly the device passcode we [26:12] then take the wrapped escrow key send [26:15] that to Apple and we back up a copy of [26:18] the iCloud keychain secrets and that are [26:21] encrypted themselves with the escrow key [26:23] now if a device is lost or the user has [26:25] a new device but no access to the old [26:27] one they can recover secrets so long as [26:29] they have their iCloud password and this [26:30] new cronal the iCloud security [26:33] code so if we look at the goals that we [26:35] have for synchronizing secrets we meet [26:36] the first four with a combination of [26:38] iCloud keychain and iCloud keychain [26:39] backup but what about that last [26:44] one the attack surface in the back end [26:46] here is quite tricky if we implemented [26:49] naively what I just described the back [26:51] end is clearly in a position to Brute [26:53] Force the I security code and access the [26:54] escrow key remember the I security code [26:56] is most commonly the device pass code [26:58] which means uh you know only a million [27:01] possibilities usually and so what we [27:03] need is just like with a secure Enclave [27:05] we need some way to enforce a policy [27:07] over the escro key that prevents brute [27:09] force and does so even under an [27:11] adversarial [27:12] Cloud so we said what if unwrapping the [27:15] escro key could only take place in [27:17] Hardware security [27:20] modules let me tell you about cloud [27:23] keyal cloud keyal is a just an internal [27:26] name for a collection of Ware security [27:28] modules which if anyone is not familiar [27:31] they're cryptographic co-processors that [27:33] can uh generate Keys securely within the [27:35] hardware that are non-exportable and [27:37] just expose cryptographic operations on [27:40] them we have a fleet of them that are [27:42] running custom secure code within the [27:44] Hardware security modules themselves and [27:46] these are connected to the Apple Cloud [27:48] the key Vault Fleet operates its own [27:50] certificate Authority where the private [27:51] key never leaves the hardware of the [27:53] Hardware security modules and each iOS [27:56] device hardcodes the certificate of the [27:59] keyal [28:02] fleet this is the simple unit for cloud [28:04] keyal it's a host paired to a Hardware [28:06] security module and then the Hardware [28:07] security module has access to a number [28:09] of keys most importantly the first one [28:12] which is the custom secure code signing [28:14] key so this is a code that allows [28:16] software to be loaded into the Hardware [28:18] security module and then lastly that [28:20] service key which allows unwrapping the [28:23] user's escro records so what's an escro [28:26] record I mentioned earlier [28:28] it's the user strong randomly generated [28:30] escrow key it's an SRP verifier for [28:34] their iCloud security code commonly [28:35] deviced passcode and then it's a maximum [28:38] failure count of how many incorrect [28:40] attempts on the iCloud security code are [28:43] allowed within the context of this [28:44] record before no further attempts are [28:47] allowed So This escar Record is [28:49] encrypted to the public service key for [28:53] the cloud [28:55] KEYT where does this get us well we've [28:58] effectively built a kind of data [29:00] protection but for Esco records the [29:03] private key for default service is [29:04] simply not available to any mutable [29:06] software just like our uid key and D SCP [29:10] and effectively when a user wants to do [29:12] an escco recovery uh they retrieve their [29:15] escco record from the Apple Cloud they [29:16] establish a session to Cloud key Vault [29:18] for SRP and the Vault will unwrap the [29:21] record find the U SRP verifier for the [29:24] ioud security code so long as the user [29:26] can present the right out security code [29:28] code the cloud key WT will return that [29:30] strong randomly generated escro key [29:32] which protects all of the rest of their [29:33] secrets and if SRP fails The Vault unit [29:37] bumps a secure [29:38] counter where if a maximum failure count [29:41] from the record is reached the record is [29:43] marked terminal and the cloud keyal will [29:45] refuse to process any further attempts [29:48] with that record [29:58] the thing is that a user can't simply [30:00] escr to only one key Vault [30:03] unit we need the redundancy in this [30:05] design because uh these units can fail [30:08] but if we simply said well why don't we [30:10] escort five units that's because every [30:12] new unit you escort to increases that [30:15] maximum failure count if you escrow to [30:17] uh five Cloud key volt units then [30:19] instead of having you know 10 maximum [30:21] failure uh attempts you're now up to 50 [30:25] so here's what we've done we've paired [30:26] the cloud key volt units into clubs that [30:29] actually these are clubs of five and [30:30] they share a single service key so the [30:33] user generates their escco record [30:35] targeting a specific club and that club [30:38] is certified by the fleet certificate [30:40] Authority this solves our redundancy [30:42] problem because now we have five units [30:45] but it doesn't solve Brute Force [30:46] limiting because club members could [30:48] still be attacked with partitioning [30:50] attacks this simply means if you have a [30:51] club of five one of them can be isolated [30:54] from the network and then you make 10 [30:56] attempts on it using the record if that [30:59] doesn't work you move it aside you [31:00] isolate the next one from the club and [31:01] you repeat the process until ultimately [31:04] you've gotten the maximum failure count [31:06] multiplied by the five units in the [31:09] club so what we've done is implemented a [31:11] quorum commit scheme where each club [31:13] actually maintains its own failure count [31:15] I'm sorry each Club member maintains its [31:17] own failure count for each Esco record [31:19] and when an escco recovery is in [31:21] progress it actually prompts a vote [31:23] where a majority Quorum is required to [31:25] proceed so this provides both redundancy [31:27] and breaks membership partitioning [31:28] attacks here's how it [31:30] works this by the way is the overall [31:32] Fleet design so the fleet is [31:34] partitioning these clubs so five units [31:36] there's authenticated object storage in [31:37] the back and then there is an iCloud [31:39] Escrow Service proxy in the [31:41] front so here is what an escrow [31:43] transaction looks like effectively one [31:45] cloudkey unit out of the club is chosen [31:47] as the originator and says I propose an [31:49] update please give me your failure [31:50] account for a specific escco record the [31:52] rest of the units say here's my counter [31:54] I vote Yes on this update because I'm [31:57] not in another trans actions so I can do [31:59] this then we move to the next phase [32:01] where the originator says very good we [32:02] have majority Quorum no one's record is [32:04] terminal so prepare to update the [32:06] failure counter to five all the rest of [32:09] the club members say very well I've [32:11] verified that we have majority Quorum I [32:13] stand ready to increase the counter [32:15] after that the originat says excellent [32:17] increase the counter and finally all of [32:18] the rest of the club members confirm [32:20] that they now have the new failer count [32:22] of five for this [32:26] record now [32:28] now I mentioned that there's this Custom [32:31] Security Code signing key [32:34] that lets you sign any software you want [32:36] to have running on these Hardware [32:38] security modules that power the cloud [32:40] key Vault and the way to use this very [32:43] powerful key uh requires an actual [32:45] physical Quorum of smart cards so when [32:50] uh we create a new Fleet there's a [32:51] secure ceremony where uh the uh three [32:56] admin cards that can unlock the Cs cik [33:00] are put in uh tamper resistant evidence [33:03] bags and are handed to three different [33:05] organizations that Apple which then [33:07] stored them in three separate physical [33:11] safes but yet if someone managed to get [33:14] their hands on all of the admin cards [33:17] they could put them together sign a new [33:19] custom secure code image that can bypass [33:22] all the protection I described and [33:23] bruteforce the iCloud security code for [33:26] any arbitrary escar record couldn't [33:30] they [33:34] no let me tell you why before a fleet [33:38] goes into production a cloud keyal Fleet [33:40] the members of those three card carrying [33:42] organizations at Apple meet in a secure [33:43] facility they cross check the serial [33:46] numbers on all the evidence bags from [33:48] the original ceremony and the cards [33:50] within them and then they make a series [33:52] of attestations that are recorded they [33:53] attest that they were present when the [33:55] cards were created they attest that no [33:58] other admin cards were created that the [34:00] evidence bags have been sealed the [34:01] entire time and that the cards that are [34:03] present today are exactly the cards that [34:05] were originally [34:07] created and then the cards are combined [34:11] using a novel physical one-way hash [34:20] function is [34:22] um our CP crypto blender [34:30] thank you I thought you might like [34:33] that after this is done a number of [34:36] final arations are [34:38] recorded all the people present attest [34:40] that all the cards that were originally [34:41] created are now destroyed that the cards [34:43] were not in the interim used to sign any [34:46] other custom secure code that can be [34:47] loaded into the fleet and finally that [34:50] no other mechanism is known that would [34:52] allow the custom secure code to be [34:54] changed or new code loaded [35:00] why do we do [35:01] this why take that last step that's [35:03] extremely [35:07] unusual you know we've seen with data [35:09] protection in the secure Enclave [35:11] processor that we go to tremendous [35:12] lengths when it comes to engineering [35:15] these security systems that provide [35:17] trust in how we protect user data but we [35:20] realize that when data leaves the device [35:22] the stakes are even higher and we're [35:25] fortunate that we've earned the trust of [35:27] our customer customers but we realize [35:29] that that's something that we have to [35:30] keep earning so here when we make a [35:33] statement like your secrets are not [35:36] exposed to Apple when they're being [35:37] synchronized we have to be able to make [35:39] it unequivocally and if we still retain [35:42] possession of these admin cards there's [35:44] the possibility that that's not true so [35:48] because of that we destroy the cards and [35:51] I hope that gives you some feel for how [35:53] seriously and how passionately we take [35:55] our mission to protect user data [35:59] so those are the three features that I [36:01] wanted to talk about today and before we [36:04] move on I want to share some news with [36:09] you I'm very happy to say that Apple [36:12] today is announcing an Apple security [36:14] Bounty [36:22] program thank [36:24] you we've had great help from [36:27] researchers like you in improving iOS [36:29] security all along and as the security [36:32] mechanisms we build such as some of the [36:34] ones that I've been describing to you [36:35] today have gotten stronger feedback that [36:38] we've heard pretty consistently both [36:40] from uh my red team uh at Apple and also [36:44] from from researchers directly is that [36:47] it's getting increasingly more difficult [36:48] to find some of those most critical [36:50] types of security [36:53] vulnerabilities so the Apple security [36:55] Bounty program is going to reward [36:56] researchers who actually share critical [36:59] vulnerabilities with apple and we're [37:02] going to make it a top priority to [37:04] resolve these confirmed issues as [37:05] quickly as possible we'll provide public [37:07] recognition unless asked [37:10] otherwise and let me tell you where [37:12] we're starting this is our list of [37:14] initial [37:19] categories we believe that these payment [37:21] amounts are commensurate with the level [37:23] of difficulty in attacking some of these [37:25] systems you'll see that there are four [37:27] categories for on device vulnerabilities [37:30] and one for any unauthorized access to [37:33] iCloud account data on Apple [37:38] servers in addition to uh these exact [37:42] amounts uh we will let researchers uh [37:45] donate the reward to charity of their [37:47] choosing and if they do so we will add [37:49] our option match that one for one [37:51] doubling the donation and I mentioned [37:53] that these are all Maximum payments [37:57] the exact payment amount will uh be [37:59] determined after uh we on the [38:02] engineering on the engineering team [38:03] review the actual report uh that is uh [38:06] submitted this has to be a clear Report [38:08] with a technical proof of concept uh it [38:11] needs to show the vulnerability uh [38:12] present in the latest version of iOS and [38:14] on the latest Hardware where that's [38:15] applicable and we'll look at both [38:17] novelty for the vulnerability and also [38:19] the likelihood of user exposure so [38:21] frequently how much interaction is [38:23] required from the user to actually [38:24] exploit the vulnerability and we know [38:27] that there could be uh important [38:29] vulnerabilities elsewhere but this is [38:30] where we're starting [38:33] today so the program goes live September [38:37] and we're inviting a few dozen [38:39] researchers to participate [38:42] initially this is because we want these [38:45] interactions to be really [38:49] great [38:50] but it's not meant to be any kind of [38:52] exclusive Club so if someone who is not [38:56] in the program brings to us a [38:58] vulnerability that would be covered [39:00] under the program we welcome that we're [39:02] going to take a look and if the work [39:04] merits it we'll invite them into the [39:06] program and will reward the [39:07] vulnerability that they [39:11] found very happy to get this off the [39:13] ground and uh so pleased to be able to [39:16] tell you about it today thank you very [39:18] much and I'm happy to uh take some [39:19] questions [39:21] [Applause] [39:23] [Music] [39:40] all right go ahead um just quick to what [39:43] extent has the um problems you've been [39:46] having with the FBI trying to unlock [39:47] devices influenced your security [39:49] architecture going forth in iOS 10 I'm [39:53] an engineer uh I'm happy to answer [39:55] technical questions about what I've [39:56] covered today [40:04] go ahead uh hello so maybe I just missed [40:07] in some way is there any mechanism by [40:09] which a user can uh audit possibly [40:12] revoke the list of devices that have [40:14] been access that have been given trust [40:15] access by his other devices imagining [40:17] situations where somebody has a a friend [40:20] of mine forance had a phone sitting [40:21] unlocked on a counter and then walked [40:23] away momentarily somebody could like set [40:24] it up trust to their devices and [40:26] suddenly their key bags and everything [40:27] are just being synced across constantly [40:30] permanently keyb backs are definitely [40:31] not being synced I'm sorry I just I'm [40:33] just standing up in front of a [40:34] microphone being kind of nervous not a [40:36] problem so for um for iCloud keychain [40:38] it's uh sufficient to change your iCloud [40:41] password and that'll actually break uh [40:43] the pairing uh the some of the details [40:46] for that I believe we have in the iOS [40:49] security guide which is a public [40:50] document and if you find any part of [40:52] that that doesn't answer your question [40:53] uh shoot us an email and we'll see if we [40:55] can get you an answer can you get a list [40:56] of those devices though so that you know [40:58] if you need to revoke them I see uh no [41:00] that is not available right now [41:03] okay M go ahead hi what is the the [41:09] reason why you're doing this now I mean [41:11] you've had many software updates and [41:12] this is the first time that you're [41:14] talking about your data Protection [41:16] Program and also why is now the time to [41:18] release the Bounty security [41:21] program well it's not the first time [41:23] we're talking about this the iOS [41:24] security guide which again is a publicly [41:26] available document go CL into um uh it [41:29] hits most of the outline of the design [41:31] and how it interacts with the secure [41:33] Enclave what I've done today is uh [41:35] offered I think a lot of new detail that [41:38] I thought would be particularly [41:39] interesting to a a super technical [41:41] security audience um but you know it's [41:43] not our our first time describing uh how [41:46] our security works and in fact the the [41:48] guide is now quite long and gives a [41:50] pretty comprehensive overview of [41:52] virtually every single security [41:53] mechanism that we have um as for the [41:57] Apple security Bounty program uh you [42:00] know I tried to uh I Tred to sort of [42:02] answer that by by by saying that the [42:04] feedback we've been hearing pretty [42:05] consistently for um uh for some time now [42:09] is that the difficulty in actually [42:11] finding some of these most critical [42:13] critical kinds of vulnerabilities has [42:14] been going up and up as we've continued [42:16] to invest into technical security [42:18] mechanisms and so uh the difficulty of [42:22] finding these now is such that we want [42:24] to reward the people who spend the time [42:25] and effort and frankly creativ to be [42:27] able to still find vulnerabilities in [42:29] some of these [42:32] categories go ahead you mentioned how [42:35] the secure Enclave that you described [42:37] today and the secure element for Apple [42:39] pay are separate Hardware modules can [42:42] you speak us to why like the history as [42:44] to how that came to be why wasn't Apple [42:46] Pages developed on top of the secure [42:48] Enclave you know it's [42:50] um that's a pretty hard question and uh [42:54] I'm going to focus just on what I [42:55] covered today if you don't mind but [42:56] again uh feel free to shoot us an email [42:58] and we'll see if we can get you uh an [43:03] answer [43:07] yes hello hi oh over [43:11] here other way are your uh systems are [43:15] your uh cryptographic methods 140-2 [43:18] validated fips I'm sorry who's talking [43:22] aha I see [43:24] you uh we I think the exact status of [43:29] the fips certification should be [43:30] mentioned in the I security guide uh [43:32] essentially some of it is validated and [43:34] some is not okay thank you [43:38] MH uhuh all right you go ahead and try [43:41] yep I hear you okay okay you hear me um [43:44] so after you destroy that code signing [43:46] key [43:48] um is there any way to update the the [43:53] firmware or the software running on the [43:55] on the cloud there's not in fact that's [43:57] the very purpose of destroying that uh [43:59] that signing key so uh go ahead so what [44:02] if there's some vulnerability that's [44:04] discovered later do you have to wipe out [44:05] the entire Farm the entire fleet and [44:07] restart if a critical vulnerability were [44:08] to be discovered in the cloud keal Fleet [44:10] we would have to stand up a new Fleet [44:12] that has the patch software and then [44:14] over time migrate new user enrollments [44:16] to that Fleet okay thank [44:19] you go ahead so in keeping with uh that [44:23] story of the extreme methods you're uh [44:25] measures you're going to to protect [44:27] protect users from misuse of key [44:29] material that Apple might have can you [44:32] talk to us about mitigations that might [44:33] be in place uh to keep the secure [44:37] element from ever being forced to run [44:40] software that would divulge the key [44:42] material it [44:44] has I think you mean the secure Enclave [44:46] rather than the forgive me yes the [44:48] software that runs on the SCP is covered [44:51] by the same secure boot chain that [44:53] validates all the rest of the software [44:54] that's running on iOS devices [44:57] I understand if that's all you're [44:58] willing to say thank [45:05] you okay we have uh someone in the back [45:08] go [45:09] ahead so with the Apple watch you if you [45:11] can unlock Max and phones and if I lose [45:14] that Apple watch how do you protect uh [45:18] all of the other accounts that I [45:21] have all of the other accounts you said [45:24] I I mean all all of the other devices so [45:26] if with the Apple watch if I can unlock [45:28] my Mac and if I lose that Apple watch [45:31] mhm uh what kind of what kind of [45:34] security yeah it's a good question so uh [45:37] I don't know if you um do you use an [45:39] Apple Watch no [45:42] ha if you [45:44] did you would know that uh when you uh [45:47] set up your Apple watch you actually [45:49] have to pick a passcode for it and uh [45:52] you can set up your phone to effectively [45:54] uh um help you unlock your watch but the [45:57] has a sensor where the moment you remove [45:59] it from uh your wrist it'll lock and [46:02] once you put it back on your wrist you [46:04] can either unlock it using your phone or [46:05] you have to enter a Pasco directly into [46:06] the [46:10] watch follow on question from what you [46:12] said earlier so if the case that that [46:14] you have to migrate over to another [46:15] Fleet what is what mechanism is there to [46:18] prevent say FBI migrating everybody's [46:21] data escrow Keys over to their Fleet and [46:25] effectively own there is no ability to [46:27] migrate an existing record to a new [46:29] Fleet that's simply not possible what we [46:32] can do is stand up a new Fleet and [46:33] migrate new enrollments into that Fleet [46:36] so in other words the existing body of [46:38] escar Records can only ever be decrypted [46:41] by the club that the user created the [46:43] escco record to what we can do is make [46:45] it so that further enrollments can go [46:47] into the new Fleet and that by the way [46:49] requires the ca search for the new Fleet [46:52] to be present on the iOS device so it [46:55] has to come through a software update [46:57] existing phones existing devices will [46:59] continue operating with the possibly [47:02] compromised or older software of Fleet [47:05] they will use the best Fleet that's [47:06] available to them given the software [47:07] version that they're running I see uh we [47:10] have tremendous uptake on our updates uh [47:13] so um you know more than 90% of our user [47:15] base is using the latest version of iOS [47:17] so that's a good place to be right thank [47:19] you MH go ahead for your for the 10 [47:23] passcode attempts before it Fells out is [47:25] that is that enforced in the SE or is [47:27] that value stored outside of the C it is [47:30] enforced fully in the SCP the SCP has a [47:33] secure monotonically increasing counter [47:35] okay and if uh that counter reaches 10 [47:37] incorrect passcode attempts it will [47:39] simply refuse to use the uid key any [47:41] further for that user key bag okay so [47:44] it's not stored in memory or anything [47:45] like that it's all in set up it's fully [47:47] within the SCP right thank you [47:50] yes with all the research around U [47:54] making fake fingerprints and being able [47:56] to duplicate human fingerprint based on [47:57] like a fingerprint record and you look [47:59] at the OPM breach where all these [48:00] fingerprint records were stolen it seems [48:02] kind of scary that like a touch ID [48:03] sensor someone may be able to to [48:05] reproduce a a fake finger then get into [48:07] a device within the 48 hour window is [48:09] there any thoughts around some sort of [48:11] mitigations to mitigate you know you [48:13] know malicious fingerprint scans or [48:16] maybe even make it configurable to [48:17] reduce that that 48 hour window to [48:18] something a little bit less at least the [48:20] end user Make it [48:25] configurable it's an interesting [48:26] question um I think [48:30] for uh Biometrics in general I think uh [48:34] these uh vulnerabilities are to some [48:36] degree inherent and we do the the very [48:38] best we can with both our sensor and how [48:41] it's used you saw that you know we make [48:43] all the template matching happen in the [48:45] secure Enclave none of that ever touches [48:47] the uh the application processor that [48:49] said we continue to follow um the [48:51] research that's happening in that space [48:53] and uh certainly would continue [48:55] improving as best we can over time thank [49:00] you go ahead hi uh would you be willing [49:04] to talk about the upcoming features of [49:06] watchtower in iOS 10 and a bit of the [49:08] design of that [49:11] structure I'm going to um focus on what [49:14] I talked about [49:16] today I was wondering if you'd be [49:18] willing to talk about any of the [49:19] mechanisms against side Channel attacks [49:21] you might have so in particular em or [49:23] power or [49:24] sound uh you know I'm not sure what of [49:27] that we discuss in the iOS security [49:29] guide uh I think um if uh we don't cover [49:32] that that would be an interesting thing [49:33] to consider adding so please shoot us an [49:35] email and we'll see what we can do go [49:38] ahead yeah I was just curious what's the [49:40] most persistent security issue you face [49:42] with iOS in [49:47] general tough audience [49:52] questions thank you [49:56] [Applause] [49:59] no really don't thank [50:01] you go [50:03] ahead yeah uh I'm coming from the [50:06] Chinese team and where team is new team [50:09] is focus on uh Apple uh secret research [50:14] and uh from last year to now we fed uh [50:18] feedb the some secret problem to Apple [50:23] secret but we have a problem uh because [50:27] we found the secret Apple secret uh feed [50:31] the feedback uh response is too slow so [50:35] and maybe uh one secret problem uh to uh [50:42] about one year so how can we uh solution [50:46] this problem I I I I'm sorry I didn't [50:49] quite follow your question you're saying [50:50] that which part was SL yeah we we fed we [50:53] feed back some uh SEC problem to the uh [50:58] IPO security but the IPO security is the [51:02] response too [51:03] slow I see the question was uh security [51:06] response you know we we get a tremendous [51:08] amount of issues and U overwhelmingly uh [51:11] all of them are answered very quickly uh [51:13] if you have issues that for some reason [51:16] you're having trouble with please send [51:17] another email you should not be [51:18] encountering that kind of [51:20] issue all right folks I think that's all [51:22] we have time for thank you very much for [51:24] coming again [51:27] I really hope you liked what you heard