asia-17-gorka-cache side channel attack exploitability and … · 2018-05-11 · enclave llc...

72
Cache Side Channel Attack: Exploitability and Countermeasures Gorka Irazoqui Xiaofei (Rex) Guo, Ph.D. girazoki *noSPAM* wpi.edu xiaofei.rex.guo*noSPAM* tetrationanalytics.com

Upload: others

Post on 15-May-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

CacheSideChannelAttack:ExploitabilityandCountermeasures

Gorka IrazoquiXiaofei (Rex)Guo,Ph.D.girazoki *noSPAM*wpi.edu

xiaofei.rex.guo*noSPAM*tetrationanalytics.com

Page 2: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

WhoareWe?

• GorkaIrazoqui• PhDcandidateinWPI• InternatIntelinsummer2016• Focusonmicro-architecturalattacks

Page 3: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

WhoareWe?

• Xiaofei (Rex)Guo• TechnicalleadatCiscoTetration Analytics

• Visibilitytoeverythingindatacenterinrealtime• Automatedanddynamicpolicygenerationandenforcement

• WorkedatIntelSecurityCenterofExcellenceandQualcommProductSecurityInitiative• IoT andmobileplatformsecurity,infrastructuresecurity,and

applicationsecurity• PhDfromNewYorkUniversity

Page 4: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

Wedon’tspeakforouremployer.Alltheopinionsandinformationhereareourresponsibilityincludingmistakesandbadjokes.

Disclaimer

Page 5: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •
Page 6: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •
Page 7: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

“Youmustbekidding,cacheattacksarenotpractical!”

Page 8: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

“Youmustbekidding,cacheattacksarenotpractical!”

Page 9: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

“Youmustbekidding,cacheattacksarenotpractical!”

Page 10: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

“Youmustbekidding,cacheattacksarenotpractical!”

Page 11: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

“Youmustbekidding,cacheattacksarenotpractical!”

Page 12: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

FeasibilityTrendIntel,Spark,AMD|Linux|OpenSSLAES

Page 13: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

FeasibilityTrendIntel,Spark,AMD|Linux|OpenSSLAES

Intel|Linux|OpenSSLRSA

Page 14: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

FeasibilityTrendIntel,Spark,AMD|Linux|OpenSSLAES

Intel|Linux|OpenSSLRSA

Intel(Cross-core)|Linux(deduplication)|GnuPGRSA

Page 15: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

FeasibilityTrend

Intel(Cross-Core)|Linux(nodeduplication)|GnuPGRSA

Intel,Spark,AMD|Linux|OpenSSLAES

Intel|Linux|OpenSSLRSA

Intel(Cross-core)|Linux(deduplication)|GnuPGRSA

Page 16: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

FeasibilityTrend

Intel(Cross-Core)|Linux(nodeduplication)|GnuPGRSA

Intel,Spark,AMD|Linux|OpenSSLAES

Intel|Linux|OpenSSLRSA

Intel(Cross-core)|Linux(deduplication)|GnuPGRSA

AMD(crossCPU)|Linux|OpenSSLAESandGnuPGElGamal

Page 17: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

FeasibilityTrend

Intel(Cross-Core)|Linux(nodeduplication)|GnuPGRSA

Intel,Spark,AMD|Linux|OpenSSLAES

Intel|Linux|OpenSSLRSA

Intel(Cross-core)|Linux(deduplication)|GnuPGRSA

AMD(crossCPU)|Linux|OpenSSLAESandGnuPGElGamalARM(crosscore/CPU)|Android|BouncyCastleAES

Page 18: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

Functionality

Page 19: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

LLCasaSideChannel?• Caches:fastaccessmemories• WhywouldanattackeruseLLCascovertchannel?

• Cross-core• Inclusiveness• High resolution

Page 20: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

• Setassociative:cachedividedinn-waysets• Locationinthecachedeterminedbyphysicaladdress

CacheArchitecture

