SlideShare ist ein Scribd-Unternehmen logo
1 von 33
Downloaden Sie, um offline zu lesen
Speculation and response
Spectre, Meltdown, XPTI, and Panopticon
Spectre-style flaws are the violation
of a fundamental assumption
Goals
• Help you understand Specter-Style vulnerabilities

• Understand how vulnerable Xen is (or isn’t)

• Understand the available mitigations and when to use them
Outline
• What is speculative execution?

• How do the speculative execution vulnerabilities work?

• Details about the specific vulnerabilities

• How difficult they are to execute in practice

• “Panopticon”
What is speculative execution?
What is speculative execution?
• Speculate: To guess

• Execution: to do something

• Speculative execution: Doing something based on a guess

• Something we do in real life
Instruction-level parallelism (ILP)
• Modern processors give the illusion
of one instruction happening at a
time

• But in fact, the processor tries to
do as many instructions in parallel
as possible
ILP, continued
• But sometimes, operations or execution
depends on the result of a long calculation

• Speculate:

• Guess which way the operation will
turn out

• Execute based on the guess

• Roll back if the guess turns wrong

• Hundreds or thousands of instructions
deep
How to speculation attacks
work?
Alternate universes
• Imagine you have a device with a button

• Pressing the button forks off a temporary alternate universe

• For the next 30 seconds everything you do succeeds

• After that, the alternate universe disappears and you go back to when you
started, remembering nothing
Alternate universes
• Not very useful… unless things that happen in the alternate universe can
affect the real one

• Imagine that the heat of objects “leaked” back into the real universe
Template speculative attack
result = 0;
for (bit = 0; bit < 8; bit++) {
evict_cacheline(A)
if ( fork_alternate_universe() ) {
if ( (*target_address) & (1 << bit))
load_cacheline(A)
}
if (cacheline_loaded(A))
result |= (1 << bit);
}
False assumption #1:
Rolling back architectural state
prevents information leaks
Speculation roll-back
• Rolls back architectural state

• Memory, registers, etc

• Doesn’t roll back other state

• caches, TLB state, &c

• This state can be both manipulated and detected
False assumption #2:
“Guesses” cannot be reliably
manipulated
Requirements for an attack
• Speculation that can be reliably manipulated

• A “gadget” that can (in speculation) be induced to reliably read privileged
information and leak it
Two types of speculative vulnerability
• Unprivileged speculation

• Allowing unprivileged code in speculation access it should never have

• Attacker can supply their own “leaky gadget” 

• Privileged speculation

• Allow speculation to cause privileged code to do something it would
never do otherwise

• Requires a pre-existing “leaky gadget”, or dynamic code generation
Privileged gadgets
• “Dynamic code generation”: 

• Attacker can cause their own privileged leaky gadget to be created in
speculation

• No pre-existing gadgets have yet been discovered
• All “privileged speculation” proof of concepts have used eBPF

• No JIT, (probably) not vulnerable to privileged speculation
What kinds of things can be leaked?
• SP1-4: Content of mapped memory

• Xen currently maps all host memory

• Successful attacks on Xen can read arbitrary host memory

• Lazy FPU: Contents of another domain’s FPU / XSAVE state

• XSAVE state often contains cryptographic key material and derivatives
What vulnerabilities are
currently public?
SP3 (“Meltdown”)
• Supervisor-level checks not done during speculation on Intel

• User-mode code can, in speculation, read supervisor-mode memory
SP3 and Xen
• HVM guests not in the same address space as Xen

• PV guests in the same address space as Xen

• XPTI: Remove all hypervisor mappings when switching into a PV guest
SP1 (Spectre variant 1)
• “Bounds bypass”

if ( i < BUFSIZE ) {
x = buf[i];
leak(x);
}
• Attack: Manipulate branch predictor

• During speculation, i can be an arbitrary value, which means buf[i] will
be an address of the attacker’s choice
SP1 and Xen
• No possible mitigation (other than disabling branch prediction)

• Privileged speculation vulnerability

• As yet, no such leak(x)
SP2 (with SMEP / without SMEP)
• “Branch target injection”

• “Branch target buffer”: FROM will jump to TO
• Only 1st 12 bits of FROM stored

[f = ATTACKER_TARGET]
x=*(ATTACKER_ADDRESS)
*f(...)
...
ATTACKER_ADDRESS:
leak(x)
SP2 (with SMEP / without SMEP)
[f = ATTACKER_TARGET]
x=*(ATTACKER_ADDRESS)
*f(...)
...
ATTACKER_ADDRESS:
leak(x)
• With SMEP: ATTACKER_TARGET must be privileged (need pre-existing
gadget)

• Without SMEP: ATTACKER_TARGET can be user-mode (attacker can
supply gadget)
SP2 and Xen: Vulnerability
• SMEP enabled: Similar to SP1 (no known pre-existing gadgets)

• SMEP disabled: Similar to SP3 (easy to attack)
SP2 and Xen: Mitigations
• Mitgation 1: Flush branch target buffers

• Erase “poisoned” branch buffers

• New instructions (microcode) required

• Mitigation 2: Retpoline

• Trick processor into not using BTB

• Compiler support for thunking required
“Privileged speculation” and Xen
• No dynamic code generation

• Pre-existing gadgets?

• None found so far

• Probably a matter of number of lines of code
Further mitigation
• Xen maps all of host memory… but why?

• Nothing more than convenience

• “Map on demand” still necessary for host with over 5TiB of memory

• Still present, and tested in debug mode
Panopticon / Nothing to hide
• Panopticon: A conceptual prison where the prisoners had to assume they
were being watched at all times

• Can we build Xen with the assumption that guests can read any memory it
has mapped at any time?
Panopticon / Nothing to hide
• Get rid of the direct map

• Isolate cpu stacks

• Zero unnecessary memory

More speculation attacks? Bring it on.
Questions?

Weitere ähnliche Inhalte

Ähnlich wie XPDDS18: Speculation and Response: Spectre, Meltdown, XPTI, and Panopticon - George Dunlap, Citrix

ETCSS: Into the Mind of a Hacker
ETCSS: Into the Mind of a HackerETCSS: Into the Mind of a Hacker
ETCSS: Into the Mind of a Hacker
Rob Gillen
 
You didnt see it’s coming? "Dawn of hardened Windows Kernel"
You didnt see it’s coming? "Dawn of hardened Windows Kernel" You didnt see it’s coming? "Dawn of hardened Windows Kernel"
You didnt see it’s coming? "Dawn of hardened Windows Kernel"
Peter Hlavaty
 
Exploitation and State Machines
Exploitation and State MachinesExploitation and State Machines
Exploitation and State Machines
Michael Scovetta
 
Alexey Sintsov. Honeypot that Can Bite: Reverse Penetration.
Alexey Sintsov. Honeypot that Can Bite: Reverse Penetration.Alexey Sintsov. Honeypot that Can Bite: Reverse Penetration.
Alexey Sintsov. Honeypot that Can Bite: Reverse Penetration.
Positive Hack Days
 
Creating Havoc using Human Interface Device
Creating Havoc using Human Interface DeviceCreating Havoc using Human Interface Device
Creating Havoc using Human Interface Device
Positive Hack Days
 
BSides Algiers - Metasploit framework - Oussama Elhamer
BSides Algiers - Metasploit framework - Oussama ElhamerBSides Algiers - Metasploit framework - Oussama Elhamer
BSides Algiers - Metasploit framework - Oussama Elhamer
Shellmates
 

Ähnlich wie XPDDS18: Speculation and Response: Spectre, Meltdown, XPTI, and Panopticon - George Dunlap, Citrix (20)

Truth and Consequences
Truth and ConsequencesTruth and Consequences
Truth and Consequences
 
Ethical hacking
Ethical hackingEthical hacking
Ethical hacking
 
ETCSS: Into the Mind of a Hacker
ETCSS: Into the Mind of a HackerETCSS: Into the Mind of a Hacker
ETCSS: Into the Mind of a Hacker
 
You didnt see it’s coming? "Dawn of hardened Windows Kernel"
You didnt see it’s coming? "Dawn of hardened Windows Kernel" You didnt see it’s coming? "Dawn of hardened Windows Kernel"
You didnt see it’s coming? "Dawn of hardened Windows Kernel"
 
Exploitation and State Machines
Exploitation and State MachinesExploitation and State Machines
Exploitation and State Machines
 
Anatomy of a Buffer Overflow Attack
Anatomy of a Buffer Overflow AttackAnatomy of a Buffer Overflow Attack
Anatomy of a Buffer Overflow Attack
 
Un) fucking forensics
Un) fucking forensicsUn) fucking forensics
Un) fucking forensics
 
Your First Guide to "secure Linux"
Your First Guide to "secure Linux"Your First Guide to "secure Linux"
Your First Guide to "secure Linux"
 
Malware analysis _ Threat Intelligence Morocco
Malware analysis _ Threat Intelligence MoroccoMalware analysis _ Threat Intelligence Morocco
Malware analysis _ Threat Intelligence Morocco
 
Alexey Sintsov. Honeypot that Can Bite: Reverse Penetration.
Alexey Sintsov. Honeypot that Can Bite: Reverse Penetration.Alexey Sintsov. Honeypot that Can Bite: Reverse Penetration.
Alexey Sintsov. Honeypot that Can Bite: Reverse Penetration.
 
Phd final
Phd finalPhd final
Phd final
 
Metasploit Computer security testing tool
Metasploit  Computer security testing toolMetasploit  Computer security testing tool
Metasploit Computer security testing tool
 
nabdullin_brcrdu_dark
nabdullin_brcrdu_darknabdullin_brcrdu_dark
nabdullin_brcrdu_dark
 
Buffer overflow Attacks
Buffer overflow AttacksBuffer overflow Attacks
Buffer overflow Attacks
 
Buffer Overflow Attacks
Buffer Overflow AttacksBuffer Overflow Attacks
Buffer Overflow Attacks
 
Creating Havoc using Human Interface Device
Creating Havoc using Human Interface DeviceCreating Havoc using Human Interface Device
Creating Havoc using Human Interface Device
 
The hangover: A "modern" (?) high performance approach to build an offensive ...
The hangover: A "modern" (?) high performance approach to build an offensive ...The hangover: A "modern" (?) high performance approach to build an offensive ...
The hangover: A "modern" (?) high performance approach to build an offensive ...
 
Reverse Engineering Presentation.pdf
Reverse Engineering Presentation.pdfReverse Engineering Presentation.pdf
Reverse Engineering Presentation.pdf
 
BSides Algiers - Metasploit framework - Oussama Elhamer
BSides Algiers - Metasploit framework - Oussama ElhamerBSides Algiers - Metasploit framework - Oussama Elhamer
BSides Algiers - Metasploit framework - Oussama Elhamer
 
Inetsecurity.in Ethical Hacking presentation
Inetsecurity.in Ethical Hacking presentationInetsecurity.in Ethical Hacking presentation
Inetsecurity.in Ethical Hacking presentation
 

Mehr von The Linux Foundation

Mehr von The Linux Foundation (20)

ELC2019: Static Partitioning Made Simple
ELC2019: Static Partitioning Made SimpleELC2019: Static Partitioning Made Simple
ELC2019: Static Partitioning Made Simple
 
XPDDS19: How TrenchBoot is Enabling Measured Launch for Open-Source Platform ...
XPDDS19: How TrenchBoot is Enabling Measured Launch for Open-Source Platform ...XPDDS19: How TrenchBoot is Enabling Measured Launch for Open-Source Platform ...
XPDDS19: How TrenchBoot is Enabling Measured Launch for Open-Source Platform ...
 
XPDDS19 Keynote: Xen in Automotive - Artem Mygaiev, Director, Technology Solu...
XPDDS19 Keynote: Xen in Automotive - Artem Mygaiev, Director, Technology Solu...XPDDS19 Keynote: Xen in Automotive - Artem Mygaiev, Director, Technology Solu...
XPDDS19 Keynote: Xen in Automotive - Artem Mygaiev, Director, Technology Solu...
 
XPDDS19 Keynote: Xen Project Weather Report 2019 - Lars Kurth, Director of Op...
XPDDS19 Keynote: Xen Project Weather Report 2019 - Lars Kurth, Director of Op...XPDDS19 Keynote: Xen Project Weather Report 2019 - Lars Kurth, Director of Op...
XPDDS19 Keynote: Xen Project Weather Report 2019 - Lars Kurth, Director of Op...
 
XPDDS19 Keynote: Unikraft Weather Report
XPDDS19 Keynote:  Unikraft Weather ReportXPDDS19 Keynote:  Unikraft Weather Report
XPDDS19 Keynote: Unikraft Weather Report
 
XPDDS19 Keynote: Secret-free Hypervisor: Now and Future - Wei Liu, Software E...
XPDDS19 Keynote: Secret-free Hypervisor: Now and Future - Wei Liu, Software E...XPDDS19 Keynote: Secret-free Hypervisor: Now and Future - Wei Liu, Software E...
XPDDS19 Keynote: Secret-free Hypervisor: Now and Future - Wei Liu, Software E...
 
XPDDS19 Keynote: Xen Dom0-less - Stefano Stabellini, Principal Engineer, Xilinx
XPDDS19 Keynote: Xen Dom0-less - Stefano Stabellini, Principal Engineer, XilinxXPDDS19 Keynote: Xen Dom0-less - Stefano Stabellini, Principal Engineer, Xilinx
XPDDS19 Keynote: Xen Dom0-less - Stefano Stabellini, Principal Engineer, Xilinx
 
XPDDS19 Keynote: Patch Review for Non-maintainers - George Dunlap, Citrix Sys...
XPDDS19 Keynote: Patch Review for Non-maintainers - George Dunlap, Citrix Sys...XPDDS19 Keynote: Patch Review for Non-maintainers - George Dunlap, Citrix Sys...
XPDDS19 Keynote: Patch Review for Non-maintainers - George Dunlap, Citrix Sys...
 
XPDDS19: Memories of a VM Funk - Mihai Donțu, Bitdefender
XPDDS19: Memories of a VM Funk - Mihai Donțu, BitdefenderXPDDS19: Memories of a VM Funk - Mihai Donțu, Bitdefender
XPDDS19: Memories of a VM Funk - Mihai Donțu, Bitdefender
 
OSSJP/ALS19: The Road to Safety Certification: Overcoming Community Challeng...
OSSJP/ALS19:  The Road to Safety Certification: Overcoming Community Challeng...OSSJP/ALS19:  The Road to Safety Certification: Overcoming Community Challeng...
OSSJP/ALS19: The Road to Safety Certification: Overcoming Community Challeng...
 
OSSJP/ALS19: The Road to Safety Certification: How the Xen Project is Making...
 OSSJP/ALS19: The Road to Safety Certification: How the Xen Project is Making... OSSJP/ALS19: The Road to Safety Certification: How the Xen Project is Making...
OSSJP/ALS19: The Road to Safety Certification: How the Xen Project is Making...
 
XPDDS19: Speculative Sidechannels and Mitigations - Andrew Cooper, Citrix
XPDDS19: Speculative Sidechannels and Mitigations - Andrew Cooper, CitrixXPDDS19: Speculative Sidechannels and Mitigations - Andrew Cooper, Citrix
XPDDS19: Speculative Sidechannels and Mitigations - Andrew Cooper, Citrix
 
XPDDS19: Keeping Coherency on Arm: Reborn - Julien Grall, Arm ltd
XPDDS19: Keeping Coherency on Arm: Reborn - Julien Grall, Arm ltdXPDDS19: Keeping Coherency on Arm: Reborn - Julien Grall, Arm ltd
XPDDS19: Keeping Coherency on Arm: Reborn - Julien Grall, Arm ltd
 
XPDDS19: QEMU PV Backend 'qdevification'... What Does it Mean? - Paul Durrant...
XPDDS19: QEMU PV Backend 'qdevification'... What Does it Mean? - Paul Durrant...XPDDS19: QEMU PV Backend 'qdevification'... What Does it Mean? - Paul Durrant...
XPDDS19: QEMU PV Backend 'qdevification'... What Does it Mean? - Paul Durrant...
 
