Windows Memory Forensics and Direct Kernel Object Manipulation Jesse Kornblum.

Slides:



Advertisements
Similar presentations
CSC 360- Instructor: K. Wu Overview of Operating Systems.
Advertisements

Windows XP Kernel Architecture Mike Karlsven James Farrer Jason Smith.
Computer System Organization Computer-system operation – One or more CPUs, device controllers connect through common bus providing access to shared memory.
Operating Systems Lecture 10 Issues in Paging and Virtual Memory Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing.
Operating System Security : David Phillips A Study of Windows Rootkits.
3: OS Structures 1 OPERATING SYSTEM STRUCTURES PROCESS MANAGEMENT A process is a program in execution: (A program is passive, a process active.) A process.
CMPT 300: Operating Systems I Dr. Mohamed Hefeeda
Slide 6-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 6 Implementing Processes, Threads, and Resources.
Threads Section 2.2. Introduction to threads A thread (of execution) is a light-weight process –Threads reside within processes. –They share one address.
Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators.
Figure 2.8 Compiler phases Compiling. Figure 2.9 Object module Linking.
2: OS Structures 1 Jerry Breecher OPERATING SYSTEMS STRUCTURES.
Process Management. External View of the OS Hardware fork() CreateProcess() CreateThread() close() CloseHandle() sleep() semctl() signal() SetWaitableTimer()
Process in Unix, Linux and Windows CS-3013 C-term Processes in Unix, Linux, and Windows CS-3013 Operating Systems (Slides include materials from.
Building Secure Software Chapter 9 Race Conditions.
Chapter 6 Implementing Processes, Threads, and Resources.
ROOT KITS. Overview History What is a rootkit? Rootkit capabilities Rootkits on windows OS Rootkit demo Detection methodologies Good tools for detection.
1 Threads Chapter 4 Reading: 4.1,4.4, Process Characteristics l Unit of resource ownership - process is allocated: n a virtual address space to.
Processes in Unix, Linux, and Windows CS-502 Fall Processes in Unix, Linux, and Windows CS502 Operating Systems (Slides include materials from Operating.
Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access memory.
Slide 6-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 6.
1 CS503: Operating Systems Part 1: OS Interface Dongyan Xu Department of Computer Science Purdue University.
Chapter 8 Windows Outline Programming Windows 2000 System structure Processes and threads in Windows 2000 Memory management The Windows 2000 file.
Practical Malware Analysis Ch 8: Debugging Rev
Process in Unix, Linux, and Windows CS-3013 A-term Processes in Unix, Linux, and Windows CS-3013 Operating Systems (Slides include materials from.
CMPE 421 Parallel Computer Architecture
University of Management & Technology 1 Operating Systems & Utility Programs.
Implementing Processes and Process Management Brian Bershad.
Rootkits in Windows XP  What they are and how they work.
Implementing a Port Knocking System in C Honors Thesis Defense by Matt Doyle.
Monnappa KA  Info Security Cisco  Member of SecurityXploded  Reverse Engineering, Malware Analysis, Memory Forensics 
July 30, 2001Systems Architecture II1 Systems Architecture II (CS ) Lecture 8: Exploiting Memory Hierarchy: Virtual Memory * Jeremy R. Johnson Monday.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
CE Operating Systems Lecture 11 Windows – Object manager and process management.
CE Operating Systems Lecture 3 Overview of OS functions and structure.
(a) What is the output generated by this program? In fact the output is not uniquely defined, i.e., it is not always the same. So please give three examples.
Processes CS 6560: Operating Systems Design. 2 Von Neuman Model Both text (program) and data reside in memory Execution cycle Fetch instruction Decode.
4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING SUSE Lab.
Operating Systems Security
The world leader in serving science Overview of Thermo 21 CFR Part 11 tools Overview of software used by multiple business units within the Spectroscopy.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Processes and Threads.
2 Processor(s)Main MemoryDevices Process, Thread & Resource Manager Memory Manager Device Manager File Manager.
IT3002 Computer Architecture
1 Process Description and Control Chapter 3. 2 Process A program in execution An instance of a program running on a computer The entity that can be assigned.
Lecture 5 Rootkits Hoglund/Butler (Chapters 1-3).
Introduction Contain two or more CPU share common memory and peripherals. Provide greater system throughput. Multiple processor executing simultaneous.
COMP091 – Operating Systems 1 Memory Management. Memory Management Terms Physical address –Actual address as seen by memory unit Logical address –Address.
Lecture 8 Rootkits Hoglund/Butler (Chapter 7-8). Avoiding detection Two ways rootkits can avoid detection –Modify execution path of operating system to.
Copyright © Curt Hill More on Operating Systems Continuation of Introduction.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
CSE451 I/O Systems and the Full I/O Path Autumn 2002
Operating Systems: A Modern Perspective, Chapter 6
Intro to Processes CSSE 332 Operating Systems
Processes in Unix, Linux, and Windows
Chapter 1: Introduction
Chapter 3: Windows7 Part 2.
Processes in Unix, Linux, and Windows
Windows Internals Brown-Bag Seminar Chapter 1 – Concepts and Tools
System Structure B. Ramamurthy.
Processes in Unix, Linux, and Windows
Intro. To Operating Systems
Chapter 3: Windows7 Part 2.
Lecture Topics: 11/1 General Operating System Concepts Processes
Threads Chapter 4.
Processes in Unix, Linux, and Windows
Implementing Processes, Threads, and Resources
Outline Process Management Process manager Hardware process
CSE 153 Design of Operating Systems Winter 2019
Mr. M. D. Jamadar Assistant Professor
Presentation transcript:

Windows Memory Forensics and Direct Kernel Object Manipulation Jesse Kornblum

2 Outline Introduction The Kernel Direct Kernel Object Manipulation Standard DKOM Devious DKOM Better Magic Relations Between Kernel Objects Questions

Introduction Computer Forensics Research Guru –md5deep, hashdeep, fuzzy hashing (ssdeep), foremost, etc –AFOSI, DoJ, ManTech Kyrus Technology 3

Introduction Direct Kernel Object Manipulation (DKOM) Powerful technique for p0wning a computer –or crashing it Memory forensics should be able help us –but can be subverted too But we shall prevail 4

The Kernel The kernel must maintain lots of data –Processes –Threads –File handles –Network connections –Interrupts –Really everything on the system All stored in kernel data structures 5

How it’s Supposed to Work Structures are modified by API functions Several different levels of API functions –CreateProcess –NtCreateProcess –ZwCreateProcess –And many more! These functions provide –Sanity checking –Memory allocation –Data initialization 6

Direct Kernel Object Manipulation Modify data structures without using API functions Must be done by code running in ring zero –Also called kernel mode –But not userland programs Can be done by drivers –This is why drivers can cause crashes Code injected into the kernel process 7

The Kernel Lots of lists Linked lists Each item points to the next item in the list 8

The Kernel Doubly linked lists Each item points to the next and previous items in the list 9

How it’s Supposed to Work 10

How it’s Supposed to Work 11 List Head

DKOM Example Unlink a process to hide it Adjust forward and back links to skip an item 12

Standard DKOM 13 List Head

Detecting Standard DKOM High-low analysis –Follow process links, record all processes –Brute force search for processes Compare the results Any process that shows up in one list but not the other is suspicious α β γ δ ε ζ η θ κ λ π σ φ ψ α β γ δ ε ζ η θ κ λ σ φ ψ 14

Devious DKOM How do you do a brute force search? Most modern tools looks for a magic value Magic values may not be required Some can be replaced with arbitrary values –System still runs 15

Process Structures Execute Process structure –EPROCESS Consists of several substructures Lives in pool memory Starts with a POOL_HEADER –You don’t need to know what this is –Contains values set by kernel –But not referenced while running 16 Image courtesy Flickr user leozaza and licensed under the Creative Commons

Devious DKOM On Windows XP the POOL_HEADER starts with f e3 (“Proã” in ASCII) Can be replaced with, for example

Devious DKOM Demo 18 Using Volatility Framework –

Devious DKOM Demo 19 Not picking on Volatility –All existing tools use magic values

Detecting Devious DKOM Two approaches –Get better magic –Detect using something else 20

Better Magic Better Magic Through Fuzzing™ Fuzzing means inputting random data and seeing what happens Use automated tools to only report the interesting inputs 21 Image courtesy Flickr user LaMenta3 and licensed under the Creative Commons

Better Magic Fuzzing to find magic values –Fire up virtual machine and start a process –Pause VM –Change EPROCESS values at random –Resume VM –Record if change made the process or machine crash –Repeat Do mathy stuff to generate rules for which values cannot be changed without a crash Full citation at the end, 22

Better Magic Examples from EPROCESS Pcb.ReadyListHead –List Head of threads ready to execute –val & 0x == 0x AND val % 0x8 == 0 Peb –Address of Process Environment Block –val == 0 OR –(val & 0x7ffd0000 == 0x7ffd0000 AND val % 0x1000 == 0) 23

Problems with Better Magic These rules are for 32-bit Windows XP Service Pack 2 only Fuzzing must be repeated for each configuration Rules will be different for each configuration –Especially 64-bit systems 24

Detecting Devious DKOM Two approaches –Get better magic –Detect using something else 25

Kernel Objects Use inherent organization of the kernel The kernel is massive –Lots of structures to choose from Particularly focus on the connections between these objects 26

Processes A process is a container –Holds threads, handles, DLLs, and many other structures Let’s talk about threads –Threads are paths of execution –Have a stack –Work off common code base –Can interact with other threads Every process starts with one thread –Can start more threads Could have a process with no threads, but it wouldn’t do anything 27

Threads 28 ProcessCodeData Thread

Threads 29 ProcessCodeData Thread

Threads 30 CodeData Thread CodeData Thread CodeData Thread CodeData Thread

The Kernel The Kernel is just another process on the system –Starts first –Gets to talk to the hardware –Schedules threads Tells hardware to transfer execution to a thread for a given time When finished, hardware interrupts the thread –Allow it to store its data gracefully Return control to kernel 31

The Kernel 32 Image Copyright © 1999 Twentieth Century Fox

Why Manage Thread Scheduling? Some threads are higher priority –Video playback Some are lower priority –Prefetching content –Indexing service Threads can also be interrupted by hardware –Key press –Network packet received Thread currently executing may not handle the event 33

The Kernel 34 Kernel Hardware Thread

The Kernel 35 Hardware Thread

Windows Scheduler Structure used by Windows to schedule threads Organized by priority One doubly linked list for each priority level PriorityThread Lists 36 Thread

Windows Scheduler Lists of threads Each points to an ETHREAD Each ETHREAD points to its EPROCESS 37 Thread

Windows Scheduler 38

The Rootkit Paradox Rootkits want to run Rootkits don’t want to be seen But to have the former, they must violate the latter Full paper E2FC4D-0B11-BC08-AD F5E68F1.pdf 39

But wait, there’s more! File handles also point to processes Kernel maintains list of handles 40 List Head

But wait, there’s more! Processes point to threads Network connections point to processes And on and on and on… For an attacker to hide, they have to update everything We just have to validate everything –Any inconsistency means we win 41

But wait, there’s more! 42

Coming Soon Unfortunately, no tools use either better magic or kernel objects –Yet Should be coming to AccessData tools in the near future 43

Outline Introduction The Kernel Direct Kernel Object Manipulation Standard DKOM Devious DKOM Better Magic Relations Between Kernel Objects Questions 44

References Brendan Dolan-Gavitt, Abhinav Srivasta, Patrick Traynor, and Jonathon Giffin, Robust Signatures for Kernel Data Structures. Proceedings of the ACM Conference on Computer and Communications Security (CCS), November 2009, Jesse Kornblum, Exploiting the Rootkit Paradox with Windows Memory Analysis, International Journal of Digital Evidence, Fall 2006, E2FC4D-0B11-BC08-AD F5E68F1.pdf 45

Questions? Jesse Kornblum 46