Cachetag Set Byte

Offset

OffsetPhysicalPage

VirtualPage

MMU

S0S1

Sn

Cache

00001

....

....

....

tag

tag

tag

B0B0

B0

Bn

Bn

Bn

.

.

.

Page 21: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

• Requirement1:deduplication• Identicalread-onlymemory

pagesareshared• Attackerandvictimaccessthe

sameaddress• LinuxandKVM(KSM),Vmware

(TPS)andAndroid(Zygote)• Requirement2:flush

instruction(e.g.,clflush inx86)• CVE2014-3356:Vmware

enableddeduplicationbydefault

Flush+ReloadAttack

Page 22: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

• Attackerflushesacachedmemorylocation

Flush+ReloadAttackCache

Page 23: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

• Attackerflushesacachedmemorylocation

Flush+ReloadAttack

Flush

Cache

Page 24: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

• Attackerflushesacachedmemorylocation

• Victimaccesses/doesnotaccess

Flush+ReloadAttackCache

Access

Page 25: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

• Attackerflushesacachedmemorylocation

• Victimaccesses/doesnotaccess

• Attackerre-accessesmemorylocation• Fastaccesstime->victim

accessed• Slowaccesstime->victimdidnot

access

Flush+ReloadAttack

Reload

Cache

Page 26: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

• Pros:• Lownoise:focusononeline,

noisyprocessneedstofillanentireset

• ApplicableacrossCPUsockets!FlushinstructioninvalidatesmemoryinotherCPUs

• Worksinnon-inclusivecaches• Cons:

• Requirementmightbemetinsomescenarios

• Canonlyrecoverstaticallyallocateddata

Flush+ReloadAttackSummary

Page 27: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

Evict+ReloadAttack

11

• Noflushinstruction?• AttackerneedstoevictdatafromLLC• Attackercanusehugepages• Physicaladdressselectsthesetto

occupy

Page 28: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

Evict+ReloadAttack

Evict

Cache• Noflushinstruction?• AttackerneedstoevictdatafromLLC• Attackercanusehugepages• Physicaladdressselectsthesetto

occupy• Attackerevicts(fillsset)

Page 29: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

Evict+ReloadAttack

Evict

Cache• Noflushinstruction?• AttackerneedstoevictdatafromLLC• Attackercanusehugepages• Physicaladdressselectsthesetto

occupy• Attackerevicts(fillsset)

Page 30: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

Evict+ReloadAttack

Cache

Access

• Noflushinstruction?• AttackerneedstoevictdatafromLLC• Attackercanusehugepages• Physicaladdressselectsthesetto

occupy• Attackerevicts(fillsset)• Victimaccesses/doesnotaccess

Page 31: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

Evict+ReloadAttack

Reload

Cache• Noflushinstruction?• AttackerneedstoevictdatafromLLC• Attackercanusehugepages• Physicaladdressselectsthesetto

occupy• Attackerevicts(fillsset)• Victimaccesses/doesnotaccess• Attackerreloads

• Fastaccesstime->victimaccessed• Slowaccesstime->victimdidnotaccess

Page 32: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

• Pros:• Applicableinprocessorswithoutflushinstruction(e.g.mostARM

processors)

• Cons:• Canonlytargetstaticallyallocatedmemory• DealwithLLCslices(undocumented)• Onlyworkswithinclusivecaches• OnlyworksinthesameCPUsocket

Evict+ReloadAttackSummary

Page 33: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

• Nosharedmemorypages?• Attackercanknowthesetutilized

bythevictim

• AttackerPrimes

Prime+ProbeAttack

Prime

Cache

Page 34: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

• Nosharedmemorypages?• Attackercanknowthesetutilized

bythevictim

• AttackerPrimes• Victimaccesses/notaccesses

Prime+ProbeAttack

Cache

Access

Page 35: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

• Nosharedmemorypages?• Attackercanknowthesetutilized

bythevictim

