Today: Security Goals of network security

18
Boaz Patt-Shamir lecture 14 1 Today: Security threats symmetric key cryptography public key cryptography » RSA authentication message integrity Implementations: » Key distribution » SSL Boaz Patt-Shamir lecture 14 2 Goals of network security Confidentiality: only sender, intended receiver should “understand” message contents » sender encrypts message » receiver decrypts message Authentication: participants want to be sure who are they talking to Message Integrity: want to ensure message is not altered (add or remove parts) without detection Access and Availability: services must be accessible and available to users Boaz Patt-Shamir lecture 14 3 Internet security threats: sniffing » broadcast media » Promiscuous-mode NIC: reads all packets passing by » can read all unencrypted data (e.g. passwords) » e.g.: C sniffs B’s packets A B C src:B dest:A payload Boaz Patt-Shamir lecture 14 4 Internet security threats: spoofing » application can generate IP packets directly, putting any value into IP source address field » receiver can’t tell if source is spoofed » e.g.: C pretends to be B A B C src:B dest:A payload

Transcript of Today: Security Goals of network security

Page 1: Today: Security Goals of network security

Boaz Patt-Shamirlecture 14 1

Today: Security threats symmetric key cryptography public key cryptography

» RSA authentication message integrity Implementations:

» Key distribution» SSL

Boaz Patt-Shamirlecture 14 2

Goals of network securityConfidentiality: only sender, intended receiver

should “understand” message contents» sender encrypts message» receiver decrypts message

Authentication: participants want to be sure who are they talking to

Message Integrity: want to ensure message is not altered (add or remove parts) without detection

Access and Availability: services must be accessible and available to users

Boaz Patt-Shamirlecture 14 3

Internet security threats: sniffing» broadcast media» Promiscuous-mode NIC: reads all packets passing by» can read all unencrypted data (e.g. passwords)» e.g.: C sniffs B’s packets

A

B

C

src:B dest:A payload

Boaz Patt-Shamirlecture 14 4

Internet security threats: spoofing

» application can generate IP packets directly, putting any value into IP source address field

» receiver can’t tell if source is spoofed» e.g.: C pretends to be B

A

B

C

src:B dest:A payload

Page 2: Today: Security Goals of network security

Boaz Patt-Shamirlecture 14 5

Internet security threats:DoS Flood of maliciously generated packets

“swamp” receiver: Denial of Service (DoS) Distributed DoS (DDoS): multiple

coordinated sources swamp receiver» e.g., C and remote host SYN-attack A

A

B

CSYN

SYNSYNSYN

SYNSYN

SYN

Boaz Patt-Shamirlecture 14 6

Cryptography Principles

Boaz Patt-Shamirlecture 14 7

Friends and enemies: Alice and BobConvention in network security world: Alice and Bob want to communicate “securely” Intruder (Trudy) may intercept, delete, add messages

securesender

securereceiver

channel

data data

Alice Bob

TrudyBoaz Patt-Shamirlecture 14 8

Who might Bob, Alice be? Human users conversing Web browser and a server

» electronic transactions (e.g., on-line purchases)» on-line banking client/server

DNS servers routers exchanging routing table updates ...

Page 3: Today: Security Goals of network security

Boaz Patt-Shamirlecture 14 9

The language of cryptography

plaintext plaintextciphertext

K

encryptionalgorithm

decryption algorithm

Alice’s encryptionkey

Bob’s decryptionkey

K

Boaz Patt-Shamirlecture 14 10

Classic cryptographysubstitution cipher: substituting one thing for another

» monoalphabetic cipher: substitute one letter for another

plaintext: abcdefghijklmnopqrstuvwxyz

ciphertext: mnbvcxzasdfghjklpoiuytrewq

Plaintext: bob. i love you. alice

ciphertext: nkn. s gktc wky. mgsbc

E.g.:

Q: How hard to break this simple cipher?:•brute force (how hard?)•other?

Boaz Patt-Shamirlecture 14 11

Perfect cipher [Shannon 1948]

Definition:» Let C = E[M] » Pr[C=c] = Pr[C=c | M]

Example: one time pad. Let M=M1 ... Mn» Generate random bits b1 ... bn

» E[M] = (M1 ⊕ b1 ... Mn ⊕ bn )

Cons: size! Pseudo Random Generator

» G(R) = b1 ... bn

» Indistinguishable from random (efficiently)Boaz Patt-Shamirlecture 14 12

Secret key crypto: DESDES: Data Encryption Standard US encryption standard [NIST 1993] 56-bit symmetric key, 64 bit plaintext input

