Top Banner
Security and Cryp tography CS-502 Fall 2007 1 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System Concepts, 7 th ed., by Silbershatz, Galvin, & Gagne and from Modern Operating Systems, 2 nd ed., by Tanenbaum)
54

Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Dec 19, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 1

Security and Cryptography

CS-502 Operating SystemsFall 2007

(Slides include materials from Operating System Concepts, 7th ed., by Silbershatz, Galvin, & Gagne and from Modern Operating Systems, 2nd ed., by Tanenbaum)

Page 2: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 2

Puzzle

• Alice wishes to send secret message to Bob– She places message in impenetrable box– Locks the box with unbreakable padlock– Sends locked box to Bob

• Problem:– Bob has no key to unlock box– No feasible way to securely send key to Bob

• How does Bob retrieve message?

Page 3: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 3

Answer

• Bob adds 2nd unbreakable padlock to box– Locks with own key– Sends box back to Alice (with two padlocks!)

• Alice unlocks and removes her lock– Sends box back to Bob

• Bob unlocks his lock– Opens box and reads message

• What could go wrong?

Page 4: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 4

Authentication

• How does the machine know who it is talking to?

• Who do I say that I am?

• How can I verify that?• Something I know (that nobody else should know)• Something I have (that nobody else should have)• Something I am (that nobody else should be…)

Page 5: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 5

Threats against authentication

I want to pretend to be you:• I can steal your password

– the sticky note on your monitor or the list in your desk drawer

– by monitoring your communications or looking over your shoulder

• I can guess your password – particularly useful if I can also guess your user name

• I can get between you and the system you are talking to

Page 6: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 6

Getting between you and system you are talking to

Page 7: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 7

Login Spoof

• I create a login screen in my process– On a public machine

– Looks exactly like real one

• You log into system– My login process records your user ID and password

– Logs you in normally

• Result:– I have gotten between you and system without your knowledge– Also, I have stolen your user ID and password

Page 8: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 8

The Trouble with Passwords

• They are given away

• They are too easy to guess

• They are used too often

• There are too many of them

• They are used in too many places

Page 9: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 9

Some ways around the problem

• Better passwords– longer– larger character set– more random in nature/encrypted

• Used less often– changed frequently, one system per password– challenge/response – use only once

Page 10: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 10

The Challenge/Response Protocol

Art MaryHello, I’m Art

Decrypt This {R}P

R

Hello Art! How can I help you?

Page 11: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 11

Threat: Steal passwords from the system

• Don’t keep them in an obvious place

• Encrypt them so that version system sees is not same as what user enters – or version on the wire

Page 12: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 12

Too many passwords to remember?

• Third-party authentication– Get someone to vouch for you

• The basics: “This guy says you know him..”“Yes, I trust him, so you should too..”

• Kerberos – Certificate-based authentication within a trust community

Page 13: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 13

What is in a certificate?

• Who issued it

• When was it issued

• For what purpose was it issued

• For what time frame is it valid

• (possibly other application-specific data)

• A “signature” that proves it has not been forged

Page 14: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 14

Systems and Networks Are Not Different

• Same basic rules about code behavior apply

• Same authentication rules apply

• The same security principles apply

• Same coding rules apply to: – An application

– Code which manages incoming messages

– Code which imposes access controls on a network

– ...

Page 15: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 15

The Principles

• Understand what you are trying to protect

• Understand the threat(s) you are trying to protect against– Also, costs and risks

• Be prepared to establish trust by telling people how you do it

• Assume that the bad guys are at least as clever as you are!

Page 16: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 16

Security must occur at four levels to be effective

• Physical– The best security system is no better than the lock on

your front door (or desk, or file cabinet, etc.)!• Human

– Phishing, dumpster diving, social engineering• Operating System

– Protection and authentication subsystems• Network

– Similar to OS

• Security is as weak as the weakest link in chain

Page 17: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 17

How do these attacks work?

• Messages that attack mail readers or browsers

• Denial of service attacks against a web server

• Password crackers

• Viruses, Trojan Horses, other “malware”

Page 18: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 18

The concept of a “Vulnerability”

• Buffer overflow

• Protocol/bandwidth interactions– Protocol elements which do no work

• “execute this” messages– The special case of “mobile agents”

• Human user vulnerabilities– eMail worms– Phishing

Page 19: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 19

Another Principle

• There is a never-ending war going on between the “black hats” and the rest of us.

• For every asset, there is at least one vulnerability

• For every protective measure we add, “they” will find another vulnerability

Page 20: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 20

Yet Another Principle

• There is no such thing as a bullet-proof barrier

• Every level of the system and network deserves an independent threat evaluation and appropriate protection

• Only a multi-layered approach has a chance of success!

Page 21: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 21

Actual Losses:

• Approximately 70% are due to user error

• More than half of the remainder are caused by insiders

• “Social Engineering” accounts for more loss than technical attacks.

Page 22: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 22

What is “Social Engineering”?

“Hello. This is Dr. Burnett of the cardiology department at the Conquest Hospital in Hastings. Your patient, Sam Simons, has just been admitted here unconscious. He has an unusual ventricular arrhythmia. Can you tell me if there is anything relevant in his record?”

Page 23: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 23

Social Engineering (2)

From: [email protected]: Sunday, December 3, 2006 8:10 AMTo: [email protected]: Re: Approved

Please read the attached file.

Page 24: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 24

Program Threats

• Trojan Horse– Code segment that misuses its environment– Exploits mechanisms for allowing programs written by users to be

executed by other users– Spyware, pop-up browser windows, covert channels

• Trap Door– Specific user identifier or password that circumvents normal

security procedures– Could be included in a compiler

• Logic Bomb– Program that initiates a security incident under certain

circumstances• Stack and Buffer Overflow

– Exploits a bug in a program (overflow either the stack or memory buffers)

Page 25: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 25

C Program with Buffer-overflow Condition

#include <stdio.h>#define BUFFER SIZE 256int main(int argc, char *argv[]){char buffer[BUFFER SIZE];if (argc < 2)

return -1;else {

strcpy(buffer,argv[1]);return 0;

}}

Page 26: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 26

Layout of Typical Stack Frame

Page 27: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 27

Modified Shell Code

#include <stdio.h>

int main(int argc, char *argv[])

{

execvp('\bin\sh', '\bin \sh', NULL);

return 0;

}

Page 28: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 28

Hypothetical Stack Frame

Before attack After attack

Page 29: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 29

Effect

• If you can con a privileged program into reading a string into a buffer unprotected from overflow, then …

• …you have just gained the privileges of that program in a shell!

Page 30: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 30

Program Threats – Viruses

• Code fragment embedded in legitimate programs• Very specific to CPU architecture, operating

system, applications• Usually borne via email or as a macro• E.g., Visual Basic Macro to reformat hard drive

Sub AutoOpen()Dim oFSSet oFS = CreateObject(’’Scripting.FileSystemObject’’)vs = Shell(’’c:command.com /k format c:’’,vbHide)

End Sub

Page 31: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 31

Program Threats (Cont.)

• Virus dropper inserts virus onto the system• Many categories of viruses, literally many thousands of

viruses– File– Boot– Macro– Polymorphic– Source code– Encrypted– Stealth– Tunneling– Multipartite– Armored

Page 32: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 32

Questions?

Page 33: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 33

Part 3: Fun with Cryptography

• What is cryptography about?

• General Principles of Cryptography

• Basic Protocols– Single-key cryptography– Public-key cryptography

• An example...

Page 34: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 34

Cryptography as a Security Tool

• Broadest security tool available– Source and destination of messages cannot be

trusted without cryptography– Means to constrain potential senders (sources)

and / or receivers (destinations) of messages

• Based on secrets (keys)

Page 35: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 35

Principles

• Cryptography is about the exchange of messages

• The key to success is that all parties to an exchange trust that the system will both protect them from threats and accurately convey their message

• TRUST is essential

Page 36: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 36

Therefore

• Algorithms must be public and verifiable

• We need to be able to estimate the risk of compromise

• The solution must practical for its users, and impractical for an attacker to break

Page 37: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 37

Guidelines

• Cryptography is always based on algorithms which are orders of magnitude easier to compute in the forward (normal) direction than in the reverse (attack) direction.

• The attacker’s problem is never harder than trying all possible keys

• The more material the attacker has the easier his task

Page 38: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 38

Example

• What is 314159265358979 314159265358979?

vs.

• What are prime factors of3912571506419387090594828508241?

Page 39: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 39

Time marches on…

• We must assume that there will always be improvements in computational power, mathematics and algorithms.– Messages which hang around get less secure

with time!

• Increases in computing power help the good guys and hurt the bad guys for new and short-lived messages

Page 40: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 40

Caveat

• We cannot mathematically PROVE that the inverse operations are really as hard as they seem to be…It is all relative…

The Fundamental Tenet of Cryptography:

If lots of smart people have failed to solve a problem, it won’t be solved (soon)

Page 41: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 41

Secret key cryptography

f (T,K) g (C,K)Cleartext Cleartext

K K

CyphertextT TC

Page 42: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 42

Secret Key Methods

• DES (56 bit key)

• IDEA (128 bit key)• http://www.mediacrypt.com/community/index.asp

• Triple DES (three 56 bit keys)

• AES– From NIST, 2000– choice of key sizes up to 256 bits and more– Commercial implementations available

Page 43: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 43

Diffie – Hellman

Alice Agree on p,g Bob

choose random A choose random BTA = gA mod p

TB = gB mod p

compute (TB)A compute (TA)B

Shared secret key is gAB mod p

Page 44: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 44

D–H Problems

• Not in itself an encryption method – we must still do a secret key encryption

• Subject to a “man in the middle” attack– (Alice thinks she is talking to Bob, but actually

Trudy is intercepting all of the messages and substitution her own)

Page 45: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 45

RSA Public key cryptography

f () f ()Cleartext Cleartext

Key #1 Key #2

Cyphertext

Key #1 can be either a Public Key or a Private Key.Key #2 is then the corresponding Private Key or Public Key.

T C T

Page 46: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 46

RSA Public Key Cryptography

• Rivest, Shamir and Adelman (1978)

• I can send messages that only you can read

• I can verify that you and only you could have sent a message

• I can use a trusted authority to distribute my public key – The trusted authority is for your benefit!

Page 47: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 47

RSA Details

• We will use the same operation to encrypt and decrypt

• To encrypt, we will use “e” as a key, to decrypt we will use “d” as a key

• e and d are inverses with respect to the chosen algorithm

Page 48: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 48

RSA Details

• Choose n as the product of two large primes– Finding the factors of a large number is

mathematically hard (difficult)– Finding primes is also hard

• Choose e to be a (fairly small) prime and compute d from e and the factors of n

• THROW AWAY THE FACTORS OF n!

• Publish two numbers, e (public key) and n

Page 49: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 49

RSA Details

• Encryption: Cyphertext = (Cleartext)e mod n• Decryption: Cleartext = (Cyphertext)d mod n

• Typical d will be on the order of 500 to 700 bits• The cost of the algorithm is between 1 and 2

the size of n, – Each operation is a giant shift and add (multiply by a

power of 2)

Page 50: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 50

RSA Problems

• It is much more costly than typical secret-key methods – Use RSA to hide (i.e., encrypt) a secret key, – Encrypt the message with the secret key and

append/prefix the encrypted key

• Requires a “Public Key Infrastructure” for effective key generation and distribution– Chain of trust thing again!

Page 51: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 51

Message Digests (aka Digital Signatures)

• A message digest is a non-reversable algorithm which reduces a message to a fixed-length “summary”

• The summary has the property that a change to the original will produce a new summary

• The probability that the new summary is the same as the old should be 1/(size of digest)

• Silbershatz, p. 582 (§15.4.1.3)

Page 52: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 52

Message Digests (2)

• There are several good (but possibly no perfect) message digest algorithms

• MD5 is probably the most common one in use – 128 bit digest

• has known weaknesses

• SHA-1 – 160 bit digest (current best choice)• [Another product of NIST]

Page 53: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 53

Conclusion

• Protection in OS is • Difficult

• Important

• Security is needed for• Authentication of users

• Validation of communication

Page 54: Security and Cryptography CS-502 Fall 20071 Security and Cryptography CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System.

Security and Cryptography

CS-502 Fall 2007 54

Reading Assignment

Silbershatz, Chapter 15