54
CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Embed Size (px)

Citation preview

Page 1: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

CSC 4320/6320

Operating Systems

Lecture 11

Security

Saurav Karmakar

Page 2: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Chapter 15: Security

• The Security Problem• Program Threats• System and Network Threats• Cryptography as a Security Tool• User Authentication• Implementing Security Defenses• Firewalling to Protect Systems and

Networks• Computer-Security Classifications• An Example: Windows XP

Page 3: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Objectives

• To discuss security threats and attacks

• To explain the fundamentals of encryption, authentication, and hashing

• To examine the uses of cryptography in computing

• To describe the various countermeasures to security attacks

Page 4: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

The Security Problem

• Security must consider external environment of the system, and protect the system resources

• Intruders (crackers) attempt to breach security

• Threat is potential for security violation• Attack is attempt to breach security

• Attack can be accidental or malicious• Easier to protect against accidental than

malicious misuse

Page 5: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Security Violations

• Categories– Breach of confidentiality– Breach of integrity– Breach of availability– Theft of service– Denial of service

• Methods– Masquerading (breach authentication)– Replay attack

» Message modification

– Man-in-the-middle attack– Session hijacking

Page 6: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Standard Security Attacks

Page 7: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Security Measure Levels

• Security must occur at four levels to be effective:

– Physical– Human

» Avoid social engineering, phishing, dumpster diving

– Operating System– Network

• Security is as week as the weakest link

Page 8: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Authentication: Identifying Users

• How to identify users to the system?– Passwords

» Shared secret between two parties» Since only user knows password, someone types

correct password must be user typing it» Very common technique

– Smart Cards» Electronics embedded in card capable of

providing long passwords or satisfying challenge response queries

» May have display to allow reading of password» Or can be plugged in directly; several

credit cards now in this category– Biometrics

» Use of one or more intrinsic physical or behavioral traits to identify someone

» Examples: fingerprint reader, palm reader, retinal scan

» Becoming quite a bit more common

Page 9: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Passwords: Secrecy

• System must keep copy of secret to check against passwords– What if malicious user gains access to list

of passwords?» Need to obscure information somehow

– Mechanism: utilize a transformation that is difficult to reverse without the right key (e.g. encryption)

• Example: UNIX /etc/passwd file– passwdone way transform(hash)encrypted

passwd– System stores only encrypted version, so OK even if

someone reads the file!– When you type in your password, system compares

encrypted version• Problem: Can you trust encryption algorithm?

– Example: one algorithm thought safe had back door» Governments want back door so they can snoop

– Also, security through obscurity doesn’t work» GSM encryption algorithm was secret; accidentally

released; Some grad students cracked in a few hours

“eggplant”

Page 10: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Passwords: How easy to guess?• Ways of Compromising Passwords

– Password Guessing: » Often people use obvious information like birthday,

favorite color, girlfriend’s name, etc…– Dictionary Attack:

» Work way through dictionary and compare encrypted version of dictionary words with entries in /etc/passwd

– Dumpster Diving:» Find pieces of paper with passwords written on them» (Also used to get social-security numbers, etc)

• Paradox: – Short passwords are easy to crack– Long ones, people write down!

• Technology means we have to use longer passwords– UNIX initially required lowercase, 5-letter passwords:

total of 265=10million passwords» In 1975, 10ms to check a password1 day to crack» In 2005, .01μs to check a password0.1 seconds to

crack– Takes less time to check for all words in the

dictionary!

Page 11: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Passwords: Making harder to crack

• How can we make passwords harder to crack?– Can’t make it impossible, but can help

• Technique 1: Extend everyone’s password with a unique number (stored in password file)– Called “salt”. UNIX uses 12-bit “salt”, making

dictionary attacks 4096 times harder– Without salt, would be possible to pre-compute all

the words in the dictionary hashed with the UNIX algorithm: would make comparing with /etc/passwd easy!

– Also, way that salt is combined with password designed to frustrate use of off-the-shelf DES hardware

• Technique 2: Require more complex passwords– Make people use at least 8-character passwords with

upper-case, lower-case, and numbers» 708=6x1014=6million seconds=69 [email protected]μs/check