Page 4: Today: Security Goals of network security

Boaz Patt-Shamirlecture 14 13

DES Operation

1. initial permutation 2. 16 identical “rounds” of

function application, each using different 48 bits of key

3. final permutation

Boaz Patt-Shamirlecture 14 14

Block Cipher chaining

How to encode a large message?» Would like to guarantee integrity

Encoding:» Ci = E[Mi ⊕ Ci-1]

Decoding:» Mi = D[Ci] ⊕ Ci-1

Malfunctions:» Loss» Reorder/ integrity

Boaz Patt-Shamirlecture 14 15 15

Cipher Block Chaining Mode

(a) Encryption (b) Decryption.

Boaz Patt-Shamirlecture 14 16

Key exchange Goal: Allow strangers establish a shared

secret key for later communication, over an channel with passive eavesdropper

Basic assumption: hard to compute discrete logarithm» Finite groups: = { mod , mod , … }» Given = mod , not known how to find = log when , are given» Not known to be NP-Hard!

Page 5: Today: Security Goals of network security

Boaz Patt-Shamirlecture 14 17

Diffie-Hellman Key ExchangeAlice picks large x, Bob picks large y, key is gxy

(large: e.g., 512 bits)

Boaz Patt-Shamirlecture 14 18

Efficient Exponentiation

Compute gx mod nExpg,n (x)

If (x=0) return 1Let y := /2 ; b:= x mod 2 // b is a bitLet z := Expg,n (y) // recursive callR := z2 mod nIf (b=1) R := g·R mod nReturn R

Complexity: O(log x)

Boaz Patt-Shamirlecture 14 19

Weakness: “Man in the middle” attack Eavesdropper can’t determine secret key

( mod ) from ( mod )or ( mod ) However, how does Alice and Bob know if there is

a third party adversary in between?

Boaz Patt-Shamirlecture 14 20

Public Key Cryptography

Page 6: Today: Security Goals of network security

Boaz Patt-Shamirlecture 14 21

Public Key CryptographyAmazing new idea [Diffie-Hellman’76, RSA’78]sender, receiver do not share secret key.

Instead, each party has: Public encryption key (known to all) Private decryption key private

Boaz Patt-Shamirlecture 14 22

The language of cryptography, revisited

symmetric key crypto: sender, receiver keys identicalpublic-key crypto: encryption key public, decryption key

secret (private)

plaintext plaintextciphertext

KA

encryptionalgorithm

decryption algorithm

Alice’s encryptionkey

Bob’s decryptionkey

KB

Boaz Patt-Shamirlecture 14 23

Public key cryptography

plaintextmessage, m

ciphertextencryptionalgorithm

decryption algorithm

publicBob’s key

plaintextmessageK (m)

B+

K B+

privateBob’s key

K B-

Boaz Patt-Shamirlecture 14 24

Public key encryption

Two requirements: Functions and such that

Keys for encryption and decryption

First satisfactory solution: Rivest, Shamir and Adleman (RSA) 1978

Page 7: Today: Security Goals of network security

Boaz Patt-Shamirlecture 14 25

RSA: Setup (choosing keys)

1. Choose two large prime numbers p, q. (e.g., 1024 bits each)

2. Compute , 3. Choose (with ) that has no common

factors with . ( are relatively prime)4. Choose such that ( ) is divisible by

(namely: ).5. Output Public key , Private key: .

Boaz Patt-Shamirlecture 14 26

RSA: Encryption, decryption

Sender: Given message , compute. This is the ciphertext.

Receiver: Given ciphertext , compute.

Theorem: .

Boaz Patt-Shamirlecture 14 27

Some Math (Number Theory)

Fermat’s Little Theorem:For any prime p and natural :

(because ∗ ).Euler’s generalization:

For any natural with : ( ) ,where is # of numbers in

relatively prime to Boaz Patt-Shamirlecture 14 28

Why RSA works

By choice of we have

So // RSA alg.// alwaysmod // Euler// choice of

Page 8: Today: Security Goals of network security

Boaz Patt-Shamirlecture 14 29

Digital Signatures Like hand-written

signatures. Sender digitally signs Receiver can verify that the

sender, and no one else, signed document. (Verifiable, nonforgeable.)

How to do?! Requires» ( ( )) = ( ( ))

» RSA

Simple digital signature for message m:

Bob decrypts m with his private key , creating signed message, ( ).

Bob sends m and ( ) to Alice.

Boaz Patt-Shamirlecture 14 30