• AttackerPrimes• Victimaccesses/notaccesses• Attackerre-accesses

• Fastaccesstime->victimaccessed

• Slowaccesstime->victimdidnotaccess

Prime+ProbeAttack

Probe

Cache

Page 36: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

• Pros• Doesnotneedsharedmemory!(Broaderimpact)• Cantargetstaticanddynamicallyallocatedmemory!

• Cons:• NoisierthanFlush+ Reload• DealingwithLLCslices(undocumented)• Onlyworkswithinclusivecaches• OnlyworksinthesameCPUsocket• Needtoidentifythetargetset

Prime+ProbeAttackSummary

Page 37: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

Howtoretrieveinformation?MontgomeryladderRSA

P=0x7fffc480Physicaladdress

FlushandReload

P

Cache

Page 38: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

Howtoretrieveinformation?

FlushandReloadCache

MontgomeryladderRSA

P=0x7fffc480Physicaladdress

Page 39: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

Howtoretrieveinformation?

FlushandReloadCache

MontgomeryladderRSA

P=0x7fffc480Physicaladdress

Page 40: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

Howtoretrieveinformation?

FlushandReload

P

Cache

MontgomeryladderRSA

P=0x7fffc480Physicaladdress

Page 41: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

Howtoretrieveinformation?

FlushandReload

P

Cache

MontgomeryladderRSA

P=0x7fffc480Physicaladdress

Page 42: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

Howtoretrieveinformation?

PrimeandProbeCache

MontgomeryladderRSA

P=0x7fffc480Physicaladdress

Page 43: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

Howtoretrieveinformation?

PrimeandProbeCache

P

MontgomeryladderRSA

P=0x7fffc480Physicaladdress

Page 44: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

Howtoretrieveinformation?

PrimeandProbeCache

MontgomeryladderRSA

P=0x7fffc480Physicaladdress

Page 45: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

AttackComparison

Flush+Reload Evict+Reload Prime+Probe

RequireMemoryDeduplication

Y Y N

Requireflushinstruction

Y N N

Attackmemory type

static static static +dynamic

Noise low low high

Page 46: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

Applicability

Page 47: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

• VMsshareunderlyinghardware• Hardwareisolationisusuallynot

provided• ExampleRSAinAmazonEC2[INCI16]• Pros:

• OwnvirtualizedOS.Accesstotimersorhugepages

• Ifdeduplication enabled,both attacksareapplicable

• Cons:• Requiresco-residencyofVMs• Highamountofnoise

IaaS/PaaSCloudInfrastructures

Hardware

VMM

GuestOS#1 GuestOS#2

VM VM

SpyVictim

Page 48: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

• Howtofindco-residency?• Useavailableinformation!• ProfilethetargetLLCaccesses• Doesthecachetracematchthetracewe

expect?• Ifyes,co-residency• Ifno,openmoreVMs

• Othermechanismsutilizememorybuslockingattacks

• ExampleRSAexponentiationseasilydistinguishable

IaaS/PaaSCloudInfrastructureshttprequest

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 110000

50

100

150

200

250

timeslot

Rel

oad

time

DecryptionStart

First SecretExponent (dp)

Second SecretExponent (dq)

GuestOS#2

VM

Spy GuestOS#1

VM

Victim

Page 49: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

Demo:AESKeyRecoveryAcrossVMs• WeutilizeKVMhypervisor• ServerusingT-tableAES(T-tables

shared)• Serverencryptingplaintextwith

unknownkey• Attackerrequestsdecryptionsand

recoversthekey• WecheckwhethertheentriesoftheT-

tableshavebeenused• WeXORwiththeciphertext afterdoing

statisticstogetthekey

0x00

Page 50: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

• AttackerembedsJSintothewebsite• Victimaccessesthewebsite• Victim’sbrowserexecutestheJS• Example:Incognitobrowsingprofiling[OREN15]• Pros:

• Noneedtofindco-residenttarget• Attackexecutedinlocalmachine(although

sandboxed)

• Cons:• FlushandReloadcannotbeapplied• Finegraintimershardtoachieve

BrowserJavascript

Hardware

www.yyyyy.com

Page 51: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

• SmartphoneapplicationsarelogicallyisolatedbytheOS

• However,aswithTEEs,allapplicationsutilizethehardwarecaches

• Micro-architecturalattackslookasinnocentbinaries,astheyonlyperformtimedmemoryaccesses

• Example:AESkeystealacrossapps[LIPP16]

SmartPhoneApplications

Hardware

Page 52: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

SmartPhoneApplications• Pros:

• Deduplication isgenerallyused(e.g.Android)

• Easydeployment

• Cons• Flush instructionhastobeenabledby

SoC (onlySamsunS6fornow)• PseudoRandomReplacementpolicies

(reverseengineered)• Devicedependent algorithms (e.g.

non-inclusivecachesorlockdown)

Page 53: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

TrustedExecutionEnvironment• Trustedexecutionenvironments

designedtoachieveisolationfromuntrustedprocesses

• Butbothtrustedanduntrustedenvironmentsaccesssamehardwarecaches!

• Enclavetoenclaveorhosttoenclaveattacksarepossible

• Example:TrustZoneAESkeysteal[BRM15]

• Example:IntelSGXRSAkeysteal[SCW17]

TEEEnclave

LLC

Untrustedprocess

DRAM

Encrypted NonEncrypted

NonEncrypted

NonEncrypted

Page 54: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

• Pros• Higherresolution:TheOScanbe

malicious!morefinegrainresources(includingscheduling)

• Noneedtofindco-residenttarget• Limitednoise:maliciousOScan

interruptprocessesafter(virtually)everymemoryaccess

• Cons• FlushandReloadnotapplicable

(deduplicationdisabled)

TrustExecutionEnvironment

Prime

Cache

Page 55: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

• Pros• Higherresolution:TheOScanbe

malicious!morefinegrainresources(includingscheduling)

• Noneedtofindco-residenttarget• Limitednoise:maliciousOScan

interruptprocessesafter(virtually)everymemoryaccess

• Cons• FlushandReloadnotapplicable

(deduplicationdisabled)

TrustExecutionEnvironment

Cache

Access

Page 56: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

• Pros• Higherresolution:TheOScanbe

malicious!morefinegrainresources(includingscheduling)

• Noneedtofindco-residenttarget• Lownoise:maliciousOScaninterrupt

processesafter(virtually)everymemoryaccess

• Cons• FlushandReloadnotapplicable

(deduplicationdisabled)

TrustExecutionEnvironment

Interrupt

Cache

Probe

Page 57: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

Countermeasures

Page 58: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

DesignCacheLeakageFreeCode• Secretindependentinstructionaccesses• Secretindependentdataaccesses• Identificationofvariablesthatcontaininformationrelatedto

thesecret(manualinspection,taintanalysis,etc.)• Obtaincachetimingtracestocorrelatewiththesecret

variablestomeasuretheleakage

Collectcachetiming

informationCorrelation

Identifysecret

dependentaccess

Design

Page 59: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

DesignCacheLeakageFreeCodeCVE-2016-7439

Page 60: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

DesignCacheLeakageFreeCode

secretdependentinstructionaccess

CVE-2016-7439

Page 61: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

DesignCacheLeakageFreeCode

Secretindependentinstructionaccess

CVE-2016-7439

Page 62: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

DesignCacheLeakageFreeCode

Secretindependentinstructionaccess

Secretdependentdataaccess

CVE-2016-7439

Page 63: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

DesignCacheLeakageFreeCode

Secretindependentinstructionaccess

Secretindependentdataaccess

Page 64: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

PageColoring• AvoidingcollisionsintheLLC• LocationinLLCdeterminedbyphysicaladdress• Giveeachuseracolor(addressbits)