– Unfortunately, people still pick common patterns» e.g. Capitalize first letter of common word, add one

digit

Page 12: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Passwords: Making harder to crack (con’t)

• Technique 3: Delay checking of passwords– If attacker doesn’t have access to /etc/passwd, delay

every remote login attempt by 1 second– Makes it infeasible for rapid-fire dictionary attack

• Technique 4: Assign very long passwords– Long passwords or pass-phrases can have more

entropy (randomnessharder to crack)– Give everyone a smart card (or ATM card) to carry

around to remember password» Requires physical theft to steal password» Can require PIN from user before authenticates self

– Better: have smartcard generate pseudorandom number» Client and server share initial seed» Each second/login attempt advances to next random

number• Technique 5: “Zero-Knowledge Proof”

– Require a series of challenge-response questions» Distribute secret algorithm to user» Server presents a number, say “5”; user computes

something from the number and returns answer to server

» Server never asks same “question” twice– Often performed by smartcard plugged into system

Page 13: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Authentication in Distributed Systems

• What if identity must be established across network?

– Need way to prevent exposure of information while still proving identity to remote system

– Many of the original UNIX tools sent passwords over the wire “in clear text”» E.g.: telnet, ftp, yp (yellow pages, for distributed login)» Result: Snooping programs widespread

• What do we need? Cannot rely on physical security!– Encryption: Privacy, restrict receivers– Authentication: Remote Authenticity, restrict senders

NetworkPA

SS

: gin

a

Page 14: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Private Key Cryptography

• Private Key (Symmetric) Encryption:– Single key used for both encryption and

decryption• Plaintext: Unencrypted Version of message• Ciphertext: Encrypted Version of message

• Important properties– Can’t derive plain text from ciphertext (decode)

without access to key– Can’t derive key from plain text and ciphertext– As long as password stays secret, get both

secrecy and authentication• Symmetric Key Algorithms: DES, Triple-DES, AES

InsecureTransmission(ciphertext)

Decrypt

Key

Encrypt

Key

Pla

inte

xt

Pla

inte

xt

SPY CIA

Page 15: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Key Distribution

• How do you get shared secret to both places?– For instance: how do you send authenticated, secret

mail to someone who you have never met?– Must negotiate key over private channel

» Exchange code book » Key cards/memory stick/others

• Third Party: Authentication Server (like Kerberos)– Notation:

» Kxy is key for talking between x and y» (…)K means encrypt message (…) with the key K» Clients: A and B, Authentication server S

– A asks server for key:» AS: [Hi! I’d like a key for talking between A and B]» Not encrypted. Others can find out if A and B are

talking– Server returns session key encrypted using B’s key

» SA: Message [ Use Kab (This is A! Use Kab)Ksb ] Ksa

» This allows A to know, “S said use this key”– Whenever A wants to talk with B

» AB: Ticket [ This is A! Use Kab ]Ksb

» Now, B knows that Kab is sanctioned by S

Page 16: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Authentication Server Continued [Kerberos]

• Details– Both A and B use passwords (shared with key server)

to decrypt return from key servers– Add in timestamps to limit how long tickets will be

used to prevent attacker from replaying messages later

– Also have to include encrypted checksums (hashed version of message) to prevent malicious user from inserting things into messages/changing messages

– Want to minimize # times A types in password» AS (Give me temporary secret)» SA (Use Ktemp-sa for next 8 hours)Ksa

» Can now use Ktemp-sa in place of Ksa in prototcol

KeyServerReq Ticket

Ticket

Ticket

Secure Communication

Page 17: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Public Key Encryption

• Can we perform key distribution without an authentication server?– Yes. Use a Public-Key Cryptosystem.

• Public Key Details– Don’t have one key, have two: Kpublic, Kprivate

» Two keys are mathematically related to one another» Really hard to derive Kpublic from Kprivate and vice versa

– Forward encryption:» Encrypt: (cleartext)Kpublic= ciphertext1

» Decrypt: (ciphertext1)Kprivate = cleartext– Reverse encryption:

» Encrypt: (cleartext)Kprivate = ciphertext2

» Decrypt: (ciphertext2)Kpublic = cleartext– Note that ciphertext1 ciphertext2

