Mobile Trusted Computing

Fruct 2011 7.11 2011 Jan-Erik Ekberg

Partly joint work with N.Asokan, K Kostiainen, E Reshtova Platform Security applications

• To achieve secure processing in heterogenous environments, trust roots are needed • Without enforcement, guarantees are hard to give • A good security infrastructure leaves room for Open OS with un-trusted components without sacrificing OS MAC overall security • Compared to perimeter security, the trusted computing base is minimized Secure execution • vulnerability analysis is still an environment for integral part of the system, but not at run-time, credentials security is achieved by “updates only”. • Privacy needs to be also guaranteed by policy, not

just by mechanism. This is common-place, e.g. in HW support communication networks. - integrity - secure storage - secure processing - isolated memories?

4 © 2010 Nokia ETISS 2010.ppt / J-EE Enforcement mechanisms have a history

• Hardware-support for platform security −Cambridge CAP etc. (~1970s) / Multics  Extended to Trusted Execution Environments HW

• Hardware-assisted secure storage • Secure and authenticated boot −TCPA and TCG (late 1990s) HW +OS −Academic research projects (mid 1990s)  Extended (private secure storage for applications)  Adapted (normal vs. developer mode in MSSF)

• Permission-based platform security architectures −VAX /VMS privileges for user (~1970s) OS  Adapted for applications −Code signing (mid 1990s)  Borrowed for application installation

5 © 2010 Nokia ETISS 2010.ppt / J-EE HW Enablers / ASIC support (high-level view) Hardware support for platform security

Public key E.g., serial hash number

Trust root Base identity

Crypto Library Start of boot code Boot sequence (ROM) Basic elements in TCB for platform software immutable storage

7 Nokia Research Center 2011 Secure bootstrapping

Code certificate Boot code hash

Validate and Trust root execute

Crypto Library

Boot sequence Secure boot (ROM) Ensure only authorized boot TCB for platform software image can be loaded

Launch platform boot code

8 Nokia Research Center 2011 Identity binding

Identity certificate Code certificate Base identity Boot code hash Assigned identity

E.g., IMEI, link-layer addresses, …

Trust root Base identity

Validate and accept Crypto Library assigned ID

Boot sequence (ROM) Secure boot Securely assign different TCB for platform software identities to the device

Launch platform boot code

9 Nokia Research Center 2011 Trusted execution

Identity certificate Code certificate Boot code hash Base identity Validate and execute Assigned identity Code certificate

TrEE code hash Isolated execution

Trust root Base identity TrEE

Basis for secure Crypto Library Device key external storage

Boot sequence TrEE code Secure boot (ROM)

TCB for platform software

Launch platform boot code TrEE API

10 Nokia Research Center 2011 Authorized code execution, isolated from the OS Secure state

Identity certificate Code certificate Base identity Boot code hash

Assigned identity Code certificate Securing TrEE sessions, TrEE code hash authenticated boot

Trust root Base identity Configuration TrEE register(s)

Crypto Library Device key Non-vol. memory TrEE code or Boot sequence counter Secure boot (ROM)

TCB for platform software Rollback protection for persistent secure storage Launch platform boot code TrEE API 11 Nokia Research Center 2011 Integrity-protected state within the TrEE Device authentication, secure provisioning, Device authentication attestation External trust root Identity certificate Code certificate Boot code hash Base identity Device certificate Assigned identity Code certificate Identity TrEE code hash Public device key

Trust root Base identity Configuration TrEE register(s)

Crypto Library Device key Non-vol. memory TrEE code or Boot sequence counter Secure boot (ROM)

TCB for platform software

Launch platform boot code TrEE API

12 Nokia Research Center 2011 Prove device identity or properties to external verifier Summary of hardware mechanisms

• Secure boot: Ensure only authorized boot image can be loaded • Authenticated boot: Measure and remember loaded image

• Identity binding: Securely assign identities to the device

• Secure storage: Protect confidentiality and integrity of data • Isolated execution: Run authorized code isolated from OS

• Device authentication: Prove device identity to external verifier • Remote attestation: Prove device configuration to verifier

