operating system security

82
Operating System Security Andy Wang COP 5611 Advanced Operating Systems

Upload: orli-sheppard

Post on 31-Dec-2015

50 views

Category:

Documents


0 download

DESCRIPTION

Operating System Security. Andy Wang COP 5611 Advanced Operating Systems. Outline. Single system security Memory, files, processes, devices Dealing with intruders Malicious programs Distributed system security Using encryption Secure distributed applications. Single System Security. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Operating System Security

Operating System Security

Andy WangCOP 5611

Advanced Operating Systems

Page 2: Operating System Security

Outline

Single system security Memory, files, processes, devices Dealing with intruders Malicious programs

Distributed system security Using encryption Secure distributed applications

Page 3: Operating System Security

Single System Security

Only worrying about the security of a single machine (possibly a multiprocessor)

One operating system is in control Threats comes from multiple users

Or from external access

Page 4: Operating System Security

Protecting Memory

Virtual memory offers strong protection tools Model prevents naming another

user’s memory What about shared memory?

Use access control mechanisms Backed up by hardware protection on

pages

Page 5: Operating System Security

Protecting Files

Unlike memory, files are in a shared namespace

Requires more use of access controls

Typically, access checked on open System assumes users has right to

continue using open file

Page 6: Operating System Security

File Access Control in UNIX Every file has an owning user and group Access permissions settable for read,

write, and execute For owning user, owning group, everyone

else Processes belong to one user

And possibly multiple groups Files opened for particular kinds of

access

Page 7: Operating System Security

Protecting Processes

Most of a process’s state not addressable externally

But IPC channels allow information to flow

So security must be applied at IPC points

Page 8: Operating System Security

Protecting IPC

Typically, IPC requires cooperation from both ends

So a major question is authentication Does this channel connect where I

think it does? OS guarantees identity, ownership

of other process

Page 9: Operating System Security

Limiting IPC Access

Each party to IPC has control over what is done on his side

Some IPC mechanisms allow differing modes of access for different users

So access control required for such cases

Page 10: Operating System Security

Protecting Devices

Generally treated similarly to files But special care is necessary

In some cases, a mistake allows an intruder unlimited access

E.g., if you let him write any block on a disk drive

Page 11: Operating System Security

Controlling IPC Access in Windows NT General model related to file access

control Processes try to access objects

Objects include IPC entities On first access, request desired access

rights Set of granted access rights returned

System checks granted access rights on each attempted access

Page 12: Operating System Security

Covert Channel

Two packets in quick succession 1 Else 0

CPU usage, memory allocation, HD access, white spaces

Page 13: Operating System Security

Other Covert channels

Steganography Hiding secret message in graphics,

movies, or sound Subliminal channels

Names with different initials

Page 14: Operating System Security

Beware of Back Doors

Many systems provide low-level ways to access various resources /dev/kmem raw devices pipes stored in the file system

The lock on the back door must be as strong as the lock on the front door

Page 15: Operating System Security

Intruders

Modern systems usually allow remote access From terminals From modems From the network

Intruders can use all of these to break in

Page 16: Operating System Security

How Intruders Get In

Usually by masquerading as a legitimate user

Less frequently by inserting commands through insecure entry points finger daemons Holes in electronic mail Making use of interpreters that access

data remotely

Page 17: Operating System Security

Detecting Intruders The sooner detected, the better Systems that detect and eject intruders

quickly are less attractive targets Information gained from detecting

intruders can be used to prevent further intrusions

Detection presumes you can differentiate the behavior of authorized users and intruders

Page 18: Operating System Security

Some Approaches to Detecting Intruders

Statistical anomaly detection Based on either

Overall system activity Individual user profiles

Rule-based detection Rules that detect anomalies Penetration expert systems

Page 19: Operating System Security

Audit Records Keep track of everything done on system Powerful tool for detecting intruders Used to build detection mechanisms Can use either general accounting info or

specially gathered data Also invaluable if you decide to prosecute Must be carefully protected to be valuable

Page 20: Operating System Security

Malicious Programs

Clever programmers can get software to do their dirty work for them

Programs have several advantages for these purposes Speed Mutability Anonymity

Page 21: Operating System Security

Kinds of Malicious Programs

Trojan horses Trapdoors Logic bombs Worms Viruses

Page 22: Operating System Security

Trojan Horses

Seemingly useful program that contains code that does harmful things

Unsuspecting users run the Trojan horse to get the advertised benefit At which time the Greeks spring out

and slaughter your system Particularly dangerous in compilers

Page 23: Operating System Security

Trapdoors

A secret entry point into an otherwise legitimate program

Typically inserted by the writer of the program

Most often found in login programs or programs that use the network

But also found in system utilities

Page 24: Operating System Security

Logic Bombs

Like trapdoors, typically in a legitimate program

A piece of code that, under certain conditions, “explodes”

Also like trapdoors, typically inserted by program authors

Page 25: Operating System Security

Worms Programs that seek to move from

system to system Making use of various vulnerabilities

Other malicious behavior can also be built in

The Internet worm is the most famous example

Can spread very, very rapidly

Page 26: Operating System Security

Viruses A program that can infect other

programs Infected programs in turn infect

others Along with mere infection, Trojan

horses, trapdoors, or logic bombs can be included

Like worms, viruses can spread very rapidly

Page 27: Operating System Security

How do viruses work?

When a program is run, it typically has the full privileges of its running user

Include write privileges for some other programs

A virus can use those privileges to replace those programs with infected versions

Page 28: Operating System Security

Typical Virus Actions

1. Find uninfected writable programs

2. Modify those programs3. Perform normal actions of

infected program4. Do whatever other damage is

desired

Page 29: Operating System Security

Before the Infected Program Runs

Infected program Uninfected program

Virus code

Page 30: Operating System Security

The Infected Program Runs

Infected program Uninfected program

Virus code

Page 31: Operating System Security

Infecting the Other Program

Infected program Infected program

Virus code Virus code

Page 32: Operating System Security

How do viruses fit into programs?

Prepended Postpended Copy program and replace Cleverly fit into the cracks Some viruses take other measures

to hide modifications

Page 33: Operating System Security

Dealing with Viruses

Prevention of infection Detection and eradication Containment

Page 34: Operating System Security

Preventing the Spread of Virus

Don’t import untrusted programs But who can you trust?

Viruses have been found in commercial shrink-wrap software

Trusting someone means not just trusting their honesty, but also their caution

Page 35: Operating System Security

Other Prevention Measures

Scan incoming programs for viruses Some viruses are designed to hide

Limit the targets viruses can reach Monitor updates to executables

carefully Requires a broad definition of

executable

Page 36: Operating System Security

Virus Detection Many viruses have detectable

signatures But some work hard to hide them

Smart scanners can examine programs for virus-like behavior

Checksums attached to programs can detect modifications If virus smart enough to generate checksum

itself, digitally sign it

Page 37: Operating System Security

Virus Eradication

Tedious, because you must be thorough

Restore clean versions of everything

Take great care with future restoration of backups

Page 38: Operating System Security

Containment

Run suspicious programs in an encapsulated environment Limiting their forms of access to

prevent virus spread Requires versatile security model

and strong protection guarantees

Page 39: Operating System Security

Security in Distributed Systems A substantially harder problem Many single-system mechanisms are

based on trusting a central operating system

Single-system mechanisms often assume secure communication channels

Single-system mechanisms can (in principle) have access to all relevant data

Page 40: Operating System Security

Security Mechanism for Distributed Systems

Encryption Authentication Firewalls Honeypots

Page 41: Operating System Security

Encryption for Distributed Systems

Can protect secrecy of data while on insecure links

Can also prevent modification and many forms of fabrication attacks

But keys are a tricky issue

Page 42: Operating System Security

Encryption Keys and Distributed System Security

To gain benefit from encryption, communicating entities must share a key

Each separate set of entities need a different key

How do you securely distribute keys?

Page 43: Operating System Security

Problems of Key Distribution

Key must be kept secret Key must be generate by trusted

authority Must be sure key matches

intended use Must be sure keys aren’t reused Must be quick an automatic

Page 44: Operating System Security

Key Distribution Schemes

Manual distribution by one party Use existing key to send new key Manual distribution by third party Key servers

Page 45: Operating System Security

Diffie-Hellman Key Exchange Need a prime

number p Need a base integer

g between 1 and p – 1

Site A picks x between 1 and p – 2

Site B picks y between 1 and p – 2

p: 13 g: 7

A: 3 B: 5

Page 46: Operating System Security

Diffie-Hellman Key Exchange Site A computes

gx mod p Site B computes

gy mod p Site A and B

exchange public values

A: 73 mod 13 = 5 B: 75 mod 13 =

11

A: 3, 11(from B) B: 5, 5 (from A)

Page 47: Operating System Security

Diffie-Hellman Key Exchange Site A computes

(gy mod p)x mod p Site B computes

(gx mod p)y mod p Now A and B have

a shared secret Problem: Prone

to man-in-the-middle attacks

A: 3, 11(from B) B: 5, 5 (from A)

A: 113 mod 13 = 5

B: 55 mod 13 = 5

Page 48: Operating System Security

Key Servers

Trusted third party that can provide good keys on demand

Typically on a separate machine Tremendous care must be taken to

ensure secure communications with the key server

Page 49: Operating System Security

Authentication for Distributed Systems

When a message comes in over the net, how do you tell who sent it?

Generally with some form of digital signature Must be unique to signing user And also unique to the message

Page 50: Operating System Security

Digital Signatures

A digital signature is a guarantee that an electronic document was created by a particular individual

Basic mechanism for authentication Vital for electronic commerce,

secure electronic mail, etc. S = signature(M)

Page 51: Operating System Security

Desirable Properties of Digital Signatures

Easy to generate and verify Nonforgeable Unique Nonrepudiable Storable

Page 52: Operating System Security

Providing Digital Signatures

Encryption with a secret key has some of these properties Encrypt entire message Check signature by decrypting

S = E(M, Ke)

