Lecture 5 Rootkits Hoglund/Butler (Chapters 1-3).

Slides:



Advertisements
Similar presentations
1/1/ / faculty of Electrical Engineering eindhoven university of technology Memory Management and Protection Part 3:Virtual memory, mode switching,
Advertisements

Memory Protection: Kernel and User Address Spaces  Background  Address binding  How memory protection is achieved.
Secure In-VM Monitoring Using Hardware Virtualization Monirul Sharif, Wenke Lee, Weidong Cui, and Andrea Lanzi Presented by Tyler Bletsch.
Operating System Security : David Phillips A Study of Windows Rootkits.
CMPT 300: Operating Systems I Dr. Mohamed Hefeeda
CMPT 300: Final Review Chapters 8 – Memory Management: Ch. 8, 9 Address spaces Logical (virtual): generated by the CPU Physical: seen by the memory.
Architectural Support for OS March 29, 2000 Instructor: Gary Kimura Slides courtesy of Hank Levy.
Windows Security and Rootkits Mike Willard January 2007.
X86 segmentation, page tables, and interrupts 3/17/08 Frans Kaashoek MIT
Memory Management (II)
OS Fall ’ 02 Introduction Operating Systems Fall 2002.
Operating System Structure. Announcements Make sure you are registered for CS 415 First CS 415 project is up –Initial design documents due next Friday,
Introduction to Kernel
OS Spring’03 Introduction Operating Systems Spring 2003.
Advanced OS Chapter 3p2 Sections 3.4 / 3.5. Interrupts These enable software to respond to signals from hardware. The set of instructions to be executed.
Operating Systems CS208. What is Operating System? It is a program. It is the first piece of software to run after the system boots. It coordinates the.
OS Spring’04 Introduction Operating Systems Spring 2004.
Chapter 9 Security Malware Defenses. Malware Can be used for a form of blackmail. Example: Encrypts files on victim disk, then displays message.
What do operating systems do? manage processes manage memory and computer resources provide security features execute user programs make solving user.
1 CS503: Operating Systems Part 1: OS Interface Dongyan Xu Department of Computer Science Purdue University.
System Calls 1.
G53SEC 1 Reference Monitors Enforcement of Access Control.
Three fundamental concepts in computer security: Reference Monitors: An access control concept that refers to an abstract machine that mediates all accesses.
Rootkits in Windows XP  What they are and how they work.
Architecture Support for OS CSCI 444/544 Operating Systems Fall 2008.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
Windows 2000 Course Summary Computing Department, Lancaster University, UK.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
Week 10-11c Attacks and Malware III. Remote Control Facility distinguishes a bot from a worm distinguishes a bot from a worm worm propagates itself and.
CE Operating Systems Lecture 3 Overview of OS functions and structure.
G53SEC 1 Reference Monitors Enforcement of Access Control.
© 2004, D. J. Foreman 1 Implementing Processes and Threads.
1 CSE451 Architectural Supports for Operating Systems Autumn 2002 Gary Kimura Lecture #2 October 2, 2002.
Lecture Topics: 10/29 Architectural support for operating systems –timers –kernel mode –system calls –protected instructions.
We will focus on operating system concepts What does it do? How is it implemented? Apply to Windows, Linux, Unix, Solaris, Mac OS X. Will discuss differences.
UNIX Unit 1- Architecture of Unix - By Pratima.
Operating Systems Security
1 Lecture 1: Computer System Structures We go over the aspects of computer architecture relevant to OS design  overview  input and output (I/O) organization.
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
Lecture 7 Rootkits Hoglund/Butler (Chapter 5-6). Avoiding detection Two ways rootkits can avoid detection –Modify execution path of operating system to.
10. Epilogue ENGI 3655 Lab Sessions.  We took control of the computer as early as possible, right after the end of the BIOS  Our multi-stage bootloader.
Lecture 8 Rootkits Hoglund/Butler (Chapter 7-8). Avoiding detection Two ways rootkits can avoid detection –Modify execution path of operating system to.
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.
CSCI/CMPE 4334 Operating Systems Review: Exam 1 1.
Introduction to Operating Systems Concepts
Introduction to Operating Systems
Memory Protection: Kernel and User Address Spaces
Anton Burtsev February, 2017
Chapter 1: Introduction
CS 3305 System Calls Lecture 7.
x86 segmentation, page tables, and interrupts
Introduction to Operating Systems
OS Virtualization.
Memory Protection: Kernel and User Address Spaces
Introduction to Operating Systems
Memory Protection: Kernel and User Address Spaces
Memory Protection: Kernel and User Address Spaces
Undermining the Linux Kernel: Malicious Code Injection via /dev/mem
CS-3013 Operating Systems Hugh C. Lauer
Architectural Support for OS
Modern PC operating systems
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.
CSE 451: Operating Systems Winter 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 412 Sieg Hall 1.
Architectural Support for OS
Operating Systems Structure
Chapter 1: Introduction CSS503 Systems Programming
Memory Protection: Kernel and User Address Spaces
Interrupts and System Calls
Presentation transcript:

Lecture 5 Rootkits Hoglund/Butler (Chapters 1-3)

Rootkits A set of small and useful programs that allow an attacker to maintain access to “root” on a computer –Remote command and control (bots) –Software eavesdropping What they are not –Not an exploit –Not a virus

How do they work? Modifications to software –Patching binaries on disk –Easter eggs (for developers to access later) –Source-code modifications Two goals –Maintain access even through firewalls –Remain hidden from Host IDS, Network IDS, and forensic tools

The kernel Process management File system Security Memory management

Rootkit functions Hide files Hide registry entries Hide processes Modify boot service to start rootkit Modify network operations and services

Getting into the kernel Loadable modules –commonly used for third-party hardware support on Windows and Linux –device driver or kernel driver runs in kernel has access to all of the privileged memory of kernel registers a name for access from user space (i.e. \\Device\\MyDevice) \\Device\\MyDevice Used in conjunction with user-mode code –easier to debug and support functionality in user mode –open device name (i.e. \\Device\\MyDevice)\\Device\\MyDevice –use ioctl/read/write to communicate to driver

Surviving reboot Using the “run key” in registry –Can be checked at boot time by anti-virus –Rootkit hides the value after being loaded Using a trojan or infected file –Replace a different.sys or executable that is run at boot-time –Modify search path to change DLL being used Using.ini files –Initialization files that specify executables to run and DLLs to load (win.ini) Registering as a driver –Loaded on boot, but also visible at boot since it needs registry key –Rootkit hides key after being loaded

Surviving reboot Registering as an add-on to existing application –Like a toolbar on a web browser Modifying on-disk kernel –Modify boot loader to allow new kernel to pass checksum integrity check Modify boot loader –Have boot loader apply patches to kernel before loading Other possibilities?

Hardware interaction: rings Intel x86 supports 4 rings –Ring 0 = highest-privilege (kernel code) Access to all memory Access to special processor instructions/registers that directly alter CPU behavior –Ring 3 = lowest-privilege (user programs) –Windows/Linux do not use Ring 1 and 2 typically –Administrator programs running in Ring 3 will need to get Ring 0 privileges from the kernel to perform operations Rootkits typically try to run at Ring 0

Hardware interaction: tables Some CPU conditions require software routines to be handle them –Interrupts, exceptions, page faults, etc. –Too many conditions to keep track of all of them in hardware –CPU contains base address for tables that contain pointers to routines CPU tables –Global Descriptor Table (used to map addresses) –Local Descriptor Table (used to map addresses) –Page Directory (used to map addresses) –Interrupt Descriptor Table (used to find interrupt handlers) OS tables –OS-implemented tables not directly supported by CPU –System Service Dispatch Table (handling system calls)

Hardware interaction: tables Global and local descriptor tables –Code segment register (CS) points to where program is stored Can be modified by any program via use of “far call” “ far jump” or “far return” –Call gates Special descriptor that allows a new ring level to be specified when “far call” used Useful for allowing user-mode programs to make a function call into kernel mode

Hardware interaction: tables Interrupt descriptor tables –IDT register stores base of IDT One IDTR per CPU –IDT contains array of 256 entries (one for each interrupt) IDT entry can specify privilege level to run at (“interrupt gate”) Useful in getting to kernel mode via interrupts (i.e. system calls generate interrupts) –Other gates Trap gates = can be interrupted by maskable ints Task gates = outdated, hardware support for switching task –Not used by windows or linux (which do it in software)

Hardware interaction: memory Page directory tables –CPU handles memory access CPU checks whether process can open book (descriptor check) –Check to see if segment being accessed has sufficient privilege CPU checks whether process can read certain chapter in book (page directory check) –Check to see if page table being accessed has sufficient privilege CPU checks whether process can read particular page in chapter (page check) –Check to see if page being accessed has sufficient privilege –CPU uses special register CR3 to point to an array of bit values called the page directory Each process has its own unique value of CR3 (its own page directory) Threads of a process share CR3 value Each 32-bit value specifies base address of a page table in physical memory

Hardware interaction: SSDT System Service Dispatch Table –System calls –Two ways Use int 0x2e Call SYSENTER instruction

Subverting tables Overwriting SSDT and IDT entries –Memory pages containing SSDT and IDT are set to read-only in the page table –Attacker must change pages to read/write in order to alter the pages –Rootkits do this using CR0 trick or via registry key modifications CR0 controls whether memory access protection in the kernel is enforced WP bit = controls whether processor will allow writes to memory pages marked as read-only –Counter-measure scanners check integrity of original IDT –Counter-counter-measure Hackers create copy of IDT somewhere else, modify it, and change IDTR to point to modified one (more later)

Multiprocessor issues Each CPU contains its own interrupt table –Hooks should be done across all CPUs –Drivers must perform synchronization to avoid system crash