+ All Categories
Home > Documents > CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based...

CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based...

Date post: 10-Mar-2018
Category:
Upload: dinhminh
View: 213 times
Download: 0 times
Share this document with a friend
37
CIS 5373 – Systems Security Topic 3.1: OS Security – Basics of secure design Endadul Hoque
Transcript
Page 1: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

CIS 5373 – Systems SecurityTopic 3.1: OS Security – Basics of secure design

Endadul Hoque

Page 2: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

Slide Acknowledgment

• Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh(Stanford)

2

Page 3: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

What security goals does an operating system provide?

3

• Originally: time-sharing computers: enabling multiple users to securely share a computer

– Separation and sharing of processes, memory, files, devices, etc.

• What is the threat model?

– Users may be malicious, users have terminal access to computers, software may be malicious/buggy, and so on

• Security mechanisms

– Memory protection

– Processor modes

– User authentication

– File access control

Page 4: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

• More recent past and present: Networked desktop computers: ensure secure operation in networked environment

• New threat?

– Attackers coming from the network. Network-facing programs on computers may be buggy. Users may be hurt via online communication.

• Security mechanisms

– Authentication; Access Control

– Secure Communication (using cryptography)

– Logging & Auditing

– Intrusion Prevention and Detection

– Recovery 4

What security goals does an operating system provide?

Page 5: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

• Present and near future: mobile computing devices

• New threat?

– Apps (programs) may be malicious or questionable.

– More tightly connected with personal life of the owner.

• Security mechanisms?

– Isolation of each app.

– Help users assess risks of apps.

– Risk communication. 5

What security goals does an operating system provide?

Page 6: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

Principles of Secure Design

• Compartmentalization– Isolation

– Principle of least privilege

• Defense in depth– Use more than one security mechanism

– Secure the weakest link

– Fail securely

• Keep it simple

6

Page 7: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

Principles of Least Privilege

• Principle of Least Privilege

– A system module should only have the minimal privileges needed for its intended purposes

• What’s a privilege?

– Ability to access or modify a resource

• Assumes compartmentalization and isolation

– Separate the system into isolated compartments

– Limit interaction between compartments

7

Page 8: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

Monolithic design

8

System

Network

User input

File system

Network

User device

File system

Page 9: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

Monolithic design

9

System

Network

User input

File system

Network

User device

File system

Page 10: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

Monolithic design

10

System

Network

User input

File system

Network

User device

File system

Page 11: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

Component design

11

Network

User input

File system

Network

User display

File system

Page 12: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

Component design

12

Network

User input

File system

Network

User display

File system

Page 13: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

Component design

13

Network

User input

File system

Network

User display

File system

Page 14: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

Example: Mail Agent

• Requirements

– Receive and send email over external network

– Place incoming email into local user inbox files

• Sendmail

– Traditional Unix

– Monolithic design

– Historical source of many vulnerabilities

• Qmail

– Compartmentalized design

14

Page 15: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

Memory Protection: Access Control to Memory

• Ensures that one user’s process cannot access other’s memory– fence

– relocation

– base/bounds register

– segmentation

– paging

– …

• Operating system and user processes need to have different privileges

15Reading: http://flylib.com/books/en/4.270.1.46/1/

Page 16: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

CPU modes (aka Processor modes or privilege)

• System mode (privileged mode, master mode, supervisor mode, kernel mode)

– Can execute any instruction

– Can access any memory locations, e.g., accessing hardware devices,

– Can enable and disable interrupts,

– Can change privileged processor state,

– Can access memory management units,

– Can modify registers for various descriptor tables

16

Reading: http://en.wikipedia.org/wiki/CPU_modes

Page 17: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

CPU modes (aka Processor modes or privilege)

• User mode

– Access to memory is limited,

– Cannot execute some instructions

– Cannot disable interrupts,

– Cannot change arbitrary processor state,

– Cannot access memory management units

• Transition from user mode to system mode can only happen via well defined entry points, i.e., through system calls

17

Reading: http://en.wikipedia.org/wiki/CPU_modes

Page 18: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

System Calls

• Guarded gates from user mode (space, land) into kernel mode (space, land)– use a special CPU instruction (often an

interruption) to transfer control to predefined entry point in more privileged code

– allows the more privileged code to specify where it will be entered as well as important processor state at the time of entry

– the higher privileged code, by examining processor state set by the less privileged code and/or its stack, determines what is being requested and whether to allow it

18

Reading: http://en.wikipedia.org/wiki/System_call

Page 19: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

Kernel space vs User space

• Part of the OS runs in the kernel model

– known as the OS kernel

• Other parts of the OS run in the user mode, including service programs (daemon programs), user applications, etc.

– they run as processes

– they form the user space (or the user land)

• Why is root user more powerful than normal users?

19

Page 20: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

Privilege Levels

• Security is often achieved by running control/protection code at a higher privilege level

• Components running at the same level can be isolated by a higher-privilege component

• If attack and defense are at the same level, then it is an arms’ race and there can be no guarantee

20

Page 21: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

ISOLATION – THE CONFINEMENT PRINCIPLE