» Can’t derive one from the other!• Public Key Examples:

– RSA: Rivest, Shamir, and Adleman» Kpublic of form (kpublic, N), Kprivate of form (kprivate, N)» N = pq. Can break code if know p and q

– ECC: Elliptic Curve Cryptography

Page 18: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Asymmetric Encryption (Example)

• Formally, it is computationally infeasible to derive D(kd , N) from E(ke , N), and so E(ke , N) need not be kept secret and can be widely disseminated

– E(ke , N) (or just ke) is the public key

– D(kd , N) (or just kd) is the private key

– N is the product of two large, randomly chosen prime numbers p and q (for example, p and q are 512 bits each)

– Encryption algorithm is E(ke , N)(m) = mke mod N, where ke satisfies kekd mod (p−1)(q −1) = 1

– The decryption algorithm is then D(kd , N)(c) = ckd mod N

Page 19: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Asymmetric Encryption (Example)

• For example. make p = 7and q = 13• We then calculate N = 7∗13 = 91 and

(p−1)(q−1) = 72

• We next select ke relatively prime to 72 and< 72, yielding 5

• Finally,we calculate kd such that kekd mod 72 = 1, yielding 29

• We how have our keys– Public key, ke, N = 5, 91

– Private key, kd , N = 29, 91

• Encrypting the message 69 with the public key results in the cyphertext 62

Page 20: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

• Idea: Kpublic can be made public, keep Kprivate private

• Gives message privacy (restricted receiver):– Public keys (secure destination points) can be

acquired by anyone/used by anyone– Only person with private key can decrypt message

• What about authentication?– Use combination of private and public key– AliceBob: [(I’m Alice)Aprivate Rest of message]Bpublic

– Provides restricted sender and receiver• But: how does Alice know that it was Bob who sent

her Bpublic? And vice versa…

BprivateAprivate

Public Key Encryption Details

Alice Bob

BpublicApublic

Insecure Channel

Insecure Channel

Page 21: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Secure Hash Function

• Hash Function: Short summary of data (message)– For instance, h1=H(M1) is the hash of message M1

» h1 fixed length, despite size of message M1.» Often, h1 is called the “digest” of M1.

• Hash function H is considered secure if – It is infeasible to find M2 with h1=H(M2); ie. can’t

easily find other message with same digest as given message.

– It is infeasible to locate two messages, m1 and m2, which “collide”, i.e. for which H(m1) = H(m2)

– A small change in a message changes many bits of digest/can’t tell anything about message given its hash

DFCD3454BBEA788A751A696C24D97009CA992D17

The red foxruns across

the ice

HashFunction

HashFunction

52ED879E70F71D926EB6957008E03CE4CA6945D3

Fox

Page 22: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Use of Hash Functions• Several Standard Hash Functions:

– MD5: 128-bit output– SHA-1: 160-bit output, SHA-256: 256-bit output

• Can we use hashing to securely reduce load on server?– Yes. Use a series of insecure mirror servers

(caches)– First, ask server for digest of desired file

» Use secure channel with server– Then ask mirror server for file

» Can be insecure channel» Check digest of result and catch faulty or malicious

mirrors

Client

Read File X

Here is hx = H(X)

InsecureData

Mirror

File X

Read X

File XFile X

Server

Page 23: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Authentication - MAC

• Symmetric encryption used in message-authentication code (MAC) through authentication algorithm

• Simple example:– MAC defines S(k)(m) = f (k, H(m))

» Where f is a function that is one-way on its first argument•k cannot be derived from f (k, H(m))

» Because of the collision resistance in the hash function, reasonably assured no other message could create the same MAC

» A suitable verification algorithm is

V(k)(m, a) ≡ ( f (k,m) = a)» Note that k is needed to

compute both S(k) and V(k), so anyone able to compute one can compute the other

Page 24: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Signatures/Certificate Authorities

• Can use Xpublic for person X to define their identity– Presumably they are the only ones who know Xprivate.– Often, we think of Xpublic as a “principle” (user)

• Suppose we want X to sign message M?– Use private key to encrypt the digest, i.e. H(M)Xprivate

– Send both M and its signature:» Signed message = [M,H(M)Xprivate]

