laying a secure foundation for mobile devices/ · 2015-11-01 · nsa security enhancements ......

45
Laying a Secure Foundation for Mobile Devices Stephen Smalley Trusted Systems Research National Security Agency

Upload: lamngoc

Post on 09-Jun-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

Laying a Secure Foundation for Mobile Devices

Stephen SmalleyTrusted Systems ResearchNational Security Agency

Page 2: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

Trusted Systems ResearchTrusted Systems Research

● Conduct and sponsor research to provide information assurance for national security systems.

● Enabling safe operation in risky or compromised environments.

● Research into cryptographic algorithms and protocols, system analysis and design methods, trust mechanisms, and systems behavior.

● Creators of SE Linux, Xen Security Modules, Linux Kernel Integrity Monitor, and SE for Android.

2

Page 3: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

Our MotivationOur Motivation● Increasing demand to use mobile devices.

● NSA Mobility Program

● Desire to use commodity solutions.● NSA Commercial Solutions for Classified (CSfC)

● Risks posed by currently available solutions.● Exploitation over wireless, radio, NFC, ...

● Data Leakage

● Application privilege escalation

3

Page 4: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

Why It Matters for EveryoneWhy It Matters for Everyone

● Explosion in mobile malware.

● Rapid growth, increasing sophistication.

● Increasing market drivers for mobile device attacks.

● Payment, banking, remote control.

● BYOD trend for corporate/enterprise use.

● Increasing use of mobile platforms in non-traditional venues, including safety-critical.

● It isn't just a problem for government use.

4

Page 5: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

A Step in the Right DirectionA Step in the Right Direction

● NSA Security Enhancements (SE) for Android project

● formerly known as Security-Enhanced (SE) Android

● Identify and address critical gaps in the security of Android.

● Why Android?

● Open source platform: suitable for a reference implementation accessible to anyone.

● Broad market adoption: opportunity to improve the security of a widely used mobile platform.

5

Page 6: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

Android Security ConcernsAndroid Security Concerns

● Weak separation.

● Prone to privilege escalation.

● Lack of support for enforcing organizational security goals.

6

Hardware

Linux

Apps

EmailBrowser

Contacts Phone

Android

Page 7: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

Secure Solutions on AndroidSecure Solutions on Android

● Exposure of secrets.

● Protection of app mechanisms and configurations.

● No guaranteed invocation.

7

Hardware

Linux

Apps

VOIPThin

ClientVPN DAR

Android

Security Concerns

Page 8: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

Building on a Solid FoundationBuilding on a Solid Foundation

● Critical role of operating system protection mechanisms in supporting higher level security goals.

● The Inevitability of Failure: The Flawed Assumption of Security in Modern Computing Environments, 21st NISSC, Oct 1998.

● Flexible Mandatory Access Control (MAC) as a key mechanism

● SE Linux as a well-established foundation for mitigating threats posed by flawed and malicious applications.

8

Page 9: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

SE for Android● Kernel Mandatory Access Control (MAC).

● SELinux-based.● Root exploits are no longer fatal.● Apps can be strongly separated.

● Middleware Mandatory Access Control (MMAC).

● Taking Android permissions out of the hands of users and apps.

9

Page 10: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

SELinux: What is it?

● Mandatory Access Control (MAC) for Linux.

● Enforces a system-wide security policy.● Over all processes, objects, and operations.● Based on security labels.

● Can confine flawed and malicious applications.

● Even ones that run as “root” / uid 0.● Can prevent privilege escalation.

10

Page 11: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

How can SELinux help Android?

● Confine privileged daemons.● Protect from misuse.● Limit the damage that can be done via them.

● Sandbox and isolate apps.

● Strongly separate apps from one another.● Prevent privilege escalation by apps.

● Provide centralized, analyzable policy.

11

Page 12: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

Middleware MAC (MMAC)● Many attacks occur entirely at middleware layer.

● Cannot be addressed via kernel layer MAC.

● SELinux userspace object manager model not readily applicable.

● Binder IPC, multi-stage call chains.

● checkPermission API.

● Implications for SELinux policy.

● Required a separate middleware MAC layer.

12

Page 13: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

MMAC mechanisms● Install-time MAC

● Enforced by PackageManagerService.● Based on app certificate, package name.● Can disable even pre-installed apps.● Linkage to SELinux policy via seinfo tag.

● Permission revocation

● Intent MAC, Content Provider MAC

13

Page 14: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

Effective Against

Root Exploits● Motochopper

● Mempodroid

● GingerBreak

● Exploid

● Zimperlich

● RageAgainstTheCage

● KillingInTheNameOf14

