Operating Systems Security

Slides:



Advertisements
Similar presentations
Operating System Structures
Advertisements

CS426Fall 2010/Lecture 71 Computer Security CS 426 Lecture 7 Operating System Security Basics.
Memory Protection: Kernel and User Address Spaces  Background  Address binding  How memory protection is achieved.
Chapter 6 Security Kernels.
Virtual Memory Chapter 18 S. Dandamudi To be used with S. Dandamudi, “Fundamentals of Computer Organization and Design,” Springer,  S. Dandamudi.
CMPT 300: Operating Systems I Dr. Mohamed Hefeeda
CS 300 – Lecture 22 Intro to Computer Architecture / Assembly Language Virtual Memory.
Chapter 9 Virtual Memory Produced by Lemlem Kebede Monday, July 16, 2001.
Chapter 11 Operating Systems
Computer Organization and Architecture
Towards Application Security On Untrusted OS
November 1, 2004Introduction to Computer Security ©2004 Matt Bishop Slide #29-1 Chapter 33: Virtual Machines Virtual Machine Structure Virtual Machine.
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.
CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management.
Basics of Operating Systems March 4, 2001 Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard.
CSE598C Virtual Machines and Their Applications Operating System Support for Virtual Machines Coauthored by Samuel T. King, George W. Dunlap and Peter.
CSE 451: Operating Systems Autumn 2013 Module 6 Review of Processes, Kernel Threads, User-Level Threads Ed Lazowska 570 Allen.
Virtualization Technology Prof D M Dhamdhere CSE Department IIT Bombay Moving towards Virtualization… Department of Computer Science and Engineering, IIT.
Tanenbaum 8.3 See references
Protection and the Kernel: Mode, Space, and Context.
Systems Security & Audit Operating Systems security.
CS533 Concepts of Operating Systems Jonathan Walpole.
Topics covered: Memory subsystem CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
G53SEC 1 Reference Monitors Enforcement of Access Control.
Operating System Support for Virtual Machines Samuel T. King, George W. Dunlap,Peter M.Chen Presented By, Rajesh 1 References [1] Virtual Machines: Supporting.
Three fundamental concepts in computer security: Reference Monitors: An access control concept that refers to an abstract machine that mediates all accesses.
Introduction 1-1 Introduction to Virtual Machines From “Virtual Machines” Smith and Nair Chapter 1.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto OS-Related Hardware.
Processes and OS basics. RHS – SOC 2 OS Basics An Operating System (OS) is essentially an abstraction of a computer As a user or programmer, I do not.
Lecture 9: Memory Hierarchy Virtual Memory Kai Bu
CE Operating Systems Lecture 3 Overview of OS functions and structure.
G53SEC 1 Reference Monitors Enforcement of Access Control.
Improving Xen Security through Disaggregation Derek MurrayGrzegorz MilosSteven Hand.
Introduction to Virtual Memory and Memory Management
Security Vulnerabilities in A Virtual Environment
Introduction: Memory Management 2 Ideally programmers want memory that is large fast non volatile Memory hierarchy small amount of fast, expensive memory.
Wireless and Mobile Security
Full and Para Virtualization
Lecture 26 Virtual Machine Monitors. Virtual Machines Goal: run an guest OS over an host OS Who has done this? Why might it be useful? Examples: Vmware,
Protection of Processes Security and privacy of data is challenging currently. Protecting information – Not limited to hardware. – Depends on innovation.
Security Architecture and Design Chapter 4 Part 2 Pages 319 to 357.
PREPARED BY: MS. ANGELA R.ICO & MS. AILEEN E. QUITNO (MSE-COE) COURSE TITLE: OPERATING SYSTEM PROF. GISELA MAY A. ALBANO PREPARED BY: MS. ANGELA R.ICO.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Computer Security: Chapter 5 Operating Systems Security.
Introduction to Operating Systems Concepts
Virtual Machine Monitors
Introduction to Operating Systems
Protecting Memory What is there to protect in memory?
Protecting Memory What is there to protect in memory?
Protecting Memory What is there to protect in memory?
Chapter 1: Introduction
OS Virtualization.
Introduction to Operating Systems
Chapter 9: Virtual-Memory Management
Virtualization Techniques
Computer-System Architecture
Chapter 33: Virtual Machines
Lecture Topics: 11/1 General Operating System Concepts Processes
CSCE 313 – Introduction to UNIx process
Computer Security: Art and Science, 2nd Edition
CSE 451: Operating Systems Autumn Module 24 Virtual Machine Monitors
Sai Krishna Deepak Maram, CS 6410
Introduction to Virtual Machines
Introduction to Virtual Machines
CSE 153 Design of Operating Systems Winter 2019
COMP755 Advanced Operating Systems
In Today’s Class.. General Kernel Responsibilities Kernel Organization
Outline Introduction Memory protection Buffer overflows
Chapter 33: Virtual Machines
Presentation transcript:

