Introduction |
|
xv | |
|
Chapter 1 iOS Security Basics |
|
|
1 | (14) |
|
iOS Hardware/Device Types |
|
|
2 | (1) |
|
How Apple Protects the App Store |
|
|
2 | (1) |
|
Understanding Security Threats |
|
|
3 | (2) |
|
Understanding iOS Security Architecture |
|
|
5 | (4) |
|
The Reduced Attack Surface |
|
|
5 | (1) |
|
|
6 | (1) |
|
|
6 | (1) |
|
|
7 | (1) |
|
Data Execution Prevention |
|
|
7 | (1) |
|
Address Space Layout Randomization |
|
|
8 | (1) |
|
|
8 | (1) |
|
A Brief History of iOS Attacks |
|
|
9 | (5) |
|
|
9 | (1) |
|
|
10 | (1) |
|
|
10 | (1) |
|
|
11 | (1) |
|
|
12 | (1) |
|
|
13 | (1) |
|
Jailbreakme.com 2 ("Star") |
|
|
13 | (1) |
|
Jailbreakme.com 3 ("Saffron") |
|
|
14 | (1) |
|
|
14 | (1) |
|
Chapter 2 iOS in the Enterprise |
|
|
15 | (32) |
|
iOS Configuration Management |
|
|
16 | (10) |
|
Mobile Configuration Profiles |
|
|
16 | (2) |
|
iPhone Configuration Utility |
|
|
18 | (1) |
|
Creating a Configuration Profile |
|
|
18 | (2) |
|
Installing the Configuration Profile |
|
|
20 | (5) |
|
|
25 | (1) |
|
|
25 | (1) |
|
Applications and Provisioning Profiles |
|
|
26 | (1) |
|
|
26 | (19) |
|
MDM Network Communication |
|
|
27 | (1) |
|
Lion Server Profile Manager |
|
|
28 | (1) |
|
Setting Up Profile Manager |
|
|
29 | (6) |
|
|
35 | (3) |
|
|
38 | (7) |
|
|
45 | (2) |
|
|
47 | (22) |
|
|
47 | (4) |
|
|
48 | (3) |
|
Attacking Data Protection |
|
|
51 | (17) |
|
|
51 | (4) |
|
iPhone Data Protection Tools |
|
|
55 | (1) |
|
Installation Prerequisites |
|
|
55 | (3) |
|
|
58 | (3) |
|
|
61 | (1) |
|
Brute-Force Attacking Four-Digit Passcodes |
|
|
62 | (2) |
|
|
64 | (1) |
|
|
65 | (1) |
|
Decrypting Data Partition |
|
|
66 | (2) |
|
|
68 | (1) |
|
Chapter 4 Code Signing and Memory Protections |
|
|
69 | (38) |
|
Understanding Mandatory Access Control |
|
|
70 | (4) |
|
|
71 | (1) |
|
|
72 | (2) |
|
|
74 | (4) |
|
Understanding the Provisioning Profile |
|
|
74 | (3) |
|
How the Provisioning File Is Validated |
|
|
77 | (1) |
|
Understanding Application Signing |
|
|
78 | (1) |
|
|
79 | (1) |
|
How Code Signing Enforcement Works |
|
|
80 | (9) |
|
Collecting and Verifying Signing Information |
|
|
80 | (4) |
|
How Signatures Are Enforced on Processes |
|
|
84 | (4) |
|
How the iOS Ensures No Changes Are Made to Signed Pages |
|
|
88 | (1) |
|
Discovering Dynamic Code Signing |
|
|
89 | (6) |
|
Why MobileSafari Is So Special |
|
|
89 | (2) |
|
How the Kernel Handles JIT |
|
|
91 | (3) |
|
Attacking Inside MobileSafari |
|
|
94 | (1) |
|
|
95 | (9) |
|
|
96 | (5) |
|
|
101 | (2) |
|
Gaining App Store Approval |
|
|
103 | (1) |
|
|
104 | (3) |
|
|
107 | (32) |
|
Understanding the Sandbox |
|
|
108 | (1) |
|
|
109 | (7) |
|
Understanding the Sandbox Implementation |
|
|
116 | (21) |
|
Understanding User Space Library Implementation |
|
|
117 | (4) |
|
|
121 | (1) |
|
|
121 | (2) |
|
Handling Configuration from User Space |
|
|
123 | (2) |
|
|
125 | (1) |
|
How Profile Bytecode Works |
|
|
126 | (7) |
|
How Sandboxing Impacts App Store versus Platform Applications |
|
|
133 | (4) |
|
|
137 | (2) |
|
Chapter 6 Fuzzing iOS Applications |
|
|
139 | (46) |
|
|
139 | (2) |
|
|
141 | (3) |
|
Mutation-Based ("Dumb") Fuzzing |
|
|
141 | (1) |
|
Generation-Based ("Smart") Fuzzing |
|
|
142 | (1) |
|
Submitting and Monitoring the Test Cases |
|
|
143 | (1) |
|
|
144 | (4) |
|
|
144 | (1) |
|
|
144 | (1) |
|
Testing and Monitoring the Application |
|
|
145 | (3) |
|
Adventures in PDF Fuzzing |
|
|
148 | (5) |
|
|
153 | (2) |
|
Fuzzing with the Simulator |
|
|
155 | (3) |
|
|
158 | (2) |
|
Selecting the Interface to Fuzz |
|
|
158 | (1) |
|
|
158 | (1) |
|
Fuzzing and Monitoring MobileSafari |
|
|
158 | (2) |
|
|
160 | (2) |
|
|
162 | (22) |
|
|
163 | (2) |
|
Focusing on the Protocol Data Unit Mode |
|
|
165 | (2) |
|
|
167 | (1) |
|
Using User Data Header Information |
|
|
167 | (1) |
|
Working with Concatenated Messages |
|
|
168 | (1) |
|
Using Other Types of UDH Data |
|
|
169 | (1) |
|
Generation-Based Fuzzing with Sulley |
|
|
170 | (5) |
|
|
175 | (2) |
|
|
177 | (5) |
|
|
182 | (2) |
|
|
184 | (1) |
|
|
185 | (34) |
|
|
186 | (2) |
|
Object Lifetime Vulnerabilities |
|
|
186 | (2) |
|
Understanding the iOS System Allocator |
|
|
188 | (2) |
|
|
188 | (1) |
|
|
189 | (1) |
|
|
189 | (1) |
|
|
190 | (10) |
|
|
190 | (1) |
|
Learning Alloc/Dealloc Basics |
|
|
191 | (4) |
|
Exploiting Arithmetic Vulnerabilities |
|
|
195 | (3) |
|
Exploiting Object Lifetime Issues |
|
|
198 | (2) |
|
|
200 | (2) |
|
Large Object Allocation and Deallocation |
|
|
201 | (1) |
|
|
201 | (1) |
|
Small Object Deallocation |
|
|
202 | (1) |
|
|
202 | (9) |
|
Obtaining a Predictable Heap Layout |
|
|
202 | (2) |
|
Tools for Debugging Heap Manipulation Code |
|
|
204 | (2) |
|
Exploiting Arithmetic Vulnerabilities with TCMalloc - Heap Feng Shui |
|
|
206 | (5) |
|
Exploiting Object Lifetime Issues with TCMalloc |
|
|
211 | (1) |
|
|
211 | (2) |
|
|
213 | (4) |
|
|
217 | (1) |
|
|
218 | (1) |
|
Chapter 8 Return-Oriented Programming |
|
|
219 | (30) |
|
|
220 | (2) |
|
|
220 | (1) |
|
System Calls Calling Convention |
|
|
221 | (1) |
|
|
222 | (10) |
|
|
224 | (1) |
|
Manually Constructing a ROP Payload |
|
|
225 | (5) |
|
Automating ROP Payload Construction |
|
|
230 | (2) |
|
What Can You Do with ROP on iOS? |
|
|
232 | (3) |
|
|
232 | (3) |
|
Examples of ROP Shellcode on iOS |
|
|
235 | (12) |
|
Exfiltrate File Content Payload |
|
|
235 | (7) |
|
Using ROP to Chain Two Exploits (JailBreakMe v3) |
|
|
242 | (5) |
|
|
247 | (2) |
|
Chapter 9 Kernel Debugging and Exploitation |
|
|
249 | (48) |
|
|
249 | (1) |
|
|
250 | (6) |
|
Kernel Extensions and IOKit Drivers |
|
|
256 | (13) |
|
Reversing the IOKit Driver Object Tree |
|
|
257 | (4) |
|
Finding Vulnerabilities in Kernel Extensions |
|
|
261 | (3) |
|
Finding Vulnerabilities in IOKit Drivers |
|
|
264 | (1) |
|
Attacking through Device Properties |
|
|
265 | (1) |
|
Attacking through External Traps and Methods |
|
|
266 | (3) |
|
|
269 | (27) |
|
Arbitrary Memory Overwrite |
|
|
269 | (1) |
|
Patching a Vulnerability into the Kernel |
|
|
270 | (1) |
|
Choosing a Target to Overwrite |
|
|
271 | (1) |
|
Locating the System Call Table |
|
|
272 | (1) |
|
|
273 | (1) |
|
Uninitialized Kernel Variables |
|
|
274 | (5) |
|
Kernel Stack Buffer Overflows |
|
|
279 | (6) |
|
Kernel Heap Buffer Overflows |
|
|
285 | (1) |
|
Kernel Heap Zone Allocator |
|
|
286 | (5) |
|
|
291 | (2) |
|
Detecting the State of the Kernel Heap |
|
|
293 | (1) |
|
Exploiting the Kernel Heap Buffer Overflow |
|
|
294 | (2) |
|
|
296 | (1) |
|
|
297 | (30) |
|
|
298 | (1) |
|
|
298 | (3) |
|
|
299 | (1) |
|
|
299 | (1) |
|
|
299 | (1) |
|
|
300 | (1) |
|
|
300 | (1) |
|
|
300 | (1) |
|
|
301 | (1) |
|
Understanding the Jailbreaking Process |
|
|
301 | (8) |
|
|
302 | (1) |
|
|
303 | (1) |
|
Jailbreaking the Filesystem |
|
|
303 | (1) |
|
Installing the Untethering Exploit |
|
|
304 | (1) |
|
Installing the AFC2 Service |
|
|
305 | (1) |
|
Installing Base Utilities |
|
|
306 | (1) |
|
|
307 | (1) |
|
|
307 | (2) |
|
Post-Installation Process |
|
|
309 | (1) |
|
Executing Kernel Payloads and Patches |
|
|
309 | (16) |
|
|
309 | (1) |
|
|
310 | (2) |
|
|
312 | (1) |
|
security.mac.proc_enforce |
|
|
312 | (1) |
|
cs_enforcement_disable (kernel) |
|
|
313 | (1) |
|
cs_enforcement_disable (AMFI) |
|
|
314 | (1) |
|
|
315 | (1) |
|
|
316 | (2) |
|
|
318 | (1) |
|
|
319 | (1) |
|
|
320 | (2) |
|
|
322 | (2) |
|
|
324 | (1) |
|
|
324 | (1) |
|
|
325 | (2) |
|
Chapter 11 Baseband Attacks |
|
|
327 | (38) |
|
|
329 | (2) |
|
|
331 | (4) |
|
|
331 | (1) |
|
OpenBTS Installation and Configuration |
|
|
332 | (3) |
|
Closed Configuration and Asterisk Dialing Rules |
|
|
335 | (1) |
|
RTOSes Underneath the Stacks |
|
|
335 | (7) |
|
|
336 | (1) |
|
|
337 | (1) |
|
|
337 | (1) |
|
|
338 | (1) |
|
Dynamic Memory in Nucleus PLUS |
|
|
338 | (2) |
|
|
340 | (1) |
|
|
341 | (1) |
|
|
342 | (6) |
|
Obtaining and Extracting Baseband Firmware |
|
|
343 | (1) |
|
Loading Firmware Images into IDA Pro |
|
|
344 | (1) |
|
Application/Baseband Processor Interface |
|
|
345 | (1) |
|
Stack Traces and Baseband Core Dumps |
|
|
345 | (1) |
|
|
346 | (1) |
|
Static Analysis on Binary Code Like it's 1999 |
|
|
347 | (1) |
|
Specification-Guided Fuzz Testing |
|
|
348 | (1) |
|
|
348 | (14) |
|
A Local Stack Buffer Overflow: AT+XAPP |
|
|
348 | (2) |
|
|
350 | (6) |
|
An Overflow Exploitable Over the Air |
|
|
356 | (6) |
|
|
362 | (3) |
Appendix References |
|
365 | (4) |
Index |
|
369 | |