25
https://trustworthy.systems No Security Without Time Protection We Need a New Hardware-Software Contract! Qian Ge, Yuval Yarom, Gernot Heiser [email protected] | @GernotHeiser APSys’18, Jeju, Korea

No Security Without Time Protection - ts.data61.csiro.au · • Disable data prefetcher • On context switch, perform all architected flush operations: • Intel: wbinvd + invpcid

  • Upload
    lamthu

  • View
    235

  • Download
    0

Embed Size (px)

Citation preview

Page 1: No Security Without Time Protection - ts.data61.csiro.au · • Disable data prefetcher • On context switch, perform all architected flush operations: • Intel: wbinvd + invpcid

https://trustworthy.systems

No Security Without Time Protection We Need a New Hardware-Software Contract!

Qian Ge, Yuval Yarom, Gernot Heiser [email protected] | @GernotHeiser APSys’18, Jeju, Korea

Page 2: No Security Without Time Protection - ts.data61.csiro.au · • Disable data prefetcher • On context switch, perform all architected flush operations: • Intel: wbinvd + invpcid

HW/SW Contract © 2018 Gernot Heiser

The New Year Shock

APSys, Jeju, Korea, Aug'18 2 |

Page 3: No Security Without Time Protection - ts.data61.csiro.au · • Disable data prefetcher • On context switch, perform all architected flush operations: • Intel: wbinvd + invpcid

HW/SW Contract © 2018 Gernot Heiser

Threats

APSys, Jeju, Korea, Aug'18 3 |

Speculation

Timing Channel

An “unknown unknown”

until recently

A “known unknown”

for decades

Page 4: No Security Without Time Protection - ts.data61.csiro.au · • Disable data prefetcher • On context switch, perform all architected flush operations: • Intel: wbinvd + invpcid

HW/SW Contract © 2018 Gernot Heiser

Overview •  What are timing channels? •  Time protection: OS must close microarchitectural channels •  How helpful is present hardware? •  What are the requirements on hardware for closing timing channels? •  Defining the new hardware-software contract – aISA

APSys, Jeju, Korea, Aug'18 4 |

Page 5: No Security Without Time Protection - ts.data61.csiro.au · • Disable data prefetcher • On context switch, perform all architected flush operations: • Intel: wbinvd + invpcid

What are Timing Channels?

Page 6: No Security Without Time Protection - ts.data61.csiro.au · • Disable data prefetcher • On context switch, perform all architected flush operations: • Intel: wbinvd + invpcid

HW/SW Contract © 2018 Gernot Heiser

Timing Channels Information leakage through timing of events •  Typically by observing response latencies or own execution speed

Covert channel: Information flow that bypasses the security policy

APSys, Jeju, Korea, Aug'18 6 |

High Low Trojan encodes

info

Spy observes

Side channel: Covert channel exploitable without insider help

High Low Attacker observes

Victim executes normally

Page 7: No Security Without Time Protection - ts.data61.csiro.au · • Disable data prefetcher • On context switch, perform all architected flush operations: • Intel: wbinvd + invpcid

HW/SW Contract © 2018 Gernot Heiser

Origin of Timing Channels: Temporal Interference

APSys, Jeju, Korea, Aug'18 7 |

High Low

Affect execution speed

Shared hardware

•  Inter-process interference •  Competing access to micro-

architectural features •  not exposed by the ISA •  hidden by the HW-SW contract!

Page 8: No Security Without Time Protection - ts.data61.csiro.au · • Disable data prefetcher • On context switch, perform all architected flush operations: • Intel: wbinvd + invpcid

HW/SW Contract © 2018 Gernot Heiser

Sharing 1: Stateless Interconnect

APSys, Jeju, Korea, Aug'18 8 |

H/W is bandwidth-limited •  Interference during

concurrent access • Generally reveals no data

or addresses • Must encode info into

access patterns • Only usable as covert

channel, not side channel

High Low

Shared interconnect

Memory

Page 9: No Security Without Time Protection - ts.data61.csiro.au · • Disable data prefetcher • On context switch, perform all architected flush operations: • Intel: wbinvd + invpcid

HW/SW Contract © 2018 Gernot Heiser

Sharing 2: Stateful Hardware

APSys, Jeju, Korea, Aug'18 9 |

HW is capacity-limited •  Interference during •  concurrent access •  time-shared access