Digital Signatures (more)

Suppose Alice receives msg , and digital signature ( )

Alice verifies m signed by Bob by applying Bob’s public key to ( )then checks ( ( )) = .

If ( ( )) = , whoever signed must have used Bob’s private key.

Alice thus verifies that:» Bob signed .» No one else signed .» Bob signed and not ’.

Non-repudiation:» Alice can take , and

signature ( ) to court and prove that Bob signed .

Boaz Patt-Shamirlecture 14 31

Message Digests

Computationally expensive to public-key-encrypt long messages

Goal: fixed-length, easy to compute digital signature, “fingerprint”

apply hash function to , get fixed size message digest, ( ).

Hash function properties: Many-to-1 Produces fixed-size msg

digest (fingerprint) Given message digest ,

computationally infeasible to find such that = ( )

computationally infeasible to find any two messages and ’ such that( ) = ( ’).

Boaz Patt-Shamirlecture 14 32

Hash Function Algorithms Internet checksum

would make a poor message digest.» Too easy to find

two messages with same checksum.

MD5 hash function widely used.» Computes 128-bit

message digest in 4-step process.

» arbitrary 128-bit string x, appears difficult to construct msg m whose MD5 hash is equal to x.

SHA-1 is also used.» US standard» 160-bit message digest

Page 9: Today: Security Goals of network security

Boaz Patt-Shamirlecture 14 33

large messagem

H: Hashfunction H(m)

digitallysign

Bob’s private

key K B-

+

Bob sends digitally signed message:

Alice verifies signature and integrity:

KB(H(m))-

encrypted msg digest

KB(H(m))-

encrypted msg digest

large messagem

H: Hashfunction

H(m)

verifysignature

H(m)

Bob’s public

key K B+

equal?

Digital signature = signed message digest

Boaz Patt-Shamirlecture 14 34

AuthenticationGoal: Bob wants Alice to “prove” her

identity to himAlice says “I am Alice”:1.0Protocol ap

Failure scenario??“I am Alice”

Boaz Patt-Shamirlecture 14 35

AuthenticationGoal: Bob wants Alice to “prove” her

identity to himAlice says “I am Alice”:1.0Protocol ap

in a network,Bob can not “see” Alice, so Trudy simply declaresherself to be Alice

“I am Alice”

Boaz Patt-Shamirlecture 14 36

Authentication: another tryProtocol ap2.0: Alice says “I am Alice” in an IP packetcontaining her source IP address

Failure scenario??

“I am Alice”Alice’s IP address

Page 10: Today: Security Goals of network security

Boaz Patt-Shamirlecture 14 37

Authentication: another tryProtocol ap2.0: Alice says “I am Alice” in an IP packetcontaining her source IP address

Trudy can createa packet “spoofing”Alice’s address“I am Alice”Alice’s

IP address

Boaz Patt-Shamirlecture 14 38

Authentication: another tryAlice says “I am Alice” and sends her:3.0Protocol ap

secret password to “prove” it.

Failure scenario??

“I’m Alice”Alice’s IP addr

Alice’s password

OKAlice’s IP addr

Boaz Patt-Shamirlecture 14 39

Authentication: another tryProtocol ap3.0: Alice says “I am Alice” and sends hersecret password to “prove” it.

playback attack: Trudy records Alice’s packetand laterplays it back to Bob

“I’m Alice”Alice’s IP addr

Alice’s password

OKAlice’s IP addr

“I’m Alice”Alice’s IP addr

Alice’s password

Boaz Patt-Shamirlecture 14 40

Authentication: yet another try

Protocol ap3.1: Alice says “I am Alice” and sends herencrypted secret password to “prove” it.

Failure scenario??

“I’m Alice”Alice’s IP addr

encrypted password

OKAlice’s IP addr

Page 11: Today: Security Goals of network security

Boaz Patt-Shamirlecture 14 41

Authentication: yet another try

Protocol ap3.1: Alice says “I am Alice” and sends herencrypted secret password to “prove” it.

recordandplaybackstill works!

“I’m Alice”Alice’s IP addr

encryptedpassword

OKAlice’s IP addr

“I’m Alice”Alice’s IP addr

encryptedpassword

Boaz Patt-Shamirlecture 14 42

Authentication: yet another try

Failures, drawbacks?

“I am Alice”

R

K (R)A-BAlice is live, and only Alice knows key to encrypt nonce, so it must be Alice!

• Goal: avoid playback attack• Nonce: number (R) used only once –in-a-lifetime• ap4.0: to prove Alice “live”, Bob sends Alice nonce, R.