XPDDS19: Status of PCI Emulation in Xen - Roger Pau Monné, Citrix Systems R&D
XPDDS19: Status of PCI Emulation in Xen - Roger Pau Monné, Citrix Systems R&DXPDDS19: Status of PCI Emulation in Xen - Roger Pau Monné, Citrix Systems R&D
XPDDS19: Status of PCI Emulation in Xen - Roger Pau Monné, Citrix Systems R&D
 
XPDDS19: [ARM] OP-TEE Mediator in Xen - Volodymyr Babchuk, EPAM Systems
XPDDS19: [ARM] OP-TEE Mediator in Xen - Volodymyr Babchuk, EPAM SystemsXPDDS19: [ARM] OP-TEE Mediator in Xen - Volodymyr Babchuk, EPAM Systems
XPDDS19: [ARM] OP-TEE Mediator in Xen - Volodymyr Babchuk, EPAM Systems
 
XPDDS19: Bringing Xen to the Masses: The Story of Building a Community-driven...
XPDDS19: Bringing Xen to the Masses: The Story of Building a Community-driven...XPDDS19: Bringing Xen to the Masses: The Story of Building a Community-driven...
XPDDS19: Bringing Xen to the Masses: The Story of Building a Community-driven...
 
XPDDS19: Will Robots Automate Your Job Away? Streamlining Xen Project Contrib...
XPDDS19: Will Robots Automate Your Job Away? Streamlining Xen Project Contrib...XPDDS19: Will Robots Automate Your Job Away? Streamlining Xen Project Contrib...
XPDDS19: Will Robots Automate Your Job Away? Streamlining Xen Project Contrib...
 
XPDDS19: Client Virtualization Toolstack in Go - Nick Rosbrook & Brendan Kerr...
XPDDS19: Client Virtualization Toolstack in Go - Nick Rosbrook & Brendan Kerr...XPDDS19: Client Virtualization Toolstack in Go - Nick Rosbrook & Brendan Kerr...
XPDDS19: Client Virtualization Toolstack in Go - Nick Rosbrook & Brendan Kerr...
 
XPDDS19: Core Scheduling in Xen - Jürgen Groß, SUSE
XPDDS19: Core Scheduling in Xen - Jürgen Groß, SUSEXPDDS19: Core Scheduling in Xen - Jürgen Groß, SUSE
XPDDS19: Core Scheduling in Xen - Jürgen Groß, SUSE
 

Kürzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