13 Nokia Research Center 2011 Hardware security architectures (mobile)

• TI M-Shield and ARM TrustZone

• Augments central processing unit −“Secure processor mode”

• Isolated execution with on-chip RAM −Very limited (<10kB)

• Secure storage −Typically with write-once E-fuses

• Usually no counters or non-volatile memory −Cost issue

14 Nokia Research Center 2011 Hardware security architectures (TCG)

• Trusted Platform Module (TPM) −Standalone processor on PCs −Isolated execution for pre-defined algorithms −Arbitrary isolated execution with DRTM −Platform Configuration Registers (PCRs) −Monotonic counters

• Mobile Trusted Module (MTM) −Mobile variant of TPM −Can be implemented using e.g. TrustZone or M-Shield −Discussed further…

15 Nokia Research Center 2011 Uses of hardware security

• Recap from features −Secure/authenticated boot −Identity binding/device authentication −Secure storage −Remote attestation

• Uses of hardware security (device manufacturer) −Device initialization −DRM −Subsidy lock

• How can developers make use of hardware security?

16 Nokia Research Center 2011 SW/OS support Adoption of security mechanisms

Operators Regulators End users

~2002 Hardware-based mechanisms

~2001 ~2005 ~2008 ~2010 ~2011

18

Nokia Research Center 2011 Software-based mechanisms Open mobile platforms

• Java ME ~2001 • Android ~2007 −For “feature phones” −Linux-based OS −3 billion devices! −App development in Java −Not any more supported by the latest • MeeGo ~2010 −Linux-based OS • Symbian ~2004 −App development in C (Qt) −First “” OS −MSSF −App development in C++ (Qt) • Windows Phone ~2010 −Windows (CE) based kernel − End-user app development in Silverlight / .NET

19 Nokia Research Center 2011 Mobile platform security model

• 3.5 phases 1. Distribution 2. Installation 3. Run-time enforcement 4. ++ off-line enforcement

• Common techniques −Code signing −Permission-based access control architecture − (User involvement in assigning permissions) − App R&D by local “installation” / “opened device”

20 Nokia Research Center 2011 Distribution Software package

• Developer produces a software package −Code −Manifest

• May submit to a signer for a Developer trusted signature Signed • Distributed to device via on-line software stores (typically) package Software package

21 Nokia Research Center 2011 Installation Software Signed software package package • Installer consults local policy and trusted signature − Identify application − Grant requested privileges

• Installer may prompt user Installer

Policy

22 Nokia Research Center 2011 Run-time enforcement

• Monitor checks if subject has privileges for requested access Monitor resource

• Resource may perform principal additional checks

• User may be prompted to authorize access

23 Nokia Research Center 2011 1. OS bootstrapping

Is hardware security used to secure OS bootstrapping?

Symbian Java ME Android MSSF Windows Phone Secure Not No? Authenticated boot: “Normal No? boot applicable mode” vs “Developer mode”

24 Nokia Research Center 2011 2. Application identification

How are applications identified at install and runtime?

Symbian Java ME Android MSSF Windows Phone Install and run- Install: Install: Install: Install: time: • Signing key • Signing key • Software • Software • Protected • Midlet source source range SID and attributes Runtime: (signing key) VID • Unix UID • Package No IPC between (managed) • Package name installed • UID name (locally applications (unmanaged) unique) Runtime: • Software source • Package name

25 Nokia Research Center 2011 • Application ID

3. Application update

How is a new version of an existing application verified?

Symbian Java ME Android MSSF Protected SID, VID: Signed midlets: “Same origin” policy “Same or higher • trusted signature • same-origin policy origin” policy

Rest: Unsigned midlets: • no controls • user prompt

26 Nokia Research Center 2011 4. Permission granularity

How finely is access control defined?

Symbian Java ME Android MSSF Windows Phone Fixed set of Fine-grained Fine-grained Fine-grained Fixed set “capabilities” permissions permissions resource-tokens of capabilities (21) (many) (112) (8++) Linux access Four Linux access control “chambers” control Android and MSSF: Each application is installed under a separate Linux UID

27 Nokia Research Center 2011 5. Permission assignment (basis)