Alice must return R, encrypted with shared secret key

Boaz Patt-Shamirlecture 14 43

Authentication: ap5.0ap4.0 requires shared symmetric key can we authenticate using public key techniques?ap5.0: use nonce, public key cryptography

“I am Alice”R

Bob computes

K (R)A-

“send me your public key”

K A+

(K (R)) = RA

-K A

+

and knows only Alice could have the private key, that encrypted R such that

(K (R)) = RA-

K A+

Boaz Patt-Shamirlecture 14 44

ap5.0: security holeMan (woman) in the middle attack: Trudy poses as

Alice (to Bob) and as Bob (to Alice)I am Alice I am Alice

RT

K (R)-

Send me your public key

TK +

AK (R)-

Send me your public key

AK +

TK (m)+

Tm = K (K (m))+

T-

Trudy gets

sends m to Alice encrypted with Alice’s public key

AK (m)+

Am = K (K (m))+

A-

R

Page 12: Today: Security Goals of network security

Boaz Patt-Shamirlecture 14 45

ap5.0: security hole

Man (woman) in the middle attack: Trudy poses as Alice (to Bob) and as Bob (to Alice)

Difficult to detect: Bob receives everything that Alice sends, and vice versa. (e.g., so Bob, Alice can meet one week later and recall conversation) problem is that Trudy receives all messages as well!

Boaz Patt-Shamirlecture 14 46

Key Distribution

Centers

Boaz Patt-Shamirlecture 14 47

Problems with Public-Key Encryption

A way for Trudy to subvert public-key encryption.

Boaz Patt-Shamirlecture 14 48

Trusted IntermediariesProblem:

» How do two entities establish shared secret key over network?

Solution:» trusted key

distribution center (KDC) acting as intermediary between entities

Problem:» When Alice obtains

Bob’s public key (from web site, e-mail, diskette), how does she know it is Bob’s public key, not Trudy’s?

Solution:» trusted certification

authority (CA)

Page 13: Today: Security Goals of network security

Boaz Patt-Shamirlecture 14 49

Key Distribution Center (KDC) Alice,Bob need shared

symmetric key. KDC: server shares

different secret key with each registered user.

Alice, Bob know own symmetric keys, KA-KDCKB-KDC , for communicating with KDC.

Alice communicates with KDC, gets session key R1, and KB-KDC(A,R1)

Alice sends Bob KB-KDC(A,R1), Bob extracts R1

Alice, Bob now share the symmetric key R1.

Boaz Patt-Shamirlecture 14 50

CertificationAuthorities

Certification authority (CA) binds public key to particular entity.

Entity (person, router, etc.) can register its public key with CA.» Entity provides “proof

of identity” to CA. » CA creates certificate

binding entity to public key.

» Certificate digitally signed by CA.

When Alice wants Bob’s public key:

gets Bob’s certificate (Bob or elsewhere).

Apply CA’s public key to Bob’s certificate, get Bob’s public key

Boaz Patt-Shamirlecture 14 51

X.509 is the standard for certificates The basic fields of an X.509 certificate.

Boaz Patt-Shamirlecture 14 52

Public-Key Infrastructures

PKIs are a way to structure certificates (a) A hierarchical PKI. (b) A chain of certificates.

Page 14: Today: Security Goals of network security

Boaz Patt-Shamirlecture 14 53

Example revisited (solved with certificates)

Trudy presents Alice a certificate, purporting to be Bob, but Alice is unable to trace Trudy’s certificate back to a trusted root

Be wary if your browser warns about certs!

Boaz Patt-Shamirlecture 14 54

Secure Socket layer

(SSL)

Boaz Patt-Shamirlecture 14 55

Secure sockets layer (SSL)

Idea: security at the transport. » Provides security to any TCP-based app» Used between WWW browsers (https).

Services:» server authentication (optional: client authentication)» data encryption

Server authentication:» Using keys (built into the browser) of trusted CAs.» Other servers require a certificate issued by trusted CA.

Visit your browser’s security menu to see its trusted CAs.

Boaz Patt-Shamirlecture 14 56

SSL basics

What happens behind the curtain when you click an https link

Page 15: Today: Security Goals of network security

Boaz Patt-Shamirlecture 14 57

SSL: more

SSL can be used for non-Web applications, e.g., IMAP. Encryption:

» Browser generates symmetric session key, encrypts it with server’s public key, sends encrypted key to server.

» Using its private key, server decrypts session key.» Browser, server agree that future msgs will be