OS Security

21

Page 22: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

Running untrusted code

• We often need to run buggy/unstrusted code:

– programs from untrusted Internet sites:• apps, extensions, plug-ins, codecs for media player

– exposed applications: pdf viewers, outlook

– legacy daemons: sendmail, bind

– Honeypots

• Goal: if application “misbehaves” ⇒ kill it

22

Page 23: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

Approach: Confinement

Confinement: ensure misbehaving app cannot harm rest of system

Can be implemented at many levels:

– Hardware: run application on isolated hw (air gap)

⇒ difficult to manage23

air gap network 1Network 2

app 1 app 2

Page 24: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

Approach: Confinement

Confinement: ensure misbehaving app cannot harm rest of system

Can be implemented at many levels:

– Virtual machines: isolate OS’s on a single machine

24

Virtual Machine Monitor (VMM)

OS1 OS2

app1 app2

Page 25: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

Approach: Confinement

Confinement: ensure misbehaving app cannot harm rest of system

Can be implemented at many levels:

– Process: System Call Interposition

Isolate a process in a single operating system

25

Operating System

process 2

process 1

Page 26: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

Approach: Confinement

Confinement: ensure misbehaving app cannot harm rest of system

Can be implemented at many levels:

– Threads: Software Fault Isolation (SFI)

• Isolating threads sharing same address space

– Application: e.g. browser-based confinement

26

Page 27: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

Implementing Confinement

• Key component: reference monitor

– Mediates requests from applications• Implements protection policy

• Enforces isolation and confinement

– Must always be invoked:• Every application request must be mediated

– Tamperproof:• Reference monitor cannot be killed

• … or if killed, then monitored process is killed too

– Small enough to be analyzed and validated

27

Page 28: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

System call interposition

• Observation: to damage host system (e.g. persistent changes) app must make system calls:

– To delete/overwrite files: unlink, open, write

– To do network attacks: socket, bind, connect, send

• Idea: monitor app’s system calls and block unauthorized calls

• Implementation options:

– Completely kernel space (e.g. GSWTK)

– Completely user space (e.g. program shepherding)

– Hybrid (e.g. Systrace)

28

Page 29: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

System call interposition

Linux ptrace: process tracing

process calls: ptrace (… , pid_t pid , …)

and wakes up when pid makes sys call.

Monitor kills application if request is disallowed29

OS Kernel

monitoredapplication

(browser)monitor

user space

open(“/etc/passwd”, “r”)

Page 30: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

System call interposition

• If app forks, monitor must fork

– Forked-monitor monitors forked-app

• If monitor crashes, app must be killed

• Monitor must maintain all OS state associated with app

– current-working-dir (CWD), UID, EUID, GID

– When app does “cd path” • monitor must update its CWD

• otherwise: relative path requests interpreted incorrectly

30

cd(“/tmp”)open(“passwd”, “r”)

cd(“/etc”)open(“passwd”, “r”)

Complications:

Page 31: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

Virtual Machines

31

Virtual Machine Monitor (VMM)

Guest OS 2

Apps

Guest OS 1

Apps

Hardware

Host OS

VM2 VM1

Page 32: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

VMM security assumption

VMM Security assumption:

– Malware can infect guest OS and guest apps

– But malware cannot escape from the infected VM

• Cannot infect host OS

• Cannot infect other VMs on the same hardware

Requires that VMM protect itself and is not buggy

– VMM is much simpler than full OS

… but device drivers run in Host OS32

Page 33: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

Problem: Covert channels

• Covert channel: unintended communication channel between isolated components

– Can be used to leak classified data from secure component to public component

33

Classified VM Public VM

secretdoc

ma

lwa

re

listenercovert

channel

VMM

Page 34: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

An example covert channel

• Both VMs use the same underlying hardware

• To send a bit b ∈ {0,1} malware does:

– b = 1: at 1:00am do CPU intensive calculation

– b = 0: at 1:00am do nothing

• At 1:00am listener does CPU intensive calc. and measures completion time

– b = 1 ⇒ completion-time > threshold

• Many covert channels exist in running system:

– File lock status, cache contents, interrupts, …

– Difficult to eliminate all34

Page 35: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

VMM introspection – protecting IDS/AV systems

Intrusion detection / Anti-virus

• Runs as part of OS kernel and user space process

– Kernel root kit can shutdown protection system

– Common practice for modern malware

• Standard solution: run IDS system in the network

– Problem: insufficient visibility into user’s machine

35

Page 36: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

VMM introspection – protecting IDS/AV systems

Better: run IDS as part of VMM (protected from malware)

– VMM can monitor virtual hardware for anomalies

– VMI: Virtual Machine Introspection

• Allows VMM to check Guest OS internals

36

Infected VMma

lwa

re

VMM

Guest OS

Hardware

IDS

Subversion of VMI is possible

Page 37: CIS 5373 Systems Securityehoque/teaching/cis5373-fall...Slide Acknowledgment •Contents are based on slides from Ninghui Li (Purdue), John Mitchell (Stanford), Dan Boneh (Stanford)

Coming up

• Access control

37


Recommended