Vulnerable Apps

● Skype

● Lookout Mobile Security

● Opera Mobile

Page 15: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

SE for Android: Security Benefits

15

✔ Strong separation of apps.✔ Prevents privilege escalation by apps.

✔ Enforces organizational security goals.

✔ Protects app mechanisms & configurations. Hardware

SELinux

Apps

SE for Android

ThinClient VOIP VPN DAR

Page 16: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

SE for Android Timeline

16

Jan 6 2012SE forAndroidreleased

Jan 9 2012Googleinvitessubmissionto AOSP

Feb 2012Googlebeginsmerge

Apr 2013Galaxy S4beginsshipping

Mar 2012Samsungcollaborationbegins

Oct 2012Google enablesSELinux inuserspace

Feb 2013SamsungannouncesKNOX withSE for Android

Jul 2013Android4.3released

Page 17: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

Mainline Android Adoption

● 4.1: changes below dalvik, disabled by default.

● 4.2: changes up to middleware, disabled by default.

● 4.3: (released 24 July 2013)

● SELinux support enabled by default● required by the Android 4.3 Compatibility

Definition Document (CDD)● permissive mode, liberal policy

17

Page 18: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

Commercial Adoption

● Samsung Galaxy S4

● Started shipping 26 April 2013.● Reportedly > 20 million units sold already.● Shipped with Android 4.2.2 + SE for Android

changes.● Permissive mode by default.

18

Page 19: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

SE for Android: Residual Risks

19

➢Kernel vulnerability.➢Platform component vulnerability.

➢Loading an unauthorized OS / configuration.

Hardware

SELinux

Apps

SE for Android

ThinClient

VOIP VPN DAR

Page 20: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

Addressing the Risks

● Requires mechanisms outside the scope of what any operating system mechanism can provide.

● Cannot be addressed via SE for Android.

● Also true for SE Linux (or any other secure OS).

● Two key enablers emerged in commodity PC hardware:

● Virtualization

● Trusted Computing

20

Page 21: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

Secure Virtual Platform (SVP)● NSA research program dating back to circa 2002.

● Explored the use of emerging hardware support for virtualization and trusted computing to address these same kinds of concerns for SE Linux.

● Investigated application of virtualization and trusted computing to construct an overall secure system architecture.

21

Page 22: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

Basic Virtualization

22

✔ Guest kernel vulnerability contained to single VM.

✔ Isolated environments via separate VMs.

Hardware

VMM

VM-1

SELinux

Apps

SEAndroid

ThinClient VPN

VM-2

SELinux

Apps

SEAndroid

ThinClient VPN

VM-3

SELinux

Apps

SEAndroid

ThinClient VPN

Security Benefits

Page 23: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

Secure Virtualization

23

✔ Platform component vulnerability contained to single VM.

✔ VM interactions and privileges controlled by MAC policy.

VM-1SELinux

Apps

SEAndroid

ThinClient VPN

Security Benefits

Hardware

VMM

VM-2SELinux

Apps

SEAndroid

ThinClient VPN

VM-3SELinux

Apps

SEAndroid

ThinClient VPN

Page 24: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

Virtualization for Security

24

✔ Driver isolation.✔ Protection of security services.

✔ Assured invocation of security services.

Security Benefits

Hardware

VMM

VM-4

DAR

VM-5

StorageDriver

VM-1SELinux

Apps

SEAndroid

ThinClient

VM-2

VPN

VM-3

WirelessDriver

Page 25: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

Virtualization insteadof SE for Android?

● Virtualization does not eliminate the need for a secure OS.

● Unable to enforce security goals within guest OS.

● Does not address need for controlled sharing.

● Does not protect the data as it is being processed.

● Still need to protect shared services & control plane.

● Limited scalability and flexibility.

25

Page 26: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

Trusted Computing

26

✔ Verifiable, trustworthy report of loaded software & configuration.

✔ Protection of long term secrets from leakage or misuse by unauthorized software.

✔ Hardware roots of trust.

Security Benefits

Hardware

SELinux

Apps

SE for Android

ThinClient VOIP VPN DAR

TPMRTM

Page 27: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

Trusted Computing &Virtualization

27

✔ Extend same benefits to each VM.

✔ Scalable measurement & attestation.

✔ Runtime integrity measurement of VMs.

Security Benefits

Hardware

VMM

RTM TPM

VM-2SELinux

Apps

SEAndroid

vTPM

VM-1LKIM

vTPM

Page 28: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

Trusted Computing instead ofSE for Android?

● Trusted Computing ≠ Secure Computing.● Does not remove vulnerabilities in design or

implementation.● Provides a way to validate system assumptions for

secure computing.

● Did the device boot the expected secure OS?● Is the secure OS running in the expected state?

● Not a substitute for a secure OS.

28

Page 29: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

SVP Technology Transfer● Some SVP concepts and code contributed to

open source.● Xen Security Modules / Flask, vTPM, Linpicker● openAttestation

● Partial realization in commercial products and solutions.● XenClient XT product● AFRL SecureView solution

29

Page 30: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

Guest OS(Linux,Windows)

XenClient XT/SecureViewXenClient XT/SecureView

30

Hardware

Xen with Xen Security Modules / Flask

Dom0 Guest OS(Linux,Windows)

NILFVMNetworkDriver

Domain

UIVM

RTM TPM

Page 31: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

SVP: Going Mobile● Originally implemented on PC hardware.

● Able to leverage PC hardware primitives for virtualization and trusted computing.

● Including TPM, RTM, IOMMU capabilities.

● Directly transferred to laptops.● Being leveraged in real solutions.

● Successfully ported to x86-based tablets.

31

Page 32: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

Tablet (x86) ArchitectureTablet (x86) Architecture

32

Hardware

Xen with XSM

Dom0 SE for Android

VPN

INE WirelessDriverDomain

VPN2

RTM TPM

Page 33: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

SVP for ARM: Virtualization

● Para-virtualization / microkernel hybrids● OKL4, Integrity

● ARM Virtualization Extensions● Xen, Linux KVM

33

Page 34: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

OKL4-based Architecture

34

Page 35: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

Concerns with ARM virtualization

● Lack of mature, deployed virtualization solutions for ARM.

● Need for OEM cooperation.● Frequent lack of IOMMU support.● Static configuration of VMs.

35

Page 36: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

SVP for ARM: Trusted Computing

● TrustZone as the likely foundation.● Becoming more commonly available.● Provides support for isolated execution and

protected storage.● Possible to tie to hardware root of trust.● Possible place to host a MTM.

36

Page 37: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

TrustZone

Source: www.arm.com/products/processors/technologies/trustzone.php

37

Page 38: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

Concerns with TrustZone● No measured launch or attestation for secure

monitor and secure world OS.

● Lack of widely available MTM implementations with standard APIs.

● Lack of / unclear state of separation of trusted applications.

● Lack of public details on many aspects of implementation important to security.

● Variability across hardware.

38

Page 39: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

TrustZone instead of SE for Android?

● Cannot address all security concerns of interest.

● Cannot protect data and processing in the normal world.

● Similar to discussion of virtualization.● Would lead to functional and API bloat of

secure world, making it less secure.● Also requires secure OS functionality for the

secure world.

39

Page 40: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

TrustZone instead of Virtualization?

● Only supports secure world vs non-secure world partitioning.

● Cannot support multiple VM architecture for security.

● Would likewise end up pushing too much functionality into TrustZone secure world.

40

Page 41: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

TrustZone Correctly Applied● Measured launch for normal world

hypervisor and control plane.● Provide MTM functionality.● Safe place for runtime integrity monitoring

of hypervisor.● Protect the underpinnings of a system with

virtualization and secure OS functionality.

41

Page 42: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

Putting it all together

Normal World

Hardware with TrustZone + Virtualization Extensions support

Secure World

Hypervisor with MAC Secure Monitor

MTMIntegrity

Monitoring

SE Android

VPN

INE WirelessDriverDomainVPN2

42

Secure OS

Page 43: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

Reaching the Goal● Processor, SOC and device makers:

● Make virtualization and trusted computing primitives ubiquitously available.

● Enable use of virtualization and trusted computing by third party developers.

● Mobile platform developers:

● Include secure OS functionality.● Leverage virtualization and trusted computing for

security.● Enable third party developers to leverage this

functionality / extend to applications.43

Page 44: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

Avoiding the PC malware plague

● PC industry did not address these threats early.● Plagued with malware as a result.● Trapped in a quagmire of legacy / compatibility

requirements.● Don't make the same mistake for mobile devices.

● Device OEMs and mobile OS developers have an opportunity to do it right.

● Mobile device ecosystem makes it possible to still change.

44

Page 45: Laying a Secure Foundation for Mobile Devices/ · 2015-11-01 · NSA Security Enhancements ... Critical role of operating system protection ... Can prevent privilege escalation. 10

Questions?● My email: [email protected]● SE for Android project:

http://selinuxproject.org/page/SEAndroid● Public SE for Android list: Send “subscribe

seandroid-list” to [email protected].

● NSA SE for Android team: [email protected]

45