encrypted.» All data sent into TCP socket (by client or server) is

encrypted with session key. SSL: basis of IETF Transport Layer Security (TLS). Client authentication can be done with client certificates.

Boaz Patt-Shamirlecture 14 58

Access Control in

the Network

Boaz Patt-Shamirlecture 14 59

Firewalls

Function: control connection of organization’s internal net (intranet) to Internet.

Goals:» prevent denial of service attacks:» prevent messing with internal data.

- read confidential info- write info

Means:» packet filter» application gateways

Boaz Patt-Shamirlecture 14 60

Packet Filtering

Internal network is connected to Internet through a router. Router can filter packets, based on:

» source, detination IP address» TCP/UDP source and destination port numbers» ICMP message type» TCP SYN and ACK bits

Example: block incoming and outgoing datagrams with IP protocol field = 17 and with either source or dest port = 23.» All incoming and outgoing UDP flows and telnet connections are blocked.

Example 2: Block inbound TCP segments with ACK=0.» Prevents external clients from making TCP connections with internal

clients, but allows internal clients to connect to outside.

Page 16: Today: Security Goals of network security

Boaz Patt-Shamirlecture 14 61

Virtual Private Networks Using firewalls and IPsec encryption to provide a

“leased-line” like connection over the Internet

Boaz Patt-Shamirlecture 14 62

Application gateways Idea: look at app data too (not only L3 & L4 headers) Example: allow select internal users to telnet outside.

1. Require all telnet users to telnet through gateway.2. For authorized users, gateway sets up telnet connection to

dest host. Gateway relays data between 2 connections3. Router filter blocks all telnet connections not originating from

gateway.host-to-gatewaytelnet session

gateway-to-remote host telnet session

applicationgateway

router and filter

Boaz Patt-Shamirlecture 14 63

Limitations of firewalls and gateways

IP spoofing: router can’t know if data “really” comes from claimed source

If multiple app’s need special treatment, each has own app. gateway.

Client software must know how to contact gateway.» e.g., must set IP address of proxy in Web browser

Filters often use all or nothing policy for UDP. Tradeoff: degree of communication with outside world, level

of security Many highly protected sites still suffer from attacks.

Boaz Patt-Shamirlecture 14 64

Network Security (summary)Basic techniques…... cryptography (symmetric and public) authentication message integrity…. used in many different security scenarios secure email secure transport (SSL) IP sec Firewalls

Page 17: Today: Security Goals of network security

Boaz Patt-Shamirlecture 14 65

Secure email

Boaz Patt-Shamirlecture 14 66

Secure e-mail

Alice:generates random symmetric private key, KS.

encrypts message with KS (for efficiency)also encrypts KS with Bob’s public key.

sends both K (m) and KB(K ) to Bob

Alice wants to send confidential e-mail, m, to Bob.

KS( ).

KB( ).+

+ -KS(m )

KB(KS )+

m

KS

KS

KB+

Internet

KS( ).

KB( ).-

KB-

KS

mKS(m )

KB(KS )+

Boaz Patt-Shamirlecture 14 67

Secure e-mail

Bob:uses his private key to decrypt and recover

KS

Alice wants to send confKS( )

.

KB( ).+

+ -KS(m )

KB(KS )+

m

KS

KS

KB+

Internet

KS( ).

KB( ).-

KB-

KS

mKS(m )

KB(KS )+

Boaz Patt-Shamirlecture 14 68

Secure e-mail (continued)

•Alice wants to provide sender authentication message integrity.Alice digitally signs messends both message (in

H( ).KA( )

.-

+ -

H(m )KA(H(m))-

m KA-

Internet

m

KA( ).+KA+

KA(H(m))-

mH( ). H(m )

compare

Page 18: Today: Security Goals of network security

Boaz Patt-Shamirlecture 14 69

Pretty good privacy (PGP)

Internet e-mail encryption scheme, a de-facto standard.

Uses symmetric key cryptography, public key cryptography, hash function, and digital signature as described.

Provides secrecy, sender authentication, integrity.

Inventor, Phil Zimmerman, was target of 3-year federal investigation.

---BEGIN PGP SIGNED MESSAGE---Hash: SHA1

Bob:My husband is out of town tonight.Passionately yours, Alice

---BEGIN PGP SIGNATURE---Version: PGP 5.0Charset: noconvyhHJRHhGJGhgg/12EpJ+lo8gE4vB3mqJ

hFEvZP9t6n7G6m5Gw2---END PGP SIGNATURE---

A PGP signed message: