CS 333 Introduction to Operating Systems Class 20

  • Slides: 93
Download presentation
CS 333 Introduction to Operating Systems Class 20 - Security Jonathan Walpole q Computer

CS 333 Introduction to Operating Systems Class 20 - Security Jonathan Walpole q Computer Science Portland State University q q

Overview q q q Overview of security issues User authentication Protection domains and protection

Overview q q q Overview of security issues User authentication Protection domains and protection mechanisms Internal attacks v Trojan horses, spoofing, logic bombs, trap doors, buffer overflow attacks External attacks v Viruses, worms, mobile code, sand boxing, Intro to cryptography tools v one-way functions, public vs private key encryption, hash functions, and digital signatures

Security overview q q Security flavors v Confidentiality - Ability to protect secrets v

Security overview q q Security flavors v Confidentiality - Ability to protect secrets v Integrity -Ability to protect the data contents v Availability - Ability to continue to operate Know thy enemy! v User stupidity (bad default settings from companies) v Insider snooping v Outsider snooping v Blatant attacks (viruses and worms) v Bots

Accidental data loss q q q Acts of God v fires, floods, wars Hardware

Accidental data loss q q q Acts of God v fires, floods, wars Hardware or software errors v CPU malfunction, bad disk, program bugs Human errors v data entry, wrong tape mounted v “you” are probably the biggest threat you’ll ever face

User Authentication

User Authentication

User authentication q q This is done before user can use the system !

User authentication q q This is done before user can use the system ! v Subsequent activities, processes etc are associated with this user Basic Principles. Authentication must identify: v Something the user knows v Something the user has v Something the user is

Authentication using passwords (a) A successful login (b) Login rejected after name entered (easier

Authentication using passwords (a) A successful login (b) Login rejected after name entered (easier to crack) (c) Login rejected after name and password typed (larger search space)

Problems with pre-set values q How a cracker broke into LBL v a U.

Problems with pre-set values q How a cracker broke into LBL v a U. S. Dept. of Energy research lab

Authentication using passwords and salt , , Salt q Password The use of salt

Authentication using passwords and salt , , Salt q Password The use of salt to defeat precomputation of encrypted passwords v salt changes each time password changes v increases the size of the search space

Authentication using passwords q Main challenges v Search space needs to be large enough

Authentication using passwords q Main challenges v Search space needs to be large enough that automated attacks can not succeed v Selecting passwords from dictionary words results in too small a search space v Random combinations of characters in a long string is hard to remember • If you store it somewhere it can be seen by others

More counter-measures q q q Better passwords v No dictionary words, special characters, longer

More counter-measures q q q Better passwords v No dictionary words, special characters, longer Don’t give up information v Login prompts or any other time One time passwords v Satellite driven security cards Limited-time passwords v Annoying but effective Challenge-response pairs v Ask questions Physical authentication combined with passwords v Perhaps combined with challenge response too

Authentication using a physical object q Magnetic cards v magnetic stripe cards v chip

Authentication using a physical object q Magnetic cards v magnetic stripe cards v chip cards: stored value cards, smart cards

Authentication using biometrics A device for measuring finger length.

Authentication using biometrics A device for measuring finger length.

Attacks on the authentication process q q Authentication - making sure the user is

Attacks on the authentication process q q Authentication - making sure the user is the user Attacks include v Viewing of passwords kept in the clear • Written on desk, included in a network packet etc… v Network packet sniffers • Listen to the network and record login sessions v Snooping • observing key strokes v Automated bots • Try a password every minute (don’t get greedy)

Counter-measures to combat attackers q q q Limiting times when someone can log in

Counter-measures to combat attackers q q q Limiting times when someone can log in Automatic callback at a pre-specified number Limited number or frequency of login tries Keep a database of all logins Honey pot v leave simple login name/password as a trap v security personnel notified when attacker bites

Verifying the user is a human

Verifying the user is a human

Protection Domains

Protection Domains

Protection domains q Suppose that we have successfully authenticated the user, now what? v

Protection domains q Suppose that we have successfully authenticated the user, now what? v For each process created we can keep track of who it belongs to • All its activities are on behalf of this user v We can check all of its accesses to resources • Files, memory, devices … v We may need mechanisms for temporarily allowing access to privileged resources in a controlled way

Protection domains q q Every process executes in some protection domain v determined by

Protection domains q q Every process executes in some protection domain v determined by its creator, authenticated at login time OS mechanisms for switching protection domains v system calls v set UID capability on executable file v re-authenticating user

A protection matrix specifies the operations that are allowable on objects by a process

A protection matrix specifies the operations that are allowable on objects by a process executing in a domain.

Protection matrix with domains as objects Domain Operations may include switching to other domains

Protection matrix with domains as objects Domain Operations may include switching to other domains

Protection domains q A protection matrix is just an abstract representation for allowable operations

Protection domains q A protection matrix is just an abstract representation for allowable operations v We need protection “mechanisms” to enforce the rules defined by a set of protection domains

Protection Mechanisms

Protection Mechanisms

Access control lists (ACLs) Domain q Domain matrix is typically large and sparse v

Access control lists (ACLs) Domain q Domain matrix is typically large and sparse v inefficient to store the whole thing v store occupied columns only, with the resource? - ACLs v store occupied rows only, with the domain? - Capabilities

Access control lists for file access Example: Owner’s ID stored in PCB File owner’s

Access control lists for file access Example: Owner’s ID stored in PCB File owner’s ID and access permissions stored in inode

Access Control Lists (2) q Two access control lists with user names and roles

Access Control Lists (2) q Two access control lists with user names and roles (groups)

Capabilities Domain q Domain matrix is typically large and sparse v inefficient to store

Capabilities Domain q Domain matrix is typically large and sparse v inefficient to store the whole thing v store occupied columns only, with the resource? - ACLs v store occupied rows only, with the domain? - Capabilities

Capabilities associated with processes q Each process has a capability for every resource it

Capabilities associated with processes q Each process has a capability for every resource it can access v Kept with other process meta data v Checked by the kernel on every access

Cryptographically-protected capabilities q Cryptographically-protected capability could be held in user space v Saves kernel

Cryptographically-protected capabilities q Cryptographically-protected capability could be held in user space v Saves kernel resources Server q Object Rights Generic Rights v Copy capability v Copy object v Remove capability v Destroy object f(Objects, Rights, Check)

Internal Attacks

Internal Attacks

Login spoofing (a) Correct login screen (b) Phony login screen

Login spoofing (a) Correct login screen (b) Phony login screen

Which would you rather log into?

Which would you rather log into?

Trojan horses q q q Free program made available to unsuspecting user v Actually

Trojan horses q q q Free program made available to unsuspecting user v Actually contains code to do harm Place altered version of utility program on victim's computer v trick user into running that program v example, ls attack Trick the user into executing something they shouldn’t

Logic bombs q q Revenge driven attack Company programmer writes program v potential to

Logic bombs q q Revenge driven attack Company programmer writes program v potential to do harm v OK as long as he/she enters password daily v if programmer fired, no password and bomb “explodes”

Trap doors (a) Normal code. (b) Code with a trapdoor inserted

Trap doors (a) Normal code. (b) Code with a trapdoor inserted

Buffer overflow attacks q q q (a) Situation when main program is running (b)

Buffer overflow attacks q q q (a) Situation when main program is running (b) After program A called (c) Buffer overflow shown in gray

Buffer overflow attacks q The basic idea v v v exploit lack of bounds

Buffer overflow attacks q The basic idea v v v exploit lack of bounds checking to overwrite return address and to insert new return address and code at that address exploit lack of separation between stack and code (ability to execute both) allows user (attacker) code to be placed in a set UID root process and hence executed in a more privileged protection domain

Other generic security attacks q q q Request memory, disk space, tapes and just

Other generic security attacks q q q Request memory, disk space, tapes and just read Try to do specified DO NOTs v Try illegal operations Start a login and hit DEL, RUBOUT, or BREAK Convince a system programmer to add a trap door Beg someone with access to help a poor user who forgot their password

Famous security flaws (a) q (b) (c) The TENEX password problem v Place password

Famous security flaws (a) q (b) (c) The TENEX password problem v Place password across page boundary, ensure second page not in memory, and register user-level page fault handler v OS checks password one char at a time • If first char incorrect, no page fault occurs • requires 128 n tries instead of 128 n

Design principles for security q q q System design should be public v Security

Design principles for security q q q System design should be public v Security through obscurity doesn’t work! Default should be no access Check for “current” authority Give each process least privilege possible Protection mechanism should be simple uniform in lowest layers of system Scheme should be psychologically acceptable And … keep it simple!

External Attacks

External Attacks

External threats and viruses q q q External threat v code transmitted to target

External threats and viruses q q q External threat v code transmitted to target machine v code executed there, doing damage v may utilize an internal attack to gain more privilege (ie. Buffer overflow) Virus = program that can reproduce itself v attach its code to another program Goals of virus writer v quickly spreading virus v difficult to detect v hard to get rid of

Virus damage scenarios q q q Blackmail Denial of service as long as virus

Virus damage scenarios q q q Blackmail Denial of service as long as virus runs Permanently damage hardware Target a competitor's computer v do harm v espionage Intra-corporate dirty tricks v sabotage another corporate officer's files

How viruses work q q Virus written in assembly language Inserted into another program

How viruses work q q Virus written in assembly language Inserted into another program v q use tool called a “dropper” Virus dormant until program executed v v then infects other programs eventually executes its “payload”

Searching for executable files to infect Recursive procedure that finds executable files on a

Searching for executable files to infect Recursive procedure that finds executable files on a UNIX system Virus could infect them all

How viruses hide An executable program Virus at the front (program shifted, size increased)

How viruses hide An executable program Virus at the front (program shifted, size increased) Virus at the end (size increased) With a virus spread over free space within program q q v less easy to spot, size may not increase

Viruses that capture interrupt vectors q q q After virus has captured interrupt, trap

Viruses that capture interrupt vectors q q q After virus has captured interrupt, trap vectors After OS has retaken printerrupt vector After virus has noticed loss of printerrupt vector and recaptured it

How viruses spread q Virus placed where likely to be copied or executed q

How viruses spread q Virus placed where likely to be copied or executed q When it arrives at a new machine v v q infects programs on hard drive, floppy may try to spread over LAN Attach to innocent looking email v when it runs, use mailing list to replicate further

Antivirus and anti-antivirus techniques (a) (b) (c) (d) (e) A program An infected program

Antivirus and anti-antivirus techniques (a) (b) (c) (d) (e) A program An infected program A compressed infected program An encrypted virus A compressed virus with encrypted compression code

Anti-antivirus techniques q Examples of a polymorphic virus v All of these examples do

Anti-antivirus techniques q Examples of a polymorphic virus v All of these examples do the same thing

Antivirus software q q Integrity checkers v use checksums on executable files v hide

Antivirus software q q Integrity checkers v use checksums on executable files v hide checksums to prevent tampering? v encrypt checksums and keep key private Behavioral checkers v catch system calls and check for suspicious activity v what does “normal” activity look like?

Virus avoidance and recovery q Virus avoidance v good OS v firewall v install

Virus avoidance and recovery q Virus avoidance v good OS v firewall v install only shrink-wrapped software v use antivirus software v do not click on attachments to email v frequent backups • Need to avoid backing up the virus! • Or having the virus infect your backup/restore software q Recovery from virus attack v halt computer, reboot from safe disk, run antivirus software

The Internet worm q Robert Morris constructed the first Internet worm v Consisted of

The Internet worm q Robert Morris constructed the first Internet worm v Consisted of two programs • bootstrap to upload worm and the worm itself v v Worm first hid its existence then replicated itself on new machines Focused on three flaws in UNIX • rsh – exploit local trusted machines • fingerd – buffer overflow attack • sendmail – debug problem q It was too aggressive and he was caught

Availability and denial of service attacks q Denial of service (Do. S) attacks v

Availability and denial of service attacks q Denial of service (Do. S) attacks v Examples of known attacks • Breaking end systems – Ping of death – large ping packets – Teardrop – overlapping IP segments • SYN floods • UDP floods • Window bombs (in browsers) q Usually prevented by some sort of firewall but not always effective

Security Approaches for Mobile Code

Security Approaches for Mobile Code

Sandboxing (a) Memory divided into 1 -MB sandboxes v each applet has two sandboxes,

Sandboxing (a) Memory divided into 1 -MB sandboxes v each applet has two sandboxes, one for code and one for data v some static checking of addresses (b) Code inserted for runtime checking of dynamic target addresses

Interpretation Applets can be interpreted by a Web browser

Interpretation Applets can be interpreted by a Web browser

Code signing How code signing works

Code signing How code signing works

Type safe languages A type safe language q v compiler rejects attempts to misuse

Type safe languages A type safe language q v compiler rejects attempts to misuse variables Checks include … q • • • Attempts to forge pointers Violation of access restrictions on private class members Misuse of variables by type Generation of stack over/underflows Illegal conversion of variables to another type

Covert Channels

Covert Channels

Covert channels Client, server and collaborator processes Encapsulated server can still leak to collaborator

Covert channels Client, server and collaborator processes Encapsulated server can still leak to collaborator via covert channels

Locking as a covert channel A covert channel using file locking

Locking as a covert channel A covert channel using file locking

Covert channels q q Pictures appear the same Picture on right has text of

Covert channels q q Pictures appear the same Picture on right has text of 5 Shakespeare plays v v encrypted, inserted into low order bits of color values (assume high resolution images) Zebras Hamlet, Macbeth, Julius Caesar Merchant of Venice, King Lear

Spare Slides

Spare Slides

Brief Introduction to Cryptography Tools

Brief Introduction to Cryptography Tools

Basics of Cryptography Relationship between the plaintext and the ciphertext

Basics of Cryptography Relationship between the plaintext and the ciphertext

Cryptography: confidentiality and integrity

Cryptography: confidentiality and integrity

Secret-key cryptography q Example: mono-alphabetic substitution Plaintext: ABCDEFGHIJKLMNOPQRSTUVWXYZ Cyphertext: QWERTYUIOPASDFGHJKLZXCVBNM q Given the encryption

Secret-key cryptography q Example: mono-alphabetic substitution Plaintext: ABCDEFGHIJKLMNOPQRSTUVWXYZ Cyphertext: QWERTYUIOPASDFGHJKLZXCVBNM q Given the encryption key (QWERTYUIOPASDFGHJKLZXCVBNM), v v q easy to find decryption key using statistical properties of natural language (common letters and digrams) … despite size of search space of 26! possible keys Function should be more complex and search space very large.

Symmetric cryptography: DES Mangler function q DES operates on 64 -bit blocks of data

Symmetric cryptography: DES Mangler function q DES operates on 64 -bit blocks of data v initial permutation v 16 rounds of transformations each using a different encryption key

Per-round key generation in DES q Each key derived from a 56 -bit master

Per-round key generation in DES q Each key derived from a 56 -bit master by mangling function based on splitting, rotating, bit extraction and combination

Symmetric (secret) key cryptography q q q Fast for encryption and decryption Difficult to

Symmetric (secret) key cryptography q q q Fast for encryption and decryption Difficult to break analytically Subject to brute force attacks v q as computers get faster must increase the number of rounds and length of keys Main problem v how to distribute the keys in the first place?

Public-key cryptography q q Use different keys for encryption and decryption Knowing the encryption

Public-key cryptography q q Use different keys for encryption and decryption Knowing the encryption key doesn’t help you decrypt v v v q the encryption key can be made public encryption key is given to sender decryption key is held privately by the receiver But how does it work?

Public-key cryptography q Asymmetric (one-way) functions v v q given function f it is

Public-key cryptography q Asymmetric (one-way) functions v v q given function f it is easy to evaluate y = f(x) but given y its computationally infeasible to find x Trivial example of an asymmetric function encryption: decryption: q y = x 2 x = squareroot (y) Challenge v finding a function with strong security properties but efficient encryption and decryption

Public-key cryptography: RSA (Rivest, Shamir, Adleman) q v v encryption involves multiplying large prime

Public-key cryptography: RSA (Rivest, Shamir, Adleman) q v v encryption involves multiplying large prime numbers cracking involves finding prime factors of a large number Steps to generate encryption key (e ) and decryption key (d ) q v v Choose two very large prime numbers, p and q Compute n = p x q and z = (p – 1) x (q – 1) Choose a number d that is relatively prime to z Compute the number e such that e x d = 1 mod z

Public-key cryptography: RSA Messages split into fixed length blocks of bits q v interpreted

Public-key cryptography: RSA Messages split into fixed length blocks of bits q v interpreted as numbers with value 0 <= mi < n Encryption q v ci = mie (mod n) requires that you have n and encryption key e Decryption q v mi = cid (mod n) requires that you have n and decryption key d

RSA vs DES q q RSA than RSA DES is more secure than DES

RSA vs DES q q RSA than RSA DES is more secure than DES requires 100 -1000 times more computation DES to encrypt and decrypt can be used to exchange private DES keys can be used for message contents

Secure hash functions q Hash functions h = H(m) are one way functions v

Secure hash functions q Hash functions h = H(m) are one way functions v v q Weak collision resistance v q given m and h = H(m) difficult to find different input m’ such that H(m) = H(m’) Strong collision resistance v q can’t find input m from output h easy to compute h from m given H it is difficult to find any two different input values m and m’ such that H(m) = H(m’) They typically generate a short fixed length output string from arbitrary length input string

Example secure hash functions q MD 5 - (Message Digest) v q produces a

Example secure hash functions q MD 5 - (Message Digest) v q produces a 16 byte result SHA - (Secure Hash Algorithm) v produces a 20 byte result

Secure hash functions : MD 5 q The structure of MD 5 v v

Secure hash functions : MD 5 q The structure of MD 5 v v produces a 128 -bit digest from a set of 512 -bit blocks k block digests require k phases of processing each with four rounds of processing to produce one message digest

Per phase processing in MD 5 q Each phase involves for rounds of processing

Per phase processing in MD 5 q Each phase involves for rounds of processing F (x, y, z) = (x AND y) OR ((NOT x) AND z) G (x, y, z) = (x AND z) OR (y AND (NOT z)) H (x, y, z) = x XOR y XOR z I (x, y, z) = y XOR (x OR (NOT z))

Per round processing in MD 5 q The 16 iterations during the first round

Per round processing in MD 5 q The 16 iterations during the first round in a phase of MD 5 using function F

What can you use a hash function for? q To verify the integrity of

What can you use a hash function for? q To verify the integrity of data v q if the data has changed the hash will change (weak and strong collision resistance properties) To “sign” or “certify” data or software

Digital signatures (b) q q Computing a signature block What the receiver gets

Digital signatures (b) q q Computing a signature block What the receiver gets

Digital signatures using a message digest Notation KA, B Description Secret key shared by

Digital signatures using a message digest Notation KA, B Description Secret key shared by A and B Public key of A Private key of A

Digital signatures with public-key cryptography Notation KA, B Description Secret key shared by A

Digital signatures with public-key cryptography Notation KA, B Description Secret key shared by A and B Public key of A Private key of A

Trusted Systems and Formal Models

Trusted Systems and Formal Models

Trusted Systems Trusted Computing Base A reference monitor

Trusted Systems Trusted Computing Base A reference monitor

Formal Models of Secure Systems (a) An authorized state (b) An unauthorized state

Formal Models of Secure Systems (a) An authorized state (b) An unauthorized state

Multilevel Security (1) The Bell-La Padula multilevel security model

Multilevel Security (1) The Bell-La Padula multilevel security model

Multilevel Security (2) The Biba Model q Principles to guarantee integrity of data q

Multilevel Security (2) The Biba Model q Principles to guarantee integrity of data q Simple integrity principle • process can write only objects at its security level or lower The integrity * property q • process can read only objects at its security level or higher

Orange Book Security (1) q q Symbol X means new requirements Symbol -> requirements

Orange Book Security (1) q q Symbol X means new requirements Symbol -> requirements from next lower category apply here also

Orange Book Security (2)

Orange Book Security (2)

Java security Examples of specified protection with JDK 1. 2

Java security Examples of specified protection with JDK 1. 2