But normal encryption has problems for digital signatures

Page 53: Operating System Security

Problems of Using Encryption for Digital Signatures

Both parties can create same message With same signature

One key per pair of users required Signature is as large of message

Poor storage properties Hard to handle multiple signatures

per message

Page 54: Operating System Security

Public Key Encryption

E(Kpublic, M) C D(Kprivate, C) M

E(Kprivate, M) C D(Kpublic, C) M

Page 55: Operating System Security

Public Key Encryption

Idea Public key is published Private key is the secret

E(Kmy_public, “Hi, Andy”) Anyone can create it, but only I can read it

E(Kmy_private, “I’m Andy”) Everyone can read it, but only I can create

it

Page 56: Operating System Security

Public Key Encryption

E(Kyour_public, E(Kmy_private, “I know your secret”)) Only you can read it, and only I can

send it

Page 57: Operating System Security

Public Key Cryptography and Digital Signatures

User X wants to sign a message M sent to user Y

Calculate a characteristic Z of message M (checksum of something similar) S = E(Z, Kx_private)

Send both M and S to Y

Page 58: Operating System Security

Checking a Public Key Digital Signature

Y calculates the characteristic ZM of M

Then Y checks the signature Z = D(S, Kx_public)

If ZM == Z, the signature is valid

Page 59: Operating System Security

Public Key Digital Signature Diagram

Sender X Receiver Y

M

S

Z = checksum(M)S = E(Z, Kx_private)

Page 60: Operating System Security

Public Key Digital Signature Diagram

Sender X Receiver YM

S

M + S

Page 61: Operating System Security

Public Key Digital Signature Diagram

Sender X Receiver YM

S

ZM = checksum(M)Z = D(S, Kx_public)

If Z = ZM, the signature is valid

Page 62: Operating System Security

How does this scheme handle various attacks?

What if an intruder changes the message?

What if someone replays a message?

What if the sender denies a message he sent?

What if the receiver tries to alter the message?

Page 63: Operating System Security

Intruder Alteration Diagram

Sender X Receiver YM’

S

IntruderIntruder

Page 64: Operating System Security

Discovering the Alternation

Sender X Receiver YM’

S

ZM’ = checksum(M’)Z = D(S, Kx_public)

Z does not equal ZM’, so the signature is invalid

Page 65: Operating System Security

Replay Diagram

Sender X Receiver YM

S

IntruderIntruder

S

M

Page 66: Operating System Security

Replay Occurs

Sender X Receiver Y

IntruderIntruder

M

S

Page 67: Operating System Security

How to handle this replay?

Sequence numbers in messages Challenge/response to sender Timestamp messages and discard

old ones Don’t worry about it

Page 68: Operating System Security

Major Challenge in Public Key Cryptography

How do I find out someone’s public key?

If not done securely, the system is totally compromised

Must also be efficient And how do I securely store and

manage public keys?

Page 69: Operating System Security

Authentication Servers

Like key servers, trusted third parties

An authentication server can produce a ticket that guarantees the identity of a user

Generally tickets expire Kerberos is the most popular

authentication server

Page 70: Operating System Security

More on Kerberos

Uses symmetric cryptography Servers are trusted by all parties Issues tickets that provide secure

communications between clients and servers

Tickets have a lifetime, then expire

Page 71: Operating System Security

Kerberos in Action

KDC

ServerClient

A client wants to communicate securely with a server

Page 72: Operating System Security

The Client Asks Kerberos for a Ticket

KDC

ServerClient

C, S

Page 73: Operating System Security

The Client Asks Kerberos for a Ticket

KDC

ServerClient

{KC,S, {TC,S}KS}KC

Page 74: Operating System Security

What’s going on here?

What’s is in this message? TC,S is the ticket that allows the client

to communicate with the server It’s encrypted with KS (so only the

server can read it) Message contains a new key KC,S

Entire message encrypted in C’s key

Page 75: Operating System Security

Why the Extra Key?

For authentication purposes It’s also contained within the ticket Server can authenticate himself to

client using that key

Page 76: Operating System Security

Client Sends Ticket to Server

KDC

ServerClient{AC}KC,S, {TC,S}KS

Page 77: Operating System Security

What does the client send?

Sends encrypted ticket from Kerberos server Which only server can read

Also sends authenticator AC in session key KC,S

Server gets KC,S from ticket, sends back altered version encrypted with KC,S

Page 78: Operating System Security

Firewalls A program to allow selective access to

the network In both directions

Typically, firewalls protect entire networks

They must examine everything that tries to pass into the protected domain

Only authorized transmissions permitted

Page 79: Operating System Security

Firewall Example

Internet

Page 80: Operating System Security

What do firewalls do well?

Prevent intruders from accessing machines on your network

Prevent your users from inadvertently compromising security

Page 81: Operating System Security

What do firewalls do badly?

Prevent many forms of legitimate access

May get in the way of other forms of security

Often, there’s no further security behind the firewall So if it fails…

Page 82: Operating System Security

Honey Pots

Decoy machines with network accounts No legitimate users should access

those systems If something happens, sound an

alarm