– Now, anyone can verify that M was signed by X» Simply decrypt the digest with Xpublic» Verify that result matches H(M)

• Now: How do we know that the version of Xpublic that we have is really from X???– Answer: Certificate Authority

» Examples: Verisign, Entrust, Etc.– X goes to organization, presents identifying papers

» Organization signs X’s key: [ Xpublic, H(Xpublic)CAprivate]» Called a “Certificate”

– Before we use Xpublic, ask X for certificate verifying key» Check that signature over Xpublic produced by trusted

authority• How do we get keys of certificate authority?

– Compiled into your browser, for instance!

Page 25: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

(pms)Ks• SSL Web Protocol

– Port 443: secure http– Use public-key encryption

for key-distribution • Server has a certificate signed by certificate

authority– Contains server info (organization, IP address, etc)– Also contains server’s public key and expiration date

• Establishment of Shared, 48-byte “master secret”– Client sends 28-byte random value nc to server– Server returns its own 28-byte random value ns, plus

its certificate certs– Client verifies certificate by checking with public key of

certificate authority compiled into browser» Also check expiration date

– Client picks 46-byte “premaster” secret (pms), encrypts it with public key of server, and sends to server

– Now, both server and client have nc, ns, and pms» Each can compute 48-byte master secret using one-way

and collision-resistant function on three values» Random “nonces” nc and ns make sure master secret

fresh

ns,certs

Security through SSLnc

Page 26: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

SSL Pitfalls

• Netscape claimed to provide secure comm. (SSL)– So you could send a credit card # over the Internet

• Three problems (reported in NYT):– Algorithm for picking session keys was predictable

(used time of day) – brute force key in a few hours– Made new version of Netscape to fix #1, available

to users over Internet (unencrypted!)» Four byte patch to Netscape executable makes it

always use a specific session key» Could insert backdoor by mangling packets containing

executable as they fly by on the Internet.» Many mirror sites (including Berkeley) to redistribute

new version – anyone with root access to any machine on LAN at mirror site could insert the backdoor

– Buggy helper applications – can exploit any bug in either Netscape, or its helper applications

Page 27: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Cryptographic Summary

• Private Key Encryption (also Symmetric Key)– Pros: Very Fast

» can encrypt at network speed (even without hardware)

– Cons: Need to distribute secret key to both parties• Public Key Encryption (also Asymmetric Key)

– Pros: Can distribute keys in public» Need certificate authority (Public Key Infrastructure)

– Cons: Very Slow» 100—1000 times slower than private key encryption

• Session Key– Randomly generated private key used for single

session– Often distributed via public key encryption

• Secure Hash– Fixed length summary of data that is hard to spoof

• Message Authentication Code (MAC)– Technique for using secure hash and session key to

verify individual packets (even at the IP level)– IPSEC: IP Protocol 50/51, authentic/encrypted IP

• Signature over Document– Hash of document encrypted with private key

Page 28: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Authorization Again• Principle of least privilege: programs, users, and

systems should get only enough privileges to perform their tasks– Very hard to do in practice

» How do you figure out what the minimum set of privileges is needed to run your programs?

– People often run at higher privilege then necessary» Such as the “administrator” privilege under

windows• One solution: Signed Software

– Only use software from sources that you trust, thereby dealing with the problem by means of authentication

– Fine for big, established firms such as Microsoft, since they can make their signing keys well known and people trust them» Actually, not always fine: recently, one of Microsoft’s

signing keys was compromised, leading to malicious software that looked valid

– What about new startups?» Who “validates” them?» How easy is it to fool them?

Page 29: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

How to perform Authorization for Distributed Systems?

• Issues: Are all user names in world unique?– No! They only have small number of characters

» [email protected] [email protected]

» However, someone thought their friend was [email protected] and I got very private email intended for someone else…

– Need something better, more unique to identify person• Suppose want to connect with any server at any

time?– Need an account on every machine! (possibly with

different user name for each account)– OR: Need to use something more universal as identity

» Public Keys! (Called “Principles”)» People are their public keys

Different Authorization

Domains

Page 30: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Client 1Domain 1

Distributed Access Control

• Distributed Access Control List (ACL)– Contains list of attributes (Read, Write, Execute, etc)