•  Collisions reveal data or addresses

•  Usable as side channel Cache

High Low

Any state-holding microarchitectural feature: •  cache •  branch predictor •  pre-fetcher state machine

Page 10: No Security Without Time Protection - ts.data61.csiro.au · • Disable data prefetcher • On context switch, perform all architected flush operations: • Intel: wbinvd + invpcid

Time Protection

Page 11: No Security Without Time Protection - ts.data61.csiro.au · • Disable data prefetcher • On context switch, perform all architected flush operations: • Intel: wbinvd + invpcid

HW/SW Contract © 2018 Gernot Heiser

OS Must Enforce Time Protection

High Low

Shared hardware

Preventing interference is core duty of the OS! •  Memory protection is well established •  Time protection is completely absent

APSys, Jeju, Korea, Aug'18 11 |

Page 12: No Security Without Time Protection - ts.data61.csiro.au · • Disable data prefetcher • On context switch, perform all architected flush operations: • Intel: wbinvd + invpcid

HW/SW Contract © 2018 Gernot Heiser

Time Protection: No Sharing of State

High Low

CacheContextSwitch

Flush

Cannot partition on-core caches (L1, TLB, branch predictor, prefetchers) •  virtually-indexed •  OS cannot control

access

Cache

High Low

High Low

Cache

Partition, e.g. page colouring Flushing useless for

concurrent access •  between HW

threads •  between cores •  for stateless

channels

APSys, Jeju, Korea, Aug'18 12 |

Needboth!Needboth!

Page 13: No Security Without Time Protection - ts.data61.csiro.au · • Disable data prefetcher • On context switch, perform all architected flush operations: • Intel: wbinvd + invpcid

HW/SW Contract © 2018 Gernot Heiser

Requirements For Time Protection

APSys, Jeju, Korea, Aug'18 13 |

Timing channels can be closed iff the OS can •  partition or •  reset all shared hardware

On-core state

Off-core state &

stateless HW

Page 14: No Security Without Time Protection - ts.data61.csiro.au · • Disable data prefetcher • On context switch, perform all architected flush operations: • Intel: wbinvd + invpcid

Reality Check: Resetting Intra-Core State

Page 15: No Security Without Time Protection - ts.data61.csiro.au · • Disable data prefetcher • On context switch, perform all architected flush operations: • Intel: wbinvd + invpcid

HW/SW Contract © 2018 Gernot Heiser

Evaluating Intra-Core Channels

High Low

Cache Context Switch

Cache

High Low

Flush

Mitigation on Intel and Arm processors: •  Disable data prefetcher •  On context switch, perform all architected flush operations: •  Intel: wbinvd + invpcid (no targeted L1-cache flush supported) •  Arm: DCCISW + ICIALLU + TLBIALL + BPIALL

APSys, Jeju, Korea, Aug'18 15 |

Page 16: No Security Without Time Protection - ts.data61.csiro.au · • Disable data prefetcher • On context switch, perform all architected flush operations: • Intel: wbinvd + invpcid

HW/SW Contract © 2018 Gernot Heiser

Methodology: Prime & Probe

APSys, Jeju, Korea, Aug'18 16 |

High Low Trojan

encodes info

Input Signal

2.  Touch n cache lines

1.  Fill cache with own data

2. 

3.  Traverse cache, measure execution time

Spy observes

Output Signal

Page 17: No Security Without Time Protection - ts.data61.csiro.au · • Disable data prefetcher • On context switch, perform all architected flush operations: • Intel: wbinvd + invpcid

HW/SW Contract © 2018 Gernot Heiser

Methodology: Channel Matrix

APSys, Jeju, Korea, Aug'18 17 |

Trojan cache footprint (n)

Spy

exe

cutio

n tim

e (t)

Channel Matrix: •  Conditional probability of

observing time, t, given input, n. •  Represented as heat map:

•  bright = high probability •  dark = low probability

Horizontal variation indicates

channel

Page 18: No Security Without Time Protection - ts.data61.csiro.au · • Disable data prefetcher • On context switch, perform all architected flush operations: • Intel: wbinvd + invpcid

HW/SW Contract © 2018 Gernot Heiser

Example: ARM A53 BHB

APSys, Jeju, Korea, Aug'18 18 |

0 1

10-1

10-3

10-2