Least Privilege Chamber Standard Rights Basis for granting permissions? Elevated Rights Trusted Computing Base

Symbian Java ME Android MSSF Windows Phone 4 categories Trusted 4 Trusted signatures Chambers map signatures for protection to stakeholders Trusted protection levels Local policy file (MS / OEM / signature (also domains operator / user) user prompts) 4 permission Capabilities defined modes by developer (least- privilege prot.) User Blanket, System, Session, Normal (automatic) Restricted, One-shot, Dangerous (user-granted) Manufacturer No Signature (developer-controlled)

28 Nokia Research Center 2011 SystemOrSignature (Google-controlled) 6. Permission assignment (user prompting)

Symbian Java ME Android Windows Phone Capability Function group Permission group Capability description description description description • 21 capabilities • 15 groups • 11 groups

E.g., LOCATION, NETWORK, E.g., NetAccess ACCOUNTS, … E.g.,Read user data, PhoneCall Use network, Access Location, … positioning, …

What is shown to the user?

29 Nokia Research Center 2011 7. Permission assignment (timing)

When are permissions assigned to a principal?

Symbian Java ME Android MSSF Windows Phone Install-time Run-time Install-time Install-time Install-time assignment prompts assignment assignment assignment Run-time privilege shedding possible Symbian and MSSF: Permissions of app loading a DLL is a subset of permissions of DLL

30 Nokia Research Center 2011 8. Application integrity

How is the integrity of installed applications protected?

Symbian Java ME Android MSSF Windows Phone Dedicated Java sandboxing Java sandboxing IMA, Smack Chamber- directory dependent Linux access Offline sandboxing control protection with (.NET, OS EVM and TrEE permissions)

Integrity Measurement Architecture (IMA) • Store hash of file (in extended attribute security.ima) and verify on launch Extended Validation Module (EVM) • Store MAC of all extended attributes (in security.evm) and verify on access

31 Nokia Research Center 2011 9. Access control policy

How does a resource declare the policy for accessing it? How is it enforced?

Symbian Java ME Android MSSF Windows Phone Declare in code [System Declare in Declare in Declare in resources] manifest manifest manifest Enforced by IPC Enforced by VM framework or Enforced by VM Enforced by Enforced by VM code Smack or via libcreds

32 Nokia Research Center 2011 10. Application data protection

How can applications protect the confidentiality and integrity of their data?

Symbian Java ME Android MSSF Windows Phone Runtime: Runtime: Runtime: Runtime: Runtime: • private • private • dedicated • fine-grained • private file directory record stores UID data caging store • file system Off-line: Off-line: • private • private secure secure storage storage

33 Nokia Research Center 2011 GP TEE introduction

TEE System Architecture 0.4 TEE Internal API Specification 0.27

Architecture pictures (from spec.)

REE: Rich Execution Environment TEE: Trusted Execution Environment

Architecture, software view

TEE internal API spec. domain HW option pictures (from spec.)

Implementation can be - A processor environment - A separate core on a chip - A co-processor (?) Specification overview

The TEE API defines the driver interface for - send code to the secure environment - execute code that has been sent to the secure environment - includes concepts for control (sessions, instances ..)

The TEE Internal API defines an API for - interfacing secure code (TA:s) to the framework - application session control, instance, lifecycle - STDLIB – like functionality - Cryptographic subroutines - RSA - AES in many modes, e.g. authenticated encryption - Hash functions - randomness - Secure storage

MTM introduction Requirements (v.1):

• Platform Security is an enabler • Required by MTM1 use cases (2005)‏ • Regulatory approval (for “open” platforms)‏ • Platform and/or Application Integrity • IMEI lock / Subsidy lock (i.e., SIM-lock)‏ • Device Authentication • Media consumption and protection (DRM)‏ • Robust DRM Implementation • Confidential data management (user , corporation)‏ • SIMLock / Device Personalization • Remote Attestation (RA) / Corporate access (VPN)‏ • Secure Channel between Device and UICC • Application authentication, authorization, accounting • Secure Software Download • Reliable PKI (key management, usage, etc)‏ • Device Owner Data Protection and Privacy • But also for • Mobile Ticketing / • Device stability • Malware protection In TCG / TPM, by tradition, user control • General trustworthiness of the platform and user privacy is in focus. In the • Theft and copy “management” “mobile” domain these considerations are important, but not in dominance!

40 © 20011 Nokia J-EE The 3(4) main targets of MTM

1) Allow MTM to be implemented using a legacy trust environment (TEE)

2) Add secure boot. Authenticated boot is not enough for the majority of the MTM v1 use cases

3) Make the MTM footprint small. [ Consequence of (1) ]

An evident requirement is to maintain as much of TPM compatibility as possible. PC/Mobile convergence in essence motivated the whole MTM work. MTM v1 overview

•Mandates only core functionalities of TPMv1.2: [target: small size] • Binding and sealing • Signing and key certification • Attestation (AIK may be fixed)‏ -> but delegation, migration, DAA, memory services are at large optional

•MTM v1 adds: [targets: integrator/manufacturer control, deployability] • Secure boot (wrong measurement -> boot is aborted)‏ • (SW) Functionality rather than HW. Device binding through roots of trust • The concept of MTM instances. For stakeholders: Integrator, Operator, User

42 © 20011 Nokia J-EE MTM vs. TPM commands TPM_Init, TPM_Startup, TPM_SaveState, TPM_SelfTestFull TPM_ContinueSelfTest TPM_GetTestResult. TPM_SetOwnerInstall, TPM_OwnerSetDisableTPM_PhysicalEnable TPM_PhysicalDisable, TPM_PhysicalSetDeactivated TPM_SetTempDeactivated TPM_SetOperatorAuthTPM_TakeOwnership TPM_OwnerClear, TPM_ForceClearTPM_DisableOwnerClear. TPM_DisableForceClear TSC_PhysicalPresence TSC_ResetEstablishmentBit, TPM_GetCapability, TPM_SetCapability, TPM_GetCapabilityOwner TPM_GetAuditDigest TPM_GetAuditDigestSigned TPM_SetOrdinalAuditStatus, TPM_FieldUpgrade, TPM_SetRedirection, TPM_ResetLockValue, TPM_Seal, TPM_Unseal, TPM_UnBind, TPM_CreateWrapKey, TPM_LoadKey2, TPM_GetPubKey, TPM_Sealx, TPM_CreateMigrationBlob, TPM_ConvertMigrationBlob, TPM_AuthorizeMigrationKey, TPM_MigrateKey, TPM_CMK_SetRestrictions, TPM_CMK_ApproveMA, TPM_CMK_CreateKey, TPM_CMK_CreateTicket, TPM_CMK_CreateBlob, TPM_CMK_ConvertMigration, TPM_CreateMaintenanceArchive, TPM_LoadMaintenanceArchive, TPM_KillMaintenanceFeature, TPM_LoadManuMaintPub, TPM_ReadManuMaintPub, TPM_SHA1Start, TPM_SHA1Update, TPM_SHA1Complete, TPM_SHA1CompleteExtendTPM, TPM_Sign, TPM_GetRandom, TPM_StirRandom, TPM_CertifyKey, TPM_CertifyKey2, TPM_CreateEndorsementKeyPair, TPM_CreateRevocableEK, TPM_RevokeTrust, TPM_ReadPubek, TPM_OwnerReadInternalPub, TPM_MakeIdentity, TPM_ActivateIdentity, TPM_Extend, TPM_PCRRead, TPM_Quote, TPM_PCR_Reset, TPM_Quote2, TPM_ChangeAuth, TPM_ChangeAuthOwner, TPM_OIAP, TPM_OSAP, TPM_DSAP, TPM_SetOwnerPointer, TPM_Delegate_Manage, TPM_Delegate_CreateKeyDelegation, TPM_Delegate_CreateOwnerDelegation, TPM_Delegate_LoadOwnerDelegation, TPM_Delegate_ReadTable, TPM_Delegate_UpdateVerification, TPM_NV_DefineSpace, TPM_NV_WriteValue, TPM_NV_WriteValueAuth, TPM_NV_ReadValue, TPM_NV_ReadValueAuth, TPM_KeyControlOwner, TPM_SaveContext, TPM_LoadContext, TPM_FlushSpecific, TPM_GetTicks, TPM_TickStampBlob, TPM_EstablishTransport, TPM_ExecuteTransport, TPM_ReleaseTransportSigned, TPM_CreateCounter, TPM_IncrementCounter, TPM_ReadCounter, TPM_ReleaseCounter, TPM_ReleaseCounterOwner, TPM_DAA_Join, TPM_DAA_Sign, TPM_EvictKey, TPM_Terminate_Handle, TPM_SaveKeyContext, TPM_LoadKeyContext, TPM_SaveAuthContext, TPM_LoadAuthContext, TPM_DirWriteAuth, TPM_DirRead, TPM_ChangeAuthAsymStart, TPM_ChangeAuthAsymFinish, TPM_Reset TPM_OwnerReadPubek, TPM_DisablePubekRead, TPM_LoadKey Add: MTM_InstallRIM, MTM_LoadVerificationKey, MTM_VerifyRIMCert, MTM_VerifyRIMCertAndExtend, MTM_IncrementBootstrapCounter