with attached identities (Here, we show public keys)» ACLs signed by owner of file, only changeable by owner» Group lists signed by group key

– ACLs can be on different servers than data» Signatures allow us to validate them» ACLs could even be stored separately from verifiers

Server 1: Domain 2

File XOwner Key:

0x22347EF…

File XOwner Key:

0x22347EF…

Access Control List (ACL) for X:

R: Key: 0x546DFEFA34…RW: Key: 0x467D34EF83…RX: Group Key: 0xA2D3498672…

ACL verifierHash, Timestamp, Signature (owner)

Server 2: Domain 3

Group ACL:Key: 0xA786EF889A…Key: 0x6647DBC9AC…

GACL verifierHash, Timestamp, Signature (group)

(Read X

)Kcli

ent

Key: 0

x6647DBC9AC…

Read

Gro

up

GA

CL

(data

)Kse

rver

Page 31: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Analysis of Previous Scheme• Positive Points:

– Identities checked via signatures and public keys» Client can’t generate request for data unless they have

private key to go with their public identity» Server won’t use ACLs not properly signed by owner of

file– No problems with multiple domains, since identities

designed to be cross-domain (public keys domain neutral)

• Revocation:– What if someone steals your private key?

» Need to walk through all ACLs with your key and change…!

» This is very expensive– Better to have unique string identifying you that

people place into ACLs» Then, ask Certificate Authority to give you a certificate

matching unique string to your current public key» Client Request: (request + unique ID)Cprivate; give server

certificate if they ask for it.» Key compromisemust distribute “certificate

revocation”, since can’t wait for previous certificate to expire.

– What if you remove someone from ACL of a given file?» If server caches old ACL, then person retains access!» Here, cache inconsistency leads to security violations!

Page 32: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Analysis Continued

• Who signs the data?– Or: How does the client know they are getting valid

data?– Signed by server?

» What if server compromised? Should client trust server?– Signed by owner of file?

» Better, but now only owner can update file!» Pretty inconvenient!

– Signed by group of servers that accepted latest update?» If must have signatures from all servers Safe, but one

bad server can prevent update from happening» Instead: ask for a threshold number of signatures

• How do you know that data is up-to-date?– Valid signature only means data is valid older version– Freshness attack:

» Malicious server returns old data instead of recent data» Problem with both ACLs and data» E.g.: you just got a raise, but enemy breaks into a server

and prevents payroll from seeing latest version of update– Hard problem

» Needs to be fixed by invalidating old copies or having a trusted group of servers

Page 33: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Involuntary Installation

• What about software loaded without your consent?– Macros attached to documents (such as Microsoft

Word)– Active X controls (programs on web sites with potential

access to whole machine)– Spyware included with normal products

• Active X controls can have access to the local machine – Install software/Launch programs

• Sony Spyware [Sony XCP] (October 2005)– About 50 CDs from Sony automatically installed

software when you played them on Windows machines» Called XCP (Extended Copy Protection)» Modify operating system to prevent more than 3 copies

and to prevent peer-to-peer sharing– Side Effects:

» Reporting of private information to Sony» Hiding of generic file names of form $sys_xxx; easy for

other virus writers to exploit» Hard to remove (crashes machine if not done carefully)

– Vendors of virus protection software declare it spyware» Computer Associates, Symantec, even Microsoft

Page 34: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Enforcement• Enforcer checks passwords, ACLs, etc

– Makes sure the only authorized actions take place– Bugs in enforcerthings for malicious users to exploit

• In UNIX, superuser can do anything– Because of coarse-grained access control, lots of stuff

has to run as superuser in order to work– If there is a bug in any one of these programs, you

lose!• Paradox

– Bullet-proof enforcer» Only known way is to make enforcer as small as possible» Easier to make correct, but simple-minded protection

model– Fancy protection

» Tries to adhere to principle of least privilege» Really hard to get right

• Same argument for Java or C++: What do you make private vs public?– Hard to make sure that code is usable but only

necessary modules are public– Pick something in middle? Get bugs and weak

protection!

Page 35: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

State of the World• State of the World in Security

– Authentication: Encryption» But almost no one encrypts or has public key identity

