Top Banner
iOS App Security apple.com/business/site/docs/iOS_Security_Guide.pdf Jean-Luc Watson
35

Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

Apr 24, 2019

Download

Documents

vunhu
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

iOS App Securityapple.com/business/site/docs/iOS_Security_Guide.pdf

Jean-Luc Watson

Page 2: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

Apple’s Security Model

Page 3: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

Apple’s Security Model

Page 4: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

Apple’s Security Model

anything else

Page 5: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

Apple’s Security Model

Key assumption: system security is

maintainedanything else

Page 6: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

App Verification

Page 7: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

App Code Signing is Mandatory

● App writers must sign up for an Apple Developer account ($100/yr)

● In return, they receive a code-signing certificate issued by Apple

facebook

Apple Root Authority

Page 8: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

App Code Signing is Mandatory

● App writers must sign up for an Apple Developer account ($100/yr)

● In return, they receive a code-signing certificate issued by Apple

● Signed apps are subject to review before being placed in the App Store

and certificates are checked at load time by the OS

facebook

Apple Root Authority

review load-time verification

Page 9: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

Result

● All code running on an iOS device is signed with a certificate issued by

Apple

● If the OS is secure, what is the benefit of forcing code signing?

Page 10: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

Result

● All code running on an iOS device is signed with a certificate issued by

Apple

● If the OS is secure, what is the benefit of forcing code signing?

○ Attribution

○ Restricts dynamic linking to libraries sharing same team identifier

○ Barrier to third-party, unreviewed software

○ Prevents malicious changes to a signed app

Page 11: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

Result

● All code running on an iOS device is signed with a certificate issued by

Apple

● If the OS is secure, what is the benefit of forcing code signing?

○ Attribution

○ Restricts dynamic linking to libraries sharing same team identifier

○ Barrier to third-party, unreviewed software

○ Prevents malicious changes to a signed app

● (Old) vulnerability: Masque Attack

Page 12: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

Runtime Protection

Page 13: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

iOS Sandbox

● Primary isolation mechanism

● Access to other apps and system resources strictly controlled by iOS

interfaces

● Apps run exclusively in user mode and the OS is read-only

● How should apps execute privileged actions?

Page 14: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

iOS Sandbox

● Primary isolation mechanism

● Access to other apps and system resources strictly controlled by iOS

interfaces

● Apps run exclusively in user mode and the OS is read-only

● How should apps execute privileged actions?

○ “Normal” OS (e.g. Linux): setuid bit

○ Problem?

Page 15: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

iOS Sandbox

● Primary isolation mechanism

● Access to other apps and system resources strictly controlled by iOS

interfaces

● Apps run exclusively in user mode and the OS is read-only

● How should apps execute privileged actions?

○ “Normal” OS (e.g. Linux): setuid bit

○ Problem? Privilege escalation!

Page 16: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

Entitlements

● Key-value pairs set at compile time, signed with developer certificate:

<key>inter-app-audio</key><true/>

● Verified by iOS API calls without requiring privileged execution

● Why can’t an app give itself all entitlements?

Page 17: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

Entitlements

● Key-value pairs set at compile time, signed with developer certificate:

<key>inter-app-audio</key><true/>

● Verified by iOS API calls without requiring privileged execution

● Why can’t an app give itself all entitlements?

○ Apple review process will (hopefully) notice the attempt

Page 18: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

ARM Execute Never (XN)

● Bit ensures memory in app data pages will never be executed by

processor

● Mitigates dynamically loaded shellcode (e.g. buffer overflow)

● Does not prevent Return-Oriented Programming

● Effectively limits app to static, signed code. Is this a problem?

Page 19: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

ARM Execute Never (XN)

● Bit ensures memory in app data pages will never be executed by

processor

● Mitigates dynamically loaded shellcode (e.g. buffer overflow)

● Does not prevent Return-Oriented Programming

● Effectively limits app to static, signed code. Is this a problem?

○ Huge issue for JITs (Safari), but a dangerous capability

○ Solution: Apple-only entitlement that can mmap one WX page

Page 20: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

Sharing Functionality

Page 21: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

I can’t post on FB without swiping

combine address spaces?

Page 22: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

I can’t post on FB without swiping

Gboard can see all my Facebook data + FB can see everything I’ve typed :(

combine address spaces?

Page 23: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

I can’t post on FB without swiping

Gboard can still see everything I’ve typed on my device :((

Talk back and forth over IPC?

Page 24: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

Extensions

Instantiate Extension

Page 25: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

Extensions

Instantiate Extension

Separate address space/files

Same permissions

Page 26: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

Extensions

Instantiate Extension

Separate address space/files

Same permissionsLimited Sandbox: no network access and restricted APIs

Page 27: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

Remote Interaction

Page 28: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

Secure Accessory Pairing

HomeKit Public/Private Keys

Accessory Public/Private Keys

Page 29: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

Secure Accessory Pairing MFi custom Apple IC authenticates access

HomeKit Public/Private Keys

Accessory Public/Private Keys

Page 30: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

Secure Accessory Pairing

HomeKit Public/Private Keys

Accessory Public/Private Keys

Secure Remote Password protocol

Code0 4 1 52 5 2 7

Key exchange

Page 31: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

Secure Accessory Pairing

HomeKit Public/Private Keys

Accessory Public/Private Keys

HKDF session keys encrypt further communication

Page 32: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

Remote Access

● Convenient secure medium to transfer encrypted data:

● iOS device proxies a signed challenge from the accessory MFi chip to

obtain a certificate issued by iCloud

○ Used to authorize iOS users to access the accessory and to connect

to iCloud servers

Page 33: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

Remote Access

● Convenient secure medium to transfer encrypted data:

● iOS device proxies a signed challenge from the accessory MFi chip to

obtain a certificate issued by iCloud

○ Used to authorize iOS users to access the accessory and to connect

to iCloud servers

● What are the risks of this registration process?

Page 34: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)

Questions and Feedback?

Page 35: Jean-Luc Watson iOS App Security - inst.eecs.berkeley.educs261/fa18/presentations/11_14.pdfApp Code Signing is Mandatory App writers must sign up for an Apple Developer account ($100/yr)