00xxxxxx

01xxxxxx

10xxxxxx

11xxxxxx

DRAM

c

LLCPhysicaladdress

Users

Page 65: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

CacheAllocationTechnology• IntelCATprovideshardwareframeworktolockthecache• AllowsOS/hypervisortomarkcachewaysasun-evictable• Attackercannotinfluencevictim’scacheaccesses• Modifyhypervisortosupportmorelockpartitions[LIU16]

Lock

Cache

Page 66: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

CacheAllocationTechnology• IntelCATprovideshardwareframeworktolockthecache• AllowsOS/hypervisortomarkcachewaysasun-evictable• Attackercannotinfluencevictim’scacheaccesses• Modifyhypervisortosupportmorelockpartitions[LIU16]

CachePrime

Page 67: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

CacheAllocationTechnology• IntelCATprovideshardwareframeworktolockthecache• AllowsOS/hypervisortomarkcachewaysasun-evictable• Attackercannotinfluencevictim’scacheaccesses• Modifyhypervisortosupportmorelockpartitions[LIU16]

CacheProbe

Page 68: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

BehaviorDetection• HardwarePerformanceCounters(HPCs)cantrackhardware

events(e.g.LLCmisses)• LLCattacksleaveacleartraceintermsofcachemisses/hits• Hypervisor/OStracksthiseventstodetectunusualbehavior• Detectioncanbeimprovedbyinspectingmemoryaccess

HardwareHPCs

GuestOS(Process) GuestOS(Process)

Hypervisor (OS)Detection

Page 69: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

CountermeasureComparison(Requirements)

LeakageFreeCode

PageColoring IntelCAT BehaviorDetection

Require sourcecodechange

Y N N N

Require OS(hypervisor)update

N Y Y Depends

Require newhardware

N N Y N

Page 70: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

CountermeasureComparison(Coverage)

LeakageFreeCode

PageColoring IntelCAT BehaviorDetection

IaaS/PaaS Y Y Depends Y

Javascript inbroswer

Y Depends Depends Y

Smartphone Y Y Depends Y

TEE Y N N N

Page 71: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

KeyTakeaways• Cache attacks are complex but a real threat!• Flush+Reload, Evict+Reload, Prime+Probe• IaaS/PaaS, web browsers, smartphones, TEE,...What

else?• Call to action:

• Application level: introduce cache leakage free code design• Hypervisor/OS level: page coloring for cache isolation• System level: use software to leverage hardware features (Intel

CAT, performance counters)

Page 72: asia-17-gorka-Cache side channel attack exploitability and … · 2018-05-11 · Enclave LLC Untrusted process DRAM Encrypted Non Encrypted Non Encrypted Non Encrypted • Pros •

[INCI16]Inci,M.,Gulmezoglu,B.,Irazoqui,G.,Eisenbarth,T.,Sunar,B.CacheAttacksEnableBulkKeyRecoveryontheCloud.CHES2016

[OREN15]Oren,Y.,Kemerlis,V.,Sethumadhavan,S,Keromytis,A.TheSpyintheSandbox:PracticalCacheAttacksinJavaScriptandtheirImplications.ACMCCS2015

[BRM15]Brumley,B.CacheStorageAttacks.CT-RSA2015[SCW17]Schwarz,M.,Weiser,S.,Gruss,D.,Maurice,C.,Mangard,S.Malware

GuardExtension:UsingSGXtoConcealCacheAttacks.Arxiv 2017[LIPP16]Lipp,M.,Gruss,D.,Spreitzer,R.,Maurice,C.,Mangard,S.

ARMageddon:CacheAttacksonMobileDevices.USENIX2016[LIU16]Liu,F.,Yarom,Y.,Mckeen,F.,Rozas,C.,Heiser,G.,LeeR.CATalyst:

Defeatinglast-levelcachesidechannelattacksincloudcomputing.HPCA2016

References