– Authorization: Access Control » But many systems only provide very coarse-grained

access» In UNIX, need to turn off protection to enable sharing

– Enforcement: Kernel mode» Hard to write a million line program without bugs» Any bug is a potential security loophole!

• Some types of security problems– Abuse of privilege

» If the superuser is evil, we’re all in trouble/can’t do anything

» What if sysop in charge of instructional resources went crazy and deleted everybody’s files (and backups)???

– Imposter: Pretend to be someone else» Example: in unix, can set up an .rhosts file to allow logins

from one machine to another without retyping password» Allows “rsh” command to do an operation on a remote

node» Result: send rsh request, pretending to be from trusted

userinstall .rhosts file granting you access

Page 36: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Other Security Problems

• Virus:– A piece of code that attaches itself to a program or

file so it can spread from one computer to another, leaving infections as it travels

– Most attached to executable files, so don’t get activated until the file is actually executed

– Once caught, can hide in boot tracks, other files, OS• Worm:

– Similar to a virus, but capable of traveling on its own– Takes advantage of file or information transport

features– Because it can replicate itself, your computer might

send out hundreds or thousands of copies of itself• Trojan Horse:

– Named after huge wooden horse in Greek mythology given as gift to enemy; contained army inside

– At first glance appears to be useful software but does damage once installed or run on your computer

Page 37: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

A Boot-sector Computer Virus

Page 38: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Security Problems: Buffer-overflow Condition

#define BUFFER SIZE 256int process(int argc,

char *argv[]){char buffer[BUFFER SIZE];if (argc < 2)

return -1;else {

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

}}

Before attack After attack

• Technique exploited by many network attacks– Anytime input comes from network request and

is not checked for size– Allows execution of code with same privileges as

running program – but happens without any action from user!

• How to prevent?– Don’t code this way! (ok, wishful thinking)– New mode bits in Intel, Amd, and Sun processors

» Put in page table; says “don’t execute code in this page”

Page 39: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

The Morris Internet Worm• Internet worm (Self-reproducing)

– Author Robert Morris, a first-year Cornell grad student

– Launched close of Workday on November 2, 1988– Within a few hours of release, it consumed resources

to the point of bringing down infected machines

• Techniques– Exploited UNIX networking features (remote access)– Bugs in finger (buffer overflow) and sendmail

programs (debug mode allowed remote login)– Dictionary lookup-based password cracking– Grappling hook program uploaded main worm

program

Page 40: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Some other Attacks

• Trojan Horse Example: Fake Login– Construct a program that looks like normal login

program– Gives “login:” and “password:” prompts

» You type information, it sends password to someone, then either logs you in or says “Permission Denied” and exits

– In Windows, the “ctrl-alt-delete” sequence is supposed to be really hard to change, so you “know” that you are getting official login program

• Salami attack: Slicing things a little at a time– Steal or corrupt something a little bit at a time– E.g.: What happens to partial pennies from bank

interest?» Bank keeps them! Hacker re-programmed system so

that partial pennies would go into his account.» Doesn’t seem like much, but if you are large bank can

be millions of dollars• Eavesdropping attack

– Tap into network and see everything typed– Catch passwords, etc – Lesson: never use unencrypted communication!

Page 41: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Timing Attacks: Tenex Password Checking

• Tenex – early 70’s, BBN– Most popular system at universities before

UNIX– Thought to be very secure, gave “red team” all

the source code and documentation (want code to be publicly available, as in UNIX)

– In 48 hours, they figured out how to get every password in the system

• Here’s the code for the password check:for (i = 0; i < 8; i++)

if (userPasswd[i] != realPasswd[i])

go to error

• How many combinations of passwords?– 2568?– Wrong!

Page 42: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Defeating Password Checking

• Tenex used VM, and it interacts badly with the above code– Key idea: force page faults at inopportune times to break

passwords quickly• Arrange 1st char in string to be last char in pg, rest on next pg

– Then arrange for pg with 1st char to be in memory, and rest to be on disk (e.g., ref lots of other pgs, then ref 1st page)

a|aaaaaa

|

page in memory| page on disk • Time password check to determine if first character is correct!