XPDDS18: Speculation and Response: Spectre, Meltdown, XPTI, and Panopticon - George Dunlap, Citrix

  • 1. Speculation and response Spectre, Meltdown, XPTI, and Panopticon
  • 2. Spectre-style flaws are the violation of a fundamental assumption
  • 3. Goals • Help you understand Specter-Style vulnerabilities • Understand how vulnerable Xen is (or isn’t) • Understand the available mitigations and when to use them
  • 4. Outline • What is speculative execution? • How do the speculative execution vulnerabilities work? • Details about the specific vulnerabilities • How difficult they are to execute in practice • “Panopticon”
  • 5. What is speculative execution?
  • 6. What is speculative execution? • Speculate: To guess • Execution: to do something • Speculative execution: Doing something based on a guess • Something we do in real life
  • 7. Instruction-level parallelism (ILP) • Modern processors give the illusion of one instruction happening at a time • But in fact, the processor tries to do as many instructions in parallel as possible
  • 8. ILP, continued • But sometimes, operations or execution depends on the result of a long calculation • Speculate: • Guess which way the operation will turn out • Execute based on the guess • Roll back if the guess turns wrong • Hundreds or thousands of instructions deep
  • 9. How to speculation attacks work?
  • 10. Alternate universes • Imagine you have a device with a button • Pressing the button forks off a temporary alternate universe • For the next 30 seconds everything you do succeeds • After that, the alternate universe disappears and you go back to when you started, remembering nothing
  • 11. Alternate universes • Not very useful… unless things that happen in the alternate universe can affect the real one • Imagine that the heat of objects “leaked” back into the real universe
  • 12. Template speculative attack result = 0; for (bit = 0; bit < 8; bit++) { evict_cacheline(A) if ( fork_alternate_universe() ) { if ( (*target_address) & (1 << bit)) load_cacheline(A) } if (cacheline_loaded(A)) result |= (1 << bit); }
  • 13. False assumption #1: Rolling back architectural state prevents information leaks
  • 14. Speculation roll-back • Rolls back architectural state • Memory, registers, etc • Doesn’t roll back other state • caches, TLB state, &c • This state can be both manipulated and detected
  • 15. False assumption #2: “Guesses” cannot be reliably manipulated
  • 16. Requirements for an attack • Speculation that can be reliably manipulated • A “gadget” that can (in speculation) be induced to reliably read privileged information and leak it
  • 17. Two types of speculative vulnerability • Unprivileged speculation • Allowing unprivileged code in speculation access it should never have • Attacker can supply their own “leaky gadget” • Privileged speculation • Allow speculation to cause privileged code to do something it would never do otherwise • Requires a pre-existing “leaky gadget”, or dynamic code generation
  • 18. Privileged gadgets • “Dynamic code generation”: • Attacker can cause their own privileged leaky gadget to be created in speculation • No pre-existing gadgets have yet been discovered • All “privileged speculation” proof of concepts have used eBPF • No JIT, (probably) not vulnerable to privileged speculation
  • 19. What kinds of things can be leaked? • SP1-4: Content of mapped memory • Xen currently maps all host memory • Successful attacks on Xen can read arbitrary host memory • Lazy FPU: Contents of another domain’s FPU / XSAVE state • XSAVE state often contains cryptographic key material and derivatives
  • 21. SP3 (“Meltdown”) • Supervisor-level checks not done during speculation on Intel • User-mode code can, in speculation, read supervisor-mode memory
  • 22. SP3 and Xen • HVM guests not in the same address space as Xen • PV guests in the same address space as Xen • XPTI: Remove all hypervisor mappings when switching into a PV guest
  • 23. SP1 (Spectre variant 1) • “Bounds bypass” if ( i < BUFSIZE ) { x = buf[i]; leak(x); } • Attack: Manipulate branch predictor • During speculation, i can be an arbitrary value, which means buf[i] will be an address of the attacker’s choice
  • 24. SP1 and Xen • No possible mitigation (other than disabling branch prediction) • Privileged speculation vulnerability • As yet, no such leak(x)
  • 25. SP2 (with SMEP / without SMEP) • “Branch target injection” • “Branch target buffer”: FROM will jump to TO • Only 1st 12 bits of FROM stored [f = ATTACKER_TARGET] x=*(ATTACKER_ADDRESS) *f(...) ... ATTACKER_ADDRESS: leak(x)
  • 26. SP2 (with SMEP / without SMEP) [f = ATTACKER_TARGET] x=*(ATTACKER_ADDRESS) *f(...) ... ATTACKER_ADDRESS: leak(x) • With SMEP: ATTACKER_TARGET must be privileged (need pre-existing gadget) • Without SMEP: ATTACKER_TARGET can be user-mode (attacker can supply gadget)
  • 27. SP2 and Xen: Vulnerability • SMEP enabled: Similar to SP1 (no known pre-existing gadgets) • SMEP disabled: Similar to SP3 (easy to attack)
  • 28. SP2 and Xen: Mitigations • Mitgation 1: Flush branch target buffers • Erase “poisoned” branch buffers • New instructions (microcode) required • Mitigation 2: Retpoline • Trick processor into not using BTB • Compiler support for thunking required
  • 29. “Privileged speculation” and Xen • No dynamic code generation • Pre-existing gadgets? • None found so far • Probably a matter of number of lines of code
  • 30. Further mitigation • Xen maps all of host memory… but why? • Nothing more than convenience • “Map on demand” still necessary for host with over 5TiB of memory • Still present, and tested in debug mode
  • 31. Panopticon / Nothing to hide • Panopticon: A conceptual prison where the prisoners had to assume they were being watched at all times • Can we build Xen with the assumption that guests can read any memory it has mapped at any time?
  • 32. Panopticon / Nothing to hide • Get rid of the direct map • Isolate cpu stacks • Zero unnecessary memory More speculation attacks? Bring it on.