Operating Systems Security Lesson Preview Understand the important role an operating system plays in computer security Learn about the need for hardware support for isolating OS from untrusted user/application code Understand key trusted computing base concepts Headshot

Operating Systems (OS) A Computer system is hardware/OS/user applications An operating system is interacts with both the applications and the Hardware.

Operating Systems Operating System: Provides easier to use and high level abstractions for resources such as address space for memory and files for disk blocks. Provides controlled access to hardware resources. Provides isolation between different processes and between the processes running untrusted/application code and the trusted operating system. Operating system has direct access to hardware resources. It provides easier to use and high level abstractions of these resources such as address space for memory and files for disk blocks. Provides isolation between different processes and between the processes running untrusted/application code and the trusted operating system.

Need for Trusting an Operating System Why do we need to trust the operating system? (AKA a trusted computing base or TCB) What requirements must it meet to be trusted? TCB Requirements: Tamper-proof, Complete mediation, and Correct Why do we need to trust the operating system (it is also called a trusted computing base or TCB) TCB Requirements: (1) Complete mediation, (2) Tamper-proof, and (3) Correct

TCB and Resource Protection TCB Controls access to protected resources Must establish the source of a request for a resource (authentication is how we do it) Authorization or access control Mechanisms that allow various policies to be supported Controls access to protected resources Must establish the source of a request for a resource (authentication is how we do it) Authorization or access control Mechanisms that allow various policies to be supported

Secure OS Quiz #1 A computer vendor ad claimed that its computers (including the OS they ran) were more secure. This claim could be based on one or more of the following: This vendor’s more secure OS met TCB requirements while the others did not. The two OS were similar as far as security was concerned but one was not as big a target. The more secure OS could be much simpler than the other one. QUIZ: A computer vendor ad claimed that its computers (including the OS they ran) were more secure. This claim could be based on one or more of the following: ☐Their more secure OS met TCB requirements while the others did not. ☐The two OS were similar as far as security was concerned but one was not as big a target. ☐The more secure OS could be much simpler than the other one. SOLUTION: Discuss

Secure OS Quiz #2 Is the cost of a system call: A system call allows application code to gain access to functionality implemented by the OS. A system call is often called a protected procedure call. Is the cost of a system call: the same as a regular call higher than a regular call QUIZ: A system call allows application code to gain access to functionality implemented by the OS. A system call is often called a protected procedure call. Is the cost of a system call ☐ same ☐ higher than a regular call? SOLUTION: Discuss

Secure OS Quiz #3 Complete mediation ensures that the OS cannot be bypassed when accessing a protected resource. How does the OS know who is making the request for the resource? Process runs on behalf of a user who must have previously logged in, Requested resource allows us to find out who must be requesting it QUIZ: Complete mediation ensures that the OS cannot be bypassed when accessing a protected resource. How does the OS know who is making the request for the resource? ☐Process runs on behalf of a user who must have previously logged in, ☐Requested resource allows us to find out who must be requesting it SOLUTION: Discuss answers

Isolating OS from Untrusted User Code How do we meet the first requirement of a TCB (e.g., isolation or tamper-proof)? Hardware support for memory protection Processor execution modes (system AND user modes, execution rings) Privileged instructions which can only be executed in system mode System calls used to transfer control between user and system code How do we meet the requirements of a TCB (e.g., isolation or tamper-proof)? Hardware support for memory protection Processor execution modes (system AND user modes, execution rings) Privileged instructions which can only be executed in system mode System calls used to transfer control between user and system code

System Calls: Going from User to OS Code System calls used to transfer control between user and system code Such calls come through “call gates” and return back to user code. The processor execution mode or privilege ring changes when call and return happen. x86 Sysenter/sysexit instructions Such calls come through “call gates” and return back to user code. The processor execution mode or privilege ring changes when call and return happen.

Isolating User Processes from Each Other How do we meet the user/user isolation and separation? OS uses hardware support for memory protection to ensure this. How do we meet the isolation OS/user isolation and separation? Hardware support for memory protection.