10-4

10-5400

600

800

1000

Trojan signal

Spy

exec

utio

n tim

e

Branch history buffer (BHB) •  One-bit channel •  All reset operations applied

Channel!

Page 19: No Security Without Time Protection - ts.data61.csiro.au · • Disable data prefetcher • On context switch, perform all architected flush operations: • Intel: wbinvd + invpcid

HW/SW Contract © 2018 Gernot Heiser

Example: Intel Haswell BTB

APSys, Jeju, Korea, Aug'18 19 |

Trojan cache footprint

31000

32000

33000

34000

3500 4000 4500 5000

Tim

e (

cycl

es) datafile using 1:2:3

0.001

0.01

Spy

exec

utio

n tim

e

Branch target buffer (BTB) •  All reset operations applied Channel!

Found residual channels in all recent Intel and ARM processors examined!

Latest Intel ISA addition (IBC) helps, but prohibitive without targeted L1 cache flush operation

Completedatasetathttps://ts.data61.csiro.au/projects/TS/timingchannels/arch-mitigation.pml

Page 20: No Security Without Time Protection - ts.data61.csiro.au · • Disable data prefetcher • On context switch, perform all architected flush operations: • Intel: wbinvd + invpcid

Requirements on Hardware

Page 21: No Security Without Time Protection - ts.data61.csiro.au · • Disable data prefetcher • On context switch, perform all architected flush operations: • Intel: wbinvd + invpcid

HW/SW Contract © 2018 Gernot Heiser

Hardware-Software Contract: ISA

•  The ISA is a purely operational contract •  sufficient to ensure functional correctness •  abstracts away time •  insufficient for ensuring either timing safety or security

•  For security need an abstraction of microarchitectural state •  essential for letting OS provide time protection

Remember: Timing channels can only be closed if all shared hardware state can be partitioned or reset

APSys, Jeju, Korea, Aug'18 21 |

Page 22: No Security Without Time Protection - ts.data61.csiro.au · • Disable data prefetcher • On context switch, perform all architected flush operations: • Intel: wbinvd + invpcid

HW/SW Contract © 2018 Gernot Heiser

New HW/SW Contract: aISA

APSys, Jeju, Korea, Aug'18 22 |

Augmented ISA supporting time protection

For all shared microarchitectural resources: 1.  Resource must be partitionable or resetable 2.  Concurrently shared resource must be partitioned 3.  Resource accessed by virtual address must be reset and

not concurrently accessed –  implies cannot share HW threads across security domains!

4.  Mechanisms must be sufficiently specified to allow OS to partition or reset – must be constant time or of specified, bounded latency

5.  OS must know if resettable state is derived from data, instructions, data addresses or instruction addresses

Page 23: No Security Without Time Protection - ts.data61.csiro.au · • Disable data prefetcher • On context switch, perform all architected flush operations: • Intel: wbinvd + invpcid

HW/SW Contract © 2018 Gernot Heiser

•  Flushing on-core state is not a performance issue: •  no cost when not used •  direct flush cost should for dirty L1-D in the order of 1µs •  direct flush cost for everything else in the order of 1 cycle •  indirect cost should be negligible, if used on security-partition switch –  eg VM switch, 10–100 Hz rate –  no hot data in cache after other partition’s execution

•  Hardware support is essential!

APSys, Jeju, Korea, Aug'18

Cost of Reset

23 |

Page 24: No Security Without Time Protection - ts.data61.csiro.au · • Disable data prefetcher • On context switch, perform all architected flush operations: • Intel: wbinvd + invpcid

HW/SW Contract © 2018 Gernot Heiser

•  Timing channels are a mainstream security threat •  The are based on competition for shared hardware •  This hardware is hidden by the ISA, the present HW-SW contract •  Cannot systematically prevent timing channels based on ISA •  OS cannot provide the required time protection

•  Need a new, security-oriented contract, the aISA •  aISA must expose enough microarchitecture for OS to enforce time protection

APSys, Jeju, Korea, Aug'18

Summary

24 |

Page 25: No Security Without Time Protection - ts.data61.csiro.au · • Disable data prefetcher • On context switch, perform all architected flush operations: • Intel: wbinvd + invpcid

https://trustworthy.systems

Thank you

QianGe,YuvalYarom, Gernot Heiser [email protected] | @GernotHeiser