SlideShare una empresa de Scribd logo
1 de 32
Descargar para leer sin conexión
Bletchley 2018.01.19 1
https://www.youtube.com/watch?
v=L1N1P2zxaZE
§ Discover Date: 2018.01.03
§ Threat
§  Adversary who can execute low
privilege code can read
unpermitted memory region
§ Impact
§  Meltdown: Most Intel processors
§  Spectre: Intel, AMD, and ARM
processors
§ Reason
§  Inconsistence between processor
architecture and
microarchitecture (cache)
§  Lack of permission checking
when CPU optimization
2
§ Disclosure by
§  Meltdown
§  Jann Horn (Google Project Zero),
§  Werner Haas,Thomas Prescher (Cyberus Technology),
§  Daniel Gruss, Moritz Lipp, Stefan Mangard, Michael Schwarz (Graz
University of Technology)
§  Spectre
§  Jann Horn (Google Project Zero)
§  Paul Kocher + Daniel Genkin (University of Pennsylvania and
University of Maryland), Mike Hamburg (Rambus), Moritz Lipp
(Graz University of Technology), andYuvalYarom (University of
Adelaide and Data61)
§  Website
§  https://meltdownattack.com/
3
§  CVE-2017-5753 - bounds check bypass (Spectre)
§  CVE-2017-5715 - branch target injection (Spectre)
§  CVE-2017-5754 - rogue data cache load (Meltdown)
4
•  Frontend
•  Fetch and Decode
•  Execution Engine
•  Reorder Buffer
•  Execution Unit
5
§  Once the data dependency is satisfied, the instructions are put into
Execution Units for execution
§  In order to fully utilize execution units, out-of-order execution is
used in most modern processors
§  Instruction can execute in advanced, even the previous instruction is not
yet finished.
§  In normal case,
§  Execution unit calculates and keeps the effect of this instruction.
§  Until all previous instructions finished, this instruction is retired, and
committing it’s result.
§  In error occurs,
§  The executing result will be discarded.
§  Even though the execution result may not commit to architecture,
the state of microarchitecture is already changed.
§  Cache state
6
§  Speculative execution is one kind of out-of-order execution
§  Once a conditional branch instruction whose direction depends
on preceding instructions whose execution has not completed
yet.
§  CPU makes a prediction as to the path that the program will
follow, and speculatively execute instructions along the path.
§  Predict corrects, the instructions are retired and committed
§  Predict fails, the execution result is then discarded.
§  Even though the execution result may not commit to
architecture, the state of microarchitecture is already changed.
7
§  Cache side-channel attacks exploit timing differences that are
introduced by the caches
§  Meltdown and Spectre take Microarchitectural Side-Channel
Attacks to uncover data in the microarchitecture
§  Several Side Channel Attacks
§  Evict+Time
§  Prime+Probe
§  Flush+Reload
8
§  Flush+Reload attacks work on a single cache line granularity.
§  These attacks exploit the shared, inclusive last-level cache.
§  An attacker frequently flushes a targeted memory location
using the clflush instruction.
§  By measuring the time it takes to reload the data, the attacker
determines whether data was loaded into the cache by another
process in the meantime.
9
§  array is an attacker-controllable data
§  Access time
§  Hit
§  Miss
§  256 accesses help discover one byte data
Array[61*
cache_line_size ]
10
§  Exploit out-of-order execution features in
processors
§  Transfer hidden data from cache via Cache
Side Channel Attack
11
§  The content of an attacker-chosen memory location, which is
inaccessible to the attacker, is loaded into a register.
§  A transient instruction accesses a cache line based on the
secret content of the register.
§  The attacker uses Flush+Reload to determine the accessed
cache line and hence the secret stored at the chosen memory
location.
12
§  Transient instruction
§  Instructions which should never executing
§  CPU executes it via out-of-order execution
§  Change the microarchitecture state of the processors
13
§  Line 3 is never executing
§  CPU stealthy executing
line 3 in advance
§  Execution result will be
abandoned
§  But cache state is already
changed
14
§  An traversal of probe array can be made to record time to
access each element in probe array
§  Data is 84
15
§  Meltdown POC
§  https://github.com/IAIK/meltdown
§  Consists of 5 demo program
§  A first test to access other process’ memory
§  Breaking KASLR
§  Reliability test
§  Read physical memory 
§  Dump the memory
§  Core library - libkdump
16
§ Statistic time to access
cached/non-cached
data
§ Calculate threshold
17
§ libkdump_read calls
§  libkdump_read_tsx()
§  libkdump_read_signal_handler()
to read memory
§ Call to MELTDOWN to trigger
out-of-order
§ Invoke flush_reload() to reveal
data value from cache
18
§  Since memory in rcx is invalid, the exception will arise – line 50
§  Line 51 – 53 will be executed in an out-of-order manner
§  Part of probe array rbx is loaded to cache, thus reveals value of rcx
19
§  Flush + Reload
§  Check if the value is in cache
20
§  Reconstructing a photo with Meltdown
§  https://www.youtube.com/watch?v=L1N1P2zxaZE
21
§  Exploit processors’ speculative
execution and branch prediction
feature
§  Discover cache data via Cache Side
Channel Attack
22
1.  Mistrain the processor so that it will later make an
exploitably erroneous speculative prediction
2.  Speculatively executes instructions that transfer confidential
information from the victim context into a microarchitectural
side channel
3.  Recovered the confidential data from cache
23
§  Pretrain
§  make program enter this condition check many times
§  Adversary can chose malicious x for accessing unpermitted data, e.g. kernel
space memory
§  Since
§  array1_size is not in cache, CPU is delayed to read the value
§  Branch predictor beliefs the branch will taken, thus speculative execute the code in
branch with malicious x
§  In the end, the execution result will be discarded, but still remains in cache
§  Similar to Meltdown, Flush+Reload to recover the confidential data
No Cache
No
Cache
Cache
24
§  Spectre POC
§  https://github.com/crozone/SpectrePoC
§  provided by Erik August's gist
25
§  Make 5 train runs with 1 attack run
§  Mistrain branch predictor
26
§  Victim function
§  When x is larger than array1_size, the code will speculative
execute
§  Change the cache state
27
§  Calculate the time needed to access memory
§  Determine if it is in the cache
28
29
30
§  handling, we catch the exception effectively occurring
after executing the transient instruction sequence,
and with exception suppression, we prevent the exception
from occurring at all and instead redirect the control
flow after executing the transient instruction sequence
31
§  The Branch Target Buffer(BTB) keeps a mapping from
addresses of recently executed branch instructions to
destination addresses
32