Tampering with the OS Quiz Which of these methods have been shown to allow hacker access to ‘secure’ memory belonging to the OS? Modification of firmware by Thunderstrike malware via malicious devices that connect via Mac’s Thunderbolt interface Exploiting the ‘refresh’ mechanism of a Dynamic RAM for privilege escalation Exploiting OS code buffer overflow vulnerability QUIZ: Before we discuss how to isolate the memory from the user. Let’s get into a Security Mindset … Think of ways a hacker can access memory. SOLUTION: The first two answers have both been shown to allow unauthorized access to memory. There are links in the instructors notes with more information. First is BadUSB hack, changes firmware which can take over a computer, modifying key OS data structures. BlackHat Thunderstrike at http://arstechnica.com/security/2015/01/worlds-first-known-bootkit-for-os-x-can-permanently-backdoor-macs/ Row hammer hack http://googleprojectzero.blogspot.com/2015/03/exploiting-dram-rowhammer-bug-to-gain.htm

Address Space: Unit of Isolation Processes view memory as contiguous often larger than available physical memory Usually 232 or 264 addresses Each process has its own mapping Discuss the logical address mapping to the physical memory. Every process views memory as contiguous, often larger than available physical memory. Usually 2^32 or 2^64 addresses Each process has its own mapping

Address Translation Operating system maps logical virtual addresses or pages onto physical memory frames Operating system maps logical virtual addresses or pages onto physical memory frames

Process Data/Code Protection OS will not map a virtual page of process A to a physical page of process B unless explicit sharing is desired. Process A cannot access process B’s memory because it has no way to name/reach its memory. Page tables managed by OS OS will not map a virtual page of process A to a physical page of process B unless explicit sharing is desired. Process A cannot access process B’s memory because it has not way to name/reach its memory. Page tables managed by OS

Process Protection through Memory Management Processor memory management unit (MMU) uses page tables to resolve virtual addresses to physical addresses. RWX bits on pages limit type of access to addressable memory Processor memory management unit (MMU) uses page tables to resolve virtual addresses to physical addresses. RWX bits on pages limit type of access to addressable memory

Revisiting Stack Overflow Quiz The stack can be exploited through: Overflowing the buffer to change the return address to alter program execution Pushing data onto the stack to overflow the stack into the heap Popping data off the stack to gain access to application code. QUIZ: Before we discuss how to create a non-executable stack, let’s discuss the stack’s exploitable weaknesses. SOLUTION: Discuss answers

Preventing Malicious Code Execution on the Stack through a Non-Executable Stack Now think, how can we do a non-executable stack to help prevent code injection via stack buffer? Used by Windows, OS X, Linux Now think how we can do a non-executable stack to help prevent code injection via stack buffer Used by Windows, OS X, Linux

OS Isolation from Application Code OS (Kernel) resides in a portion of each process’s address space. True for each process, processes can cross the fence only in controlled/limited ways. Some more details for isolation of OS from application code. OS (Kernel) resides in a portion of each process’s address space. True for each process, processes can cross the fence only in controlled/limited ways.

OS Isolation from Application Code Linux, DOS, OS X 32-bit Linux: Lower 3GB for user code/data, top 1GB for kernel Corresponds to x86 privilege ring transitions Windows and OS X similar DOS had no such fence, any process could alter DOS and viruses could spread by hooking DOS interrupt handlers via kernel changes 32-bit Linux: Lower 3GB for process, top 1GB for kernel Corresponds to x86 privilege ring transitions Windows and OS X similar DOS had no such fence, any process could alter DOS and viruses could spread by hooking DOS interrupt handlers via kernel changes

Linux User/Kernel Memory Split Discuss the illustration

Execution Privilege Level Quiz For the following described functions, Should it be executed in the operating system or if it can be executed in application code running in user mode? OS User Switching CPU from one process to another when a process blocks. Page fault handling Changing who can access a protected resource such as a file Setting up a new stack frame when an application program calls one of its functions QUIZ: For the following described function, should it be executed in the operating system or user if it can be executed in application code. Switching CPU from one process to another when a process blocks. Page fault handling Changing who can access a protected resource such as a file Setting up a new stack frame when an application program calls one of its functions SOLUTION: Discuss answers

Complete Mediation: The TCB Make sure that no protected resource (e.g., memory page or file) could be accessed without going through the TCB TCB acts as a reference monitor that cannot be bypassed Privileged instructions Complete Mediation Make sure that no protected resource (e.g., memory page or file) could be accessed without going through the TCB TCB acts as a reference monitor that cannot be bypassed

Complete Mediation: User Code User code cannot access OS part of address space without changing to system mode User code cannot access physical resources because they require privileged instructions (e.g. servicing interrupts) which can only be executed in system mode User code cannot access OS part of address space without changing to system mode User code cannot access physical resources because they require privileged instructions (e.g. servicing interrupts) which can only be executed in system mode

Complete Mediation: OS OS virtualizes physical resources and provides an API for virtualized resources File for storing persistent data on disk Virtual resource must be translated to physical resource handle (e.g., file buffers) which can only be done by OS, which ensures complete mediation OS virtualizes physical resources and provides an API for the virtualized resources File for storing persistent data on disk Virtual resource must be translated to physical resource handle (e.g., file buffers) which can only be done by OS, which ensures complete mediation

Virtualization OS is large and complex, even different operating systems may be desired by different customers Compromise of an OS impacts all applications Virtualization is used in Cloud computing systems. Let us discuss some security aspects of it. OS is large and complex, even different operating systems may be desired by different customers Compromise of an OS impacts all applications

Limiting the Damage of a Hacked OS Use: Hypervisor, virtual machines, guest OS and applications Compromise of OS in VM1 only impacts applications running on VM1 Can we limit/contain harm done by OS running some application? Hypervisor, virtual machines, guest OS and applications Compromise of OS in VM1 only impacts applications running on VM2

Limiting the Damage of a Hacked OS Do your taxes in on VM1 while browsing potentially dangerous places on the web on VM2 What is the TCB here? Hypervisor! Do your taxes in one VM while browsing potentially dangerous places on the web on VM2 What is the TCB here? Hypervisor!

Virtualization Security Layers Discuss the security layers.

Correctness: The Final TCB Requirement Compromise of OS (TCB) means an attacker has access to everything. Getting the TCB right is extremely important Smaller and simpler (hypervisor only partitions physical resources among VMs and let us guest OS handle management) Secure coding is really important when writing the OS which typically is written in languages that are not type safe orrectness – Final Requirement of TCB Compromise of OS (TCB) means all bets are off, attacker has access to everything. Getting the TCB is extremely important Smaller and simpler (hypervisor only partitions physical resources among VMs and let us guest OS handle management) Secure coding is really important when writing the OS which typically is written in languages that are not type safe We will talk more about trustworthiness of TCB

TCB Requirements Quiz Complete mediation Correctness Tamper-proof An attack that exploits a vulnerability in an operating system turns off the check that is performed before access to a protected resource is granted. What TCB requirement is violated as a result of this attack? Complete mediation Correctness Tamper-proof QUIZ: An attack that exploits a vulnerability in an operating system turns off the check that is performed before access to a protected resource is granted. What TCB requirement is violated as a result of this attack? ☐ Complete mediation ☐ Correctness ☐ Tamper-proof SOLUTION: Discuss answers

Size of Security Code Quiz Going from MS DOS to recent Windows operating systems, what is a rough estimate for the multiplier for the lines of code (e.g. multiplier is x if recent Windows OS is x times the number of lines of code in DOS)? Windows OS is 100x larger than MS DOS Windows OS is 500x larger than MS DOS Windows OS is 10,000x larger than MS DOS QUIZ: Getting an OS correct is challenging because of its size which reflects complexity of its functions. Going from MS DOS to recent Windows operating systems, what is a rough estimate for the multiplier for the lines of code (e.g. multiplier is x if recent Windows OS is x times the number of lines of code in DOS)? ☐ Windows OS is 100 x larger than MS DOS ☐ Windows OS is 500 x larger than MS DOS ☐ Windows OS is 2000 x larger than MS DOS SOLUTION: Discuss -- MS DOS 1.0 4000 lines of assembler code

Hypervisor Code Size Quiz The number of lines of code in a hypervisor is expected to be smaller. Xen is an open source hypervisor. What is a rough estimate for the lines of code for the Xen hypervisor? 10,000 150,000 1,000,000 QUIZ: The number of lines of code in a hypervisor is expected to be smaller. Xen is an open source hypervisor. What is a rough estimate for the lines of code for hypervisor? ☐ 10,000 ☐ 150,000 ☐ 1,000,000 SOLUTION: Discuss

Operating Systems Security Lesson Summary Understand the important role an OS plays in protecting resources and applications Understand how OS is isolated from untrusted code with hardware support for memory management Understand how complete mediation is provided. Headshot