43 © 20011 Nokia J-EE MTM implementation size - The sizes are w.o. crypto primitives (e.g. RSA)‏ - The size excludes platform-dependent, but sizable code parts, including upload code verification, state decryption / encryption, .. - As a “monoblock”, the code amounts to around 20kB compiled

44 © 20011 Nokia J-EE MTM performance with a TEE

+ Logic runs at full processor speed (332 MHz, ARM 9)‏ - Invocation time of the secure environment, validation of “collection” (1ms)‏ - Penalty caused by state protection (~10ms) (further optimization possible)‏

45 © 20011 Nokia J-EE MTM device binding and

configurations TEE domain? Root-of-Trust Device boot for Enforcement Root-of-Trust Root-of-Trust [ depending on the MTM for Verification for Storage instance, the “entity” that [code integrity] [state integrity, guarantees e.g. isolation, rollback protection] secure boot abort, and the ( Root-of-Trust existence of the other RoT:s ] for measurement) ‏ Root-of-Trust MRTM MRTM Mobile remote owner trusted module for Reporting [ management from outside the [remote device (manufacturer / operator) ] attestation] transitive trust MLTM MLTM MLTM Mobile local owner trusted module [management at the device using TPM commands (user, owner) ]

46 © 20011 Nokia J-EE MTM static data

• counterStorageProtectId – storage protect counter Rollback • counterRIMProtectId – protect RIM certs protection • counterBootstrap - initial boot version

Constrained • verifiedPCRs - PCRs only modifiable by RIM certs PCRs (RIM

update only) •loadVerificationKeyMethods – (root load, integrity check root data, auth(s)) ‏ •InternalVerification key - key for InstallRIM - certs • verificationAuth (auth. For InstallRIM) ‏ Secure boot support •loadVerificationRootKeyEnabled (in STANY_FLAGS) ‏

•integrityCheckRootData - hash of root verification key Trust root

•AIK - (attestation key, if Keys preconfigured)

47 ©• 20011SRK Nokia J -EE - storage root key‏ MTM verification keys In persistent state checkRootData Public-key certificates, used for ( RVAI) the “stakeholder model”, i.e. external authorization for PCR Binding, e.g. public key hash updates (secure boot) and “root” verification counter increments key Binding = RSA sign. Validated inside the MTM, on verification key verification key load.

RIM certificate Verification key “permissions” =Verification key constraints = (attribute cert) usable when key is loaded: validated at load:

- Increment bootstrap counter - Signed by parent key - Validate other verification keys - Counter binding - Validate RIM certificates - (vendor extensions) - (vendor extensions) - Note: No PCR binding

MTM RIM certificates RIM = reference integrity metric Attribute certificates, used for the explicit activity of constrained PCR updates (secure boot).

RIM certificate Validated inside the MTM, on (attribute cert) use. The successful verification of a RIM certificate typically implies a PCR update

RIM certificate “action” = RIM certificate constraints = implied on successful load: validated at load:

- Increment given PCR - Signed by parent key - RIM certificate includes - Counter binding PCR extension value - PCR (composite) binding - (vendor extensions) - (vendor extensions)

MTM secure boot overview with TEE (1) “First”, the root of trust for enforcement sets up the MTM with the legacy TEE

Processor with TEE Environment provided hardware-assisted RTE isolation from the OS. Dedicated RAM Execution environment Trust root 1) Install (signed) code, provide “self-measurements” legacy secret

0) Signature boot validation MTM code 2)Install data for MTM code, MTM NV state secret decrypt inside TEE

Encrypted for the TEE MTM secure boot overview with TEE (2) “Second”, secure boot with MTM commences

Processor with TEE RTE Execution environment Trust root MTM code Verification Key 2) Set up trust chain for validation Verification Key

RVAI secret MTM state RIM cert PCRs 3) Update PCR using RIM cert. RTS RTR

4) On successful PCR update, launch boot the measured code, on error “abort”

Verification keys and Initial boot-loader RIM certificates RTV Verification Key can be stored / received on-demand, integrity Verification Key guaranteed by RIM cert external authorization 1) Find the verification keys and RIM cert matching the measurement 0) measure

Next component to boot MTM going forward Environment • TEE API standardization is ongoing in Global Platform Device Committee (internal and external TEE APIs). This was not available in 2005.

• TPM specification is transitioning to TPM2

• MTM (and TPM) are not really being used – MTM is not even widely deployed like TPMv1.2.

Additional use cases and requirements have been publicised • Most new MTM use cases have a strong legacy aspect: Banking, Vending machines, Id:s, Health care…

• Implication: There is a need to support legacy security algorithms for applications. MPWG has distilled this to support for (open) remote provisioning of algorithms. Execution of algorithms is also needed, as is algorithm use of MTM/TPM secrets and state, especially platform binding (PCRs)

52 © 20011 Nokia J-EE ObC & TEEs & eSE:s & NFC On-board Credentials

54 © 2011 Nokia Research Center On-board Credentials architecture Credential Credential issuer issuer

OS Application

Credentials Manager Available for TrEE experimentation! Credential Credential program program

Interpreter

Kostiainen, Asokan, Ekberg and Rantala. “On-board Credentials with Open Provisioning”. ASIACCS 2009.

55 Nokia Research Center 2011 Secure environments overview - mobile Overview of the current “development state” of HW-originated platform security services – Operator and SIM services And NFC may be wave that breaks the status quo OMA

Security enablers / service API Service API ETSI

OS APIs like PKCS#11, PC/SC TSS

Provisioning GP Card specification GP Card spec < ->MTM2 & use, key mgmt ISO 7816 TCG “TLV” VM JavaCard Proprietary (ObC)  JavaCard?

Application Proprietary, or GP Card Spec. provisioning GP TEE Client API Function & use implementation varies - Smart card Application Proprietary GP Device Committee (future spec.) API technology often used? OS Proprietary, e.g. MultOS None, proprietary , hypervisor

Hardware Smart Cards / Processor Secure Environments (TEE) TPM / MTM Secure Elements (SE) NFC and mobile secure environments

UI Applications

LLCP R/W JSR-177 / PKCS#11 / MTM / PC/SC / Credential manager

NFC stack

NFC HW Embedded SE SIM SE TEE

SWP/HCI

57 Nokia Research Center 2011 … so can we make this work?

Nokia Device Rating User account Certification engine Payment GW Transport Authority ObC NFC

300 ms

58 Nokia Research Center 2011 Conclusions

security −Requirements, regulations, user expectations −Early adaptation of hardware security mechanisms • Platform security architecture −Many features borrow or adapted. Code Signing & Permissions −No direct SW/HW APIs. MTM / TPM? • Future −Security services (Credit Cards, Banking, Ticketing, Loyalty) are driving a new wave of interest, mostly driven by NFC −The intersection between HW & SW is still clearly underdeveloped

Kostiainen, Reshetova, Ekberg and Asokan. “Old, New, Borrowed, Blue: A Perspective on Evolution of Mobile Platform Security Architectures”. CODASPY 2011.

59 Nokia Research Center 2011