Más contenido relacionado

Más de Hacks in Taiwan (HITCON)

【HITCON FreeTalk 2021 - SolarWinds 供應鏈攻擊事件分析】
【HITCON FreeTalk 2021 -  SolarWinds 供應鏈攻擊事件分析】【HITCON FreeTalk 2021 -  SolarWinds 供應鏈攻擊事件分析】
【HITCON FreeTalk 2021 - SolarWinds 供應鏈攻擊事件分析】Hacks in Taiwan (HITCON)
 
【HITCON FreeTalk 2018 - Spectre & Meltdown 漏洞的修補策略與 risk mitigation】
【HITCON FreeTalk 2018 - Spectre & Meltdown 漏洞的修補策略與 risk mitigation】【HITCON FreeTalk 2018 - Spectre & Meltdown 漏洞的修補策略與 risk mitigation】
【HITCON FreeTalk 2018 - Spectre & Meltdown 漏洞的修補策略與 risk mitigation】Hacks in Taiwan (HITCON)
 
【HITCON FreeTalk 2018 - 從晶片設計角度看硬體安全】
【HITCON FreeTalk 2018 - 從晶片設計角度看硬體安全】【HITCON FreeTalk 2018 - 從晶片設計角度看硬體安全】
【HITCON FreeTalk 2018 - 從晶片設計角度看硬體安全】Hacks in Taiwan (HITCON)
 
【HITCON FreeTalk】HITCON 2017 下半年活動介紹
【HITCON FreeTalk】HITCON 2017 下半年活動介紹【HITCON FreeTalk】HITCON 2017 下半年活動介紹
【HITCON FreeTalk】HITCON 2017 下半年活動介紹Hacks in Taiwan (HITCON)
 
【HITCON Hackathon 2017】 TrendMicro Datasets
【HITCON Hackathon 2017】 TrendMicro Datasets【HITCON Hackathon 2017】 TrendMicro Datasets
【HITCON Hackathon 2017】 TrendMicro DatasetsHacks in Taiwan (HITCON)
 
HITCON TALK 技術解析 SWIFT Network 攻擊
HITCON TALK 技術解析 SWIFT Network 攻擊 HITCON TALK 技術解析 SWIFT Network 攻擊
HITCON TALK 技術解析 SWIFT Network 攻擊 Hacks in Taiwan (HITCON)
 
HITCON TALK 台灣駭客協會年度活動簡介
HITCON TALK 台灣駭客協會年度活動簡介HITCON TALK 台灣駭客協會年度活動簡介
HITCON TALK 台灣駭客協會年度活動簡介Hacks in Taiwan (HITCON)
 
Hacker as a maker 如何利用 mtk 7688 設計出超炫的 ctf 決賽戰場燈控效果
Hacker as a maker 如何利用 mtk 7688 設計出超炫的 ctf 決賽戰場燈控效果Hacker as a maker 如何利用 mtk 7688 設計出超炫的 ctf 決賽戰場燈控效果
Hacker as a maker 如何利用 mtk 7688 設計出超炫的 ctf 決賽戰場燈控效果Hacks in Taiwan (HITCON)
 
2015 資安從業人員的寶(鬼)島求生
2015 資安從業人員的寶(鬼)島求生2015 資安從業人員的寶(鬼)島求生
2015 資安從業人員的寶(鬼)島求生Hacks in Taiwan (HITCON)
 

Más de Hacks in Taiwan (HITCON) (18)

【HITCON FreeTalk 2021 - SolarWinds 供應鏈攻擊事件分析】
【HITCON FreeTalk 2021 -  SolarWinds 供應鏈攻擊事件分析】【HITCON FreeTalk 2021 -  SolarWinds 供應鏈攻擊事件分析】
【HITCON FreeTalk 2021 - SolarWinds 供應鏈攻擊事件分析】
 
【HITCON FreeTalk 2018 - Spectre & Meltdown 漏洞的修補策略與 risk mitigation】
【HITCON FreeTalk 2018 - Spectre & Meltdown 漏洞的修補策略與 risk mitigation】【HITCON FreeTalk 2018 - Spectre & Meltdown 漏洞的修補策略與 risk mitigation】
【HITCON FreeTalk 2018 - Spectre & Meltdown 漏洞的修補策略與 risk mitigation】
 
【HITCON FreeTalk 2018 - 從晶片設計角度看硬體安全】
【HITCON FreeTalk 2018 - 從晶片設計角度看硬體安全】【HITCON FreeTalk 2018 - 從晶片設計角度看硬體安全】
【HITCON FreeTalk 2018 - 從晶片設計角度看硬體安全】
 
【HITCON FreeTalk】Supply Chain Attack
【HITCON FreeTalk】Supply Chain Attack【HITCON FreeTalk】Supply Chain Attack
【HITCON FreeTalk】Supply Chain Attack
 
【HITCON FreeTalk】HITCON 2017 下半年活動介紹
【HITCON FreeTalk】HITCON 2017 下半年活動介紹【HITCON FreeTalk】HITCON 2017 下半年活動介紹
【HITCON FreeTalk】HITCON 2017 下半年活動介紹
 
【HITCON Hackathon 2017】 TrendMicro Datasets
【HITCON Hackathon 2017】 TrendMicro Datasets【HITCON Hackathon 2017】 TrendMicro Datasets
【HITCON Hackathon 2017】 TrendMicro Datasets
 
HITCON TALK 技術解析 SWIFT Network 攻擊
HITCON TALK 技術解析 SWIFT Network 攻擊 HITCON TALK 技術解析 SWIFT Network 攻擊
HITCON TALK 技術解析 SWIFT Network 攻擊
 
HITCON TALK ATM 金融攻擊事件解析
HITCON TALK ATM 金融攻擊事件解析HITCON TALK ATM 金融攻擊事件解析
HITCON TALK ATM 金融攻擊事件解析
 
HITCON TALK 產業視野下的 InfoSec
HITCON TALK 產業視野下的 InfoSecHITCON TALK 產業視野下的 InfoSec
HITCON TALK 產業視野下的 InfoSec
 
HITCON TALK 台灣駭客協會年度活動簡介
HITCON TALK 台灣駭客協會年度活動簡介HITCON TALK 台灣駭客協會年度活動簡介
HITCON TALK 台灣駭客協會年度活動簡介
 
HITCON CTF 導覽
HITCON CTF 導覽HITCON CTF 導覽
HITCON CTF 導覽
 
Ctf hello,world!
Ctf hello,world! Ctf hello,world!
Ctf hello,world!
 
Hacker as a maker 如何利用 mtk 7688 設計出超炫的 ctf 決賽戰場燈控效果
Hacker as a maker 如何利用 mtk 7688 設計出超炫的 ctf 決賽戰場燈控效果Hacker as a maker 如何利用 mtk 7688 設計出超炫的 ctf 決賽戰場燈控效果
Hacker as a maker 如何利用 mtk 7688 設計出超炫的 ctf 決賽戰場燈控效果
 
2015 資安從業人員的寶(鬼)島求生
2015 資安從業人員的寶(鬼)島求生2015 資安從業人員的寶(鬼)島求生
2015 資安從業人員的寶(鬼)島求生
 
CTF 經驗分享
CTF 經驗分享CTF 經驗分享
CTF 經驗分享
 
台灣資安人才培育現況
台灣資安人才培育現況台灣資安人才培育現況
台灣資安人才培育現況
 
HITCON GIRLS Malware Analysis
HITCON GIRLS Malware AnalysisHITCON GIRLS Malware Analysis
HITCON GIRLS Malware Analysis
 
Practical cryptanalysis for hackers
Practical cryptanalysis for hackersPractical cryptanalysis for hackers
Practical cryptanalysis for hackers
 

Último

Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 

Último (20)

Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 

【HITCON FreeTalk 2018 - Spectre & Meltdown 漏洞原理說明與 POC 剖析】

  • 2. § Discover Date: 2018.01.03 § Threat §  Adversary who can execute low privilege code can read unpermitted memory region § Impact §  Meltdown: Most Intel processors §  Spectre: Intel, AMD, and ARM processors § Reason §  Inconsistence between processor architecture and microarchitecture (cache) §  Lack of permission checking when CPU optimization 2
  • 3. § Disclosure by §  Meltdown §  Jann Horn (Google Project Zero), §  Werner Haas,Thomas Prescher (Cyberus Technology), §  Daniel Gruss, Moritz Lipp, Stefan Mangard, Michael Schwarz (Graz University of Technology) §  Spectre §  Jann Horn (Google Project Zero) §  Paul Kocher + Daniel Genkin (University of Pennsylvania and University of Maryland), Mike Hamburg (Rambus), Moritz Lipp (Graz University of Technology), andYuvalYarom (University of Adelaide and Data61) §  Website §  https://meltdownattack.com/ 3
  • 4. §  CVE-2017-5753 - bounds check bypass (Spectre) §  CVE-2017-5715 - branch target injection (Spectre) §  CVE-2017-5754 - rogue data cache load (Meltdown) 4
  • 5. •  Frontend •  Fetch and Decode •  Execution Engine •  Reorder Buffer •  Execution Unit 5
  • 6. §  Once the data dependency is satisfied, the instructions are put into Execution Units for execution §  In order to fully utilize execution units, out-of-order execution is used in most modern processors §  Instruction can execute in advanced, even the previous instruction is not yet finished. §  In normal case, §  Execution unit calculates and keeps the effect of this instruction. §  Until all previous instructions finished, this instruction is retired, and committing it’s result. §  In error occurs, §  The executing result will be discarded. §  Even though the execution result may not commit to architecture, the state of microarchitecture is already changed. §  Cache state 6
  • 7. §  Speculative execution is one kind of out-of-order execution §  Once a conditional branch instruction whose direction depends on preceding instructions whose execution has not completed yet. §  CPU makes a prediction as to the path that the program will follow, and speculatively execute instructions along the path. §  Predict corrects, the instructions are retired and committed §  Predict fails, the execution result is then discarded. §  Even though the execution result may not commit to architecture, the state of microarchitecture is already changed. 7
  • 8. §  Cache side-channel attacks exploit timing differences that are introduced by the caches §  Meltdown and Spectre take Microarchitectural Side-Channel Attacks to uncover data in the microarchitecture §  Several Side Channel Attacks §  Evict+Time §  Prime+Probe §  Flush+Reload 8
  • 9. §  Flush+Reload attacks work on a single cache line granularity. §  These attacks exploit the shared, inclusive last-level cache. §  An attacker frequently flushes a targeted memory location using the clflush instruction. §  By measuring the time it takes to reload the data, the attacker determines whether data was loaded into the cache by another process in the meantime. 9
  • 10. §  array is an attacker-controllable data §  Access time §  Hit §  Miss §  256 accesses help discover one byte data Array[61* cache_line_size ] 10
  • 11. §  Exploit out-of-order execution features in processors §  Transfer hidden data from cache via Cache Side Channel Attack 11
  • 12. §  The content of an attacker-chosen memory location, which is inaccessible to the attacker, is loaded into a register. §  A transient instruction accesses a cache line based on the secret content of the register. §  The attacker uses Flush+Reload to determine the accessed cache line and hence the secret stored at the chosen memory location. 12
  • 13. §  Transient instruction §  Instructions which should never executing §  CPU executes it via out-of-order execution §  Change the microarchitecture state of the processors 13
  • 14. §  Line 3 is never executing §  CPU stealthy executing line 3 in advance §  Execution result will be abandoned §  But cache state is already changed 14
  • 15. §  An traversal of probe array can be made to record time to access each element in probe array §  Data is 84 15
  • 16. §  Meltdown POC §  https://github.com/IAIK/meltdown §  Consists of 5 demo program §  A first test to access other process’ memory §  Breaking KASLR §  Reliability test §  Read physical memory  §  Dump the memory §  Core library - libkdump 16
  • 17. § Statistic time to access cached/non-cached data § Calculate threshold 17
  • 18. § libkdump_read calls §  libkdump_read_tsx() §  libkdump_read_signal_handler() to read memory § Call to MELTDOWN to trigger out-of-order § Invoke flush_reload() to reveal data value from cache 18
  • 19. §  Since memory in rcx is invalid, the exception will arise – line 50 §  Line 51 – 53 will be executed in an out-of-order manner §  Part of probe array rbx is loaded to cache, thus reveals value of rcx 19
  • 20. §  Flush + Reload §  Check if the value is in cache 20
  • 21. §  Reconstructing a photo with Meltdown §  https://www.youtube.com/watch?v=L1N1P2zxaZE 21
  • 22. §  Exploit processors’ speculative execution and branch prediction feature §  Discover cache data via Cache Side Channel Attack 22
  • 23. 1.  Mistrain the processor so that it will later make an exploitably erroneous speculative prediction 2.  Speculatively executes instructions that transfer confidential information from the victim context into a microarchitectural side channel 3.  Recovered the confidential data from cache 23
  • 24. §  Pretrain §  make program enter this condition check many times §  Adversary can chose malicious x for accessing unpermitted data, e.g. kernel space memory §  Since §  array1_size is not in cache, CPU is delayed to read the value §  Branch predictor beliefs the branch will taken, thus speculative execute the code in branch with malicious x §  In the end, the execution result will be discarded, but still remains in cache §  Similar to Meltdown, Flush+Reload to recover the confidential data No Cache No Cache Cache 24
  • 25. §  Spectre POC §  https://github.com/crozone/SpectrePoC §  provided by Erik August's gist 25
  • 26. §  Make 5 train runs with 1 attack run §  Mistrain branch predictor 26
  • 27. §  Victim function §  When x is larger than array1_size, the code will speculative execute §  Change the cache state 27
  • 28. §  Calculate the time needed to access memory §  Determine if it is in the cache 28
  • 29. 29
  • 30. 30
  • 31. §  handling, we catch the exception effectively occurring after executing the transient instruction sequence, and with exception suppression, we prevent the exception from occurring at all and instead redirect the control flow after executing the transient instruction sequence 31
  • 32. §  The Branch Target Buffer(BTB) keeps a mapping from addresses of recently executed branch instructions to destination addresses 32