Attacking Windows using Intel TSX

Slides:



Advertisements
Similar presentations
Hardware-assisted Virtualization
Advertisements

Memory Protection: Kernel and User Address Spaces  Background  Address binding  How memory protection is achieved.
Computer ArchitectureFall 2008 © November 10, 2007 Nael Abu-Ghazaleh Lecture 23 Virtual.
Computer ArchitectureFall 2007 © November 21, 2007 Karem A. Sakallah Lecture 23 Virtual Memory (2) CS : Computer Architecture.
1 Last Class: Introduction Operating system = interface between user & architecture Importance of OS OS history: Change is only constant User-level Applications.
1 OS & Computer Architecture Modern OS Functionality (brief review) Architecture Basics Hardware Support for OS Features.
Basics of Operating Systems March 4, 2001 Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard.
Virtual Memory Expanding Memory Multiple Concurrent Processes.
1 Vulnerabilities on high-end processors André Seznec IRISA/INRIA CAPS project-team.
Full and Para Virtualization
CS.305 Computer Architecture Memory: Virtual Adapted from Computer Organization and Design, Patterson & Hennessy, © 2005, and from slides kindly made available.
Hardware and Software transactional memory and usages in MRE
Protection of Processes Security and privacy of data is challenging currently. Protecting information – Not limited to hardware. – Depends on innovation.
Lecture 4 Page 1 CS 111 Online Modularity and Memory Clearly, programs must have access to memory We need abstractions that give them the required access.
Virtualization for Cloud Computing
Virtualization.
Introduction to Operating Systems
Outline CPU caches Cache coherence Placement of data
Concurrent programming: From theory to practice
Introduction to Operating Systems
Presented by Mike Marty
Algorithmic Improvements for Fast Concurrent Cuckoo Hashing
ECE232: Hardware Organization and Design
CS352H: Computer Systems Architecture
Lecture 12 Virtual Memory.
Section 9: Virtual Memory (VM)
Structure of Processes
Lecture 24 Virtual Machine Monitors
Swapping Segmented paging allows us to have non-contiguous allocations
Morgan Kaufmann Publishers
Modularity and Memory Clearly, programs must have access to memory
Bruhadeshwar Meltdown Bruhadeshwar
CSE 153 Design of Operating Systems Winter 2018
Group 8 Virtualization of the Cloud
CS2100 Computer Organisation
Introduction to Operating Systems
OS Virtualization.
Introduction to Operating Systems
Lecture 14 Virtual Memory and the Alpha Memory Hierarchy
Practice Six Chapter Eight.
Yingmin Li Ting Yan Qi Zhao
A Survey on Virtualization Technologies
Introduction to the Intel x86’s support for “virtual” memory
Architectural Support for OS
CSE 451: Operating Systems Autumn 2005 Memory Management
Computer Security: Art and Science, 2nd Edition
CSE 451: Operating Systems Autumn 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 596 Allen Center 1.
CSE 451: Operating Systems Autumn 2001 Lecture 2 Architectural Support for Operating Systems Brian Bershad 310 Sieg Hall 1.
CSE451 Virtual Memory Paging Autumn 2002
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
Concurrent programming: From theory to practice
CSE 451: Operating Systems Winter 2007 Module 2 Architectural Support for Operating Systems Brian Bershad 562 Allen Center 1.
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
CSE 451: Operating Systems Winter 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 412 Sieg Hall 1.
Architectural Support for OS
CSE 471 Autumn 1998 Virtual memory
Page Allocation and Replacement
CSE 153 Design of Operating Systems Winter 2019
CSE 153 Design of Operating Systems Winter 2019
A Virtual Machine Monitor for Utilizing Non-dedicated Clusters
Virtual Memory Use main memory as a “cache” for secondary (disk) storage Managed jointly by CPU hardware and the operating system (OS) Programs share main.
Landon Cox January 17, 2018 January 22, 2018
OPERATING SYSTEMS MEMORY MANAGEMENT BY DR.V.R.ELANGOVAN.
Structure of Processes
Synonyms v.p. x, process A v.p # index Map to same physical page
Review What are the advantages/disadvantages of pages versus segments?
MicroScope: Enabling Microarchitectural Replay Attacks
In Today’s Class.. General Kernel Responsibilities Kernel Organization
Chapter 4 The Von Neumann Model
CS2100 Computer Organisation
Presentation transcript:

Attacking Windows using Intel TSX 1

[ ] I’m Sina, W h o A m I A Windows Internals enthusiast [ ] W h o A m I I’m Sina, A Windows Internals enthusiast Currently working and studying : @Intel80x86 Rayanfam.com Raah kar hooshmand e Amn Shahid Beheshti University