– If fast, 1st char is wrong– If slow, 1st char is right, pg fault, one of the others wrong– So try all first characters, until one is slow– Repeat with first two characters in memory, rest on disk

• Only 256 * 8 attempts to crack passwords– Fix is easy, don’t stop until you look at all the characters

Page 43: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Protecting Information with Taint Tracking

• How can we prevent the illegal flow of information?– Consider Virus Scanner that scans your private

files» Example from Nickolai Zeldovich

– What is to prevent a buggy scanner from leaking info? Virus

Scanner

PrivateUserFiles

/tmp VirusDatabase NetworkNetwork

UpdateProcess

VirusChecker

Page 44: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Possible avenues of leakage (MANY!)

• Possible ways of giving out private information:– Buggy Scanner gives out private info to update

process– Leaks info through file system (or other file

systems!)– Leaking info by setting title of process… Etc.Virus

Scanner

PrivateUserFiles

/tmp VirusDatabase NetworkNetwork

UpdateProcess

VirusChecker

ProcTitle:“Secret”

ps

Page 45: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

What is problem/Solution

• Kernel not designed to enforce these policies• Retrofitting difficult:

– Must track any memory observed or modified by a system call!

– Hard to even enumerate all possible channels• Answer: Make all state explicit, track all communication

– Example: Asbestos (MIT), HiStar (Stanford)• Think of all data, threads, files, etc having a “Label”

– Like a color; track colors through system, don’t allow colors to “bleed” incorrectly into places they are not supposed to

Page 46: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Simple Taint Tracking Example

• Give a particular Label to every Thread– Propagate this label

to all data modified by the thread

• Allow accesses only if accessing thread has a compatible Label– Deny access is labels

do not match• Question: Where do

labels come from?– New Labels may be

allocated dynamically by apps

– No privileged “root”

Page 47: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Strawman has Covert Channel

• Still possible to leak information by reflecting bits through failure– In example, Thread B finds out that secret is “1”

because unable to read from File 1• One fix to this covert channel: don’t allow labels

to change (i.e. must already exist, never propagated)– HiStar (Stanford) takes this approach

Page 48: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

“Owner” privilege

• Yellow objects can only interact with other yellow objects, or objects with yellow star

• Small, trusted shell can isolate a large, frequently-changing virus scanner– Try to reduce size of trusted code base

• Label checker is most trusted code and must be very carefully verified

Page 49: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Multiple categories of taint

• Owner privilege and information flow control are the only access control mechanism

• Anyone can allocate a new category, gets star

Page 50: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Implementing Security Defenses

• Defense in depth is most common security theory – multiple layers of security

• Security policy describes what is being secured• Vulnerability assessment compares real state of

system / network compared to security policy• Intrusion detection endeavors to detect attempted or

successful intrusions– Signature-based detection spots known bad patterns– Anomaly detection spots differences from normal

behavior» Can detect zero-day attacks

– False-positives and false-negatives a problem

• Virus protection• Auditing, accounting, and logging of all or specific

system or network activities

Page 51: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Firewalling to Protect Systems and Networks

• A network firewall is placed between trusted and untrusted hosts– The firewall limits network access between these two

security domains

• Can be tunneled or spoofed– Tunneling allows disallowed protocol to travel within

allowed protocol (i.e. telnet inside of HTTP)– Firewall rules typically based on host name or IP

address which can be spoofed

• Personal firewall is software layer on given host– Can monitor / limit traffic to and from the host

• Application proxy firewall understands application protocol and can control them (i.e. SMTP)

• System-call firewall monitors all important system calls and apply rules to them (i.e. this program can execute that system call)

Page 52: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Network Security Through Domain Separation Via Firewall

Page 53: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

Computer Security Classifications

• U.S. Department of Defense outlines four divisions of computer security: A, B, C, and D.

• D – Minimal security.• C – Provides discretionary protection

through auditing. Divided into C1 and C2. – C1 identifies cooperating users with the

same level of protection. – C2 allows user-level access control.

• B – All the properties of C, however each object may have unique sensitivity labels. Divided into B1, B2, and B3.

• A – Uses formal design and verification techniques to ensure security.

Page 54: CSC 4320/6320 Operating Systems Lecture 11 Security Saurav Karmakar

End of Lecture 11