This presentation a new improvement to the following articles : KASLR is Dead: Long Live KASLR https://gruss.cc/files/kaiser.pdf I Know Where Your Page Lives De-Randomizing the Latest Windows 10 Kernel https://github.com/IOActive/I-know-where-your-page-lives

Intel TSX Intel Transactional Synchronization eXtensions (TSX) is the product name for two x86 instruction set extensions, called Hardware Lock Elision (HLE) and Restricted Transactional Memory (RTM). HLE is a set of prefixes that can be added to specific instructions. Derived from : LazyFP: Leaking FPU Register State using Microarchitectural Side-Channels (https://arxiv.org/pdf/1806.07480.pdf)

Intel’s Transactional Synchronization Extensions

Restricted Transactional Memory Hardware Lock Elision VS Restricted Transactional Memory

- [ ] - I n t r o d u c i n g t o Hardware Lock Elision lock elision is a general concept that can be implemented in different ways. e.g XACQUIRE and XRELEASE Prefixes in Intel Processors

Restricted Transactional Memory (RTM) - [ ] - I n t r o d u c i n g t o Restricted Transactional Memory (RTM) Introducing new instructions : XBEGIN, XEND, XABORT & XTEST Somehow like try/catch when it comes to programming. It’s all about atomicity.

What is OoO ? It’s one of three components of out-of-order execution, also known as dynamic execution. Along with multiple branch prediction (used to predict the instructions most likely to be needed in the near future) and dataflow analysis (used to align instructions for optimal execution, as opposed to executing them in the order they came in), speculative execution delivered a dramatic performance improvement over previous Intel processors.

IA32 & IA32e Paging

Intel Paging in IA32-e Mode and it’s submodes

Paging Attr. Overview

Let’ s see some examples Pictures From : https://www.secureauth.com/blog/getting-physical-extreme- abuse-of-intel-based-paging-systems-part-2-windows E x a m p l e 13

Using the self-ref entry located at the PML4 position number 0 (zero): 14

Using the self-ref entry located at the PML4 position number 0x1FF (511): 15

What was the Windows Plan for self-referential entries? Ok, but What was the Windows Plan for self-referential entries? 16

Windows Self-Ref Entries Only one PML4 entry is used for Paging management (0x1ED). Entry 0x1ED is self-referential or the physical address points to PML4 physical address 17

Self-Ref of Death Attack 18

Self-Ref of Death 19

Self-Ref of Death 20

https://www.blackhat.com/docs/us-16/materials/us-16-Weston-Windows-10-Mitigation-Improvements.pdf 21

22

It was impressive, compared to other OSs ! 23

24

25

Demo Time ! It’s kinda heavy unsafe abuse… 26

27

28

29

30

31

1 - - - - - - - - - Examp e translation (TBL hit) Ox00003208 DISK Virtual Address Ox00003208 Virt ual page number DISK 0x0003 0x08'04 0x0006 0x00108 0x0009 1 - - - - - - - - - tag physica page number i}(:000031 0x0006 ••• 0x00f6 Physical Address ---------- Phy5ical page number Page offset

Hal!HalpInterruptController For many years, the HAL's heap in Windows has always been located at the same static kernel address : On 32-bit versions of Windows it was located at the address 0xffd00000 On 64-bit versions of Windows it could be found at the address 0xffffffff'ffd00000. No longer works ! :(

But we can still map, all the memories into our user-mode apps ! Currently it works on all Intel Processors Even the 9th generation

But, Do We Surrender ?! Definitely No!

Mitigation

CR4.TSD

Not possible through modern OSs : ✴Heavy use of RDTSC and RDTSCP in user-mode applications as performance measuring Mechanism through Serialization and getting Current Clock Cycle. ✴ For instance CPUID + RDTSC , RDTSCP ✴Used internally for Windows for Thread synchronizations and user-mode timings.

Hypervisor From Scratch Hypervisor From Scratch – Part 1: Basic Concepts & Configure Testing Environment Hypervisor From Scratch – Part 2: Entering VMX Operation Hypervisor From Scratch – Part 3: Setting up Our First Virtual Machine Hypervisor From Scratch – Part 4: Address Translation Using Extended Page Table (EPT) Hypervisor From Scratch – Part 5: Setting up VMCS & Running Guest Code Hypervisor From Scratch – Part 6: Virtualizing An Already Running System Available at : https://rayanfam.com/tutorials/

Why VBS can’t stop this kinds of attack ?

It’s because OSs internally use RDTSC and RDTSCP. We can stop it because we don’t need user-mode timing ! We can modify RDTSC and RDTSCP ‘ s result to avoid error. For this, we give user-mode apps clock time + 20 clk tolerance.

Disadvantages Because both Kernel-Mode and User-Mode cause VM-Exits so it makes our system much more slower ! Some applications may have undefined behaviours/

Questions ? 47

Thanks 48