11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py...

114
Telematics Chapter 11: Network Security Beispielbild User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer Systems and Telematics (CST) Presentation Layer Session Layer Application Layer Presentation Layer Session Layer Application Layer Distributed, embedded Systems Institute of Computer Science Freie Universität Berlin Data Link Layer Network Layer Transport Layer Data Link Layer Network Layer Transport Layer Data Link Layer Network Layer Freie Universität Berlin http://cst.mi.fu-berlin.de Data Link Layer Physical Layer Data Link Layer Physical Layer Data Link Layer Physical Layer Prof. Dr. Mesut Güneş cst.mi.fu-berlin.de Telematics Chapter 11: Network Security

Transcript of 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py...

Page 1: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

TelematicsChapter 11: Network Security

Beispielbildp y

User watching video clip

Server with video clips

Prof. Dr. Mesut GüneşComputer Systems and Telematics (CST)

Presentation Layer

Session Layer

Application Layer

Presentation Layer

Session Layer

Application Layer

p y ( )Distributed, embedded Systems Institute of Computer ScienceFreie Universität Berlin Data Link Layer

Network Layer

Transport Layer

Data Link Layer

Network Layer

Transport Layer

Data Link Layer

Network Layer

Freie Universität Berlinhttp://cst.mi.fu-berlin.de

Data Link Layer

Physical Layer

Data Link Layer

Physical Layer

Data Link Layer

Physical Layer

Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 2: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Contents

● What is network security?● Principles of cryptography● Principles of cryptography● Message Integrity● Securing e-mail● Securing TCP connections: SSL● Network Layer security: IPsec● Securing Wireless LANs● Operational security: Firewalls and IDS

11.2Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 3: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Design Issuesg

● Understand principles of network security: OSI Reference Modely● cryptography and its many uses

beyond “confidentiality”● authentication Presentation Layer

Application Layer

● authentication●message integrity

● Security in practice:

Presentation Layer

Session Layery p

● firewalls and intrusion detection systems

● security in application transportNetwork Layer

Transport Layer

● security in application, transport, network, link layers Data Link Layer

Ph sical La ePhysical Layer

11.3Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 4: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

What is network security?y

● Confidentiality: only sender and intended receiver should “understand” message contentsg● Sender encrypts message● Receiver decrypts message

A h i i d d i fi id i f h h● Authentication: sender and receiver want to confirm identity of each other ● Message integrity: sender and receiver want to ensure that the message

can not altered (in transit, or afterwards) without detectioncan not altered (in transit, or afterwards) without detection● Access and availability: services must be accessible and available to users

11.4Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 5: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Friends and enemies: Alice, Bob, Trudy, , y

● Well-known in network security world● Bob, Alice (lovers!) want to communicate “securely”( ) y● Trudy (intruder) may intercept, delete, add messages

● Real-life Bobs and Alices● Telnet client and server●Web browser/server for electronic transactions●Web browser/server for electronic transactions● On-line banking client/server● DNS servers

R t h i ti t bl d t

11.5

● Routers exchanging routing table updates

Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 6: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

There are bad guys (and girls) out there!g y ( g )

● What can a “bad guy” do?● A lot!● A lot!● Eavesdrop: intercept messages● Actively insert messages into connection● Impersonation: can fake (spoof) source address in packet (or any field in packet)●Hijacking: “take over” ongoing connection by removing sender or receiver,

inserting himself in placeg p●Denial of service: prevent service from being used by others (e.g., by

overloading resources)

11.6Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 7: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Principles of cryptographyPrinciples of cryptography

11.7Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 8: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

The language of cryptographyg g yp g p y

● Plaintext message m● Keys KA KB● Keys KA, KB

● Encryption: ciphertext c=KA(m), encrypted with key KA

● Decryption: plaintext m = KB(c) = KB(KA(m))B B A

11.8Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 9: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Simple encryption schemep yp

● Substitution cipher: substituting one thing for another●Monoalphabetic cipher: substitute one letter for another●Monoalphabetic cipher: substitute one letter for another

plaintext: abcdefghijklmnopqrstuvwxyzplaintext: abcdefghijklmnopqrstuvwxyz

ciphertext: mnbvcxzasdfghjklpoiuytrewqp g j p y q

plaintext: bob i love you alicee.g.:ciphertext: nkn s gktc wky mgsbc

● Key: the mapping from the set of 26 letters to the set of 26 letters

11.9Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 10: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Polyalphabetic encryptiony p yp

● n monoalphabetic ciphers: M1, M2, …, Mn

● Cycling pattern:● n=4●M1,M3,M4,M3,M2; M1,M3,M4,M3,M2

● Fo each ne plainte t s mbol se s bseq ent monoalphabetic patte n in● For each new plaintext symbol, use subsequent monoalphabetic pattern in cyclic pattern● dog: d from M1, o from M3, g from M4

● Key: the n ciphers and the cyclic pattern

11.10Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 11: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Breaking an encryption schemeg yp

1) Cipher-text only attack ● Trudy has ciphertext that she can

2) Known-plaintext attack● Trudy has some plaintext● Trudy has ciphertext that she can

analyze

T h

● Trudy has some plaintext corresponding to some ciphertext

● e.g., in monoalphabetic cipher, Trudy determines pairings for● Two approaches:

● Search through all keys: must be able to differentiate resulting

Trudy determines pairings for a, l, i, c, e, b, o

gplaintext from gibberish

● Statistical analysis3) Chosen-plaintext attack● Trudy can get the ciphertext for

some chosen plaintextsome chosen plaintext

11.11Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 12: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Types of Cryptographyyp yp g p y

● Cryptography often uses keys:● Algorithm is known to everyone● Algorithm is known to everyone●Only “keys” are secret

● Symmetric key cryptography● Involves the use one key

● Public key cryptography ● Also known as asymmetric key cryptographyy y yp g p y● Involves the use of two keys

● Hash functions● Involves the use of no keys●Nothing secret: How can this be useful?

11.12

●Nothing secret: How can this be useful?

Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 13: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Symmetric CryptographySymmetric Cryptography

11.13Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 14: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Symmetric key cryptographyy y yp g p y

● Symmetric key cryptography● Bob and Alice share same (symmetric) key: K● Bob and Alice share same (symmetric) key: K● e.g., key is knowing substitution pattern in monoalphabetic substitution cipher

● How do Bob and Alice agree on a key?

● Two types of symmetric ciphers● Stream ciphers: encrypt one bit at time● Block ciphers● Break plaintext message in equal size blocks

11.14

● Break plaintext message in equal-size blocks● Encrypt each block as a unit

Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 15: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Stream Ciphersp

● Combine each bit of keystream with bit of plaintext to get bit of ciphertext●m(i) = i-th bit of message●m(i) i th bit of message ● Ks(i) = i-th bit of keystream● c(i) = i-th bit of ciphertext

● c(i) = Ks(i) ⊕ m(i) (⊕ = exclusive or)●m(i) = Ks(i) ⊕ c(i)●m(i) Ks(i) ⊕ c(i)

pseudo random

keystreamgeneratorkey keystream

pseudo random

generatory keystream

11.15Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 16: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

RC4 Stream Cipherp

● RC4 is a popular stream cipher● Extensively analyzed and considered good● Extensively analyzed and considered good● Key can be from 1 to 256 bytes●Used in WEP for IEEE 802.11● Can be used in SSL

11.16Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 17: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Block ciphersp

● Message to be encrypted is processed in blocks of k bits ● e.g., 64-bit blocks● e.g., 64 bit blocks

● 1-to-1 mapping is used to map k-bit block of plaintext to k-bit block of ciphertext

● Example with k=3:

input output000 110000 110001 111010 101011 100011 100100 011101 010110 000

Wh t i th i h t t f 010 110 001 111?

110 000111 001

11.17

● What is the ciphertext for 010 110 001 111?

Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 18: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Block ciphersp

● How many possible mappings are there for k=3?●How many 3-bit inputs?●How many 3 bit inputs?●How many permutations of the 3-bit inputs?● Answer: 40,320 ● Not very many, easy to try all possible values with a computer.

● In general, 2k! mappings● For k=4 20922789888000 permutations● For k 4 20922789888000 permutations●Huge for k=64

● Problem: ● Table approach requires table with 264 entries, each entry with 64 bits

● Table too big: instead use function that simulates a randomly permuted table

11.18Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 19: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Prototype functionyp

11.19Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 20: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Why rounds in prototpe?y p p

● If only a single round, then one bit of input affects at most 8 bits of output.p

● In 2nd round, the 8 affected bits get scattered and inputted into multiple substitution boxes.H d ?● How many rounds?●How many times do you need to shuffle cards● Becomes less efficient as n increases● Becomes less efficient as n increases

11.20Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 21: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Encrypting a large messageyp g g g

● Why not just break message in 64-bit blocks, encrypt each block separately?● If same block of plaintext appears twice, will give same ciphertext.

● How about:● How about:●Generate random 64-bit number r(i) for each plaintext block m(i)● Calculate c(i) = KS( m(i) ⊕ r(i) )

(i) (i) i 1 2● Transmit c(i), r(i), i=1,2,…● At receiver: m(i) = KS(c(i)) ⊕ r(i) ● Problem: inefficient, need to send c(i) and r(i)ob , d o d c( ) a d r( )

11.21Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 22: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Cipher Block Chaining (CBC)p g ( )

●CBC generates its own random numbers●Have encryption of current block depend on result of previous block●Have encryption of current block depend on result of previous block●c(i) = KS(m(i) ⊕ c(i-1) )●m(i) = KS(c(i)) ⊕ c(i-1)m( ) KS(c( )) ⊕ c( )

●How do we encrypt first block?o do e e c ypt st b oc●Initialization vector (IV): random block = c(0)●IV does not have to be secret

●Change IV for each message (or session)●Guarantees that even if the same message is sent repeatedly, the

ciphertext will be completely different each time

11.22Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 23: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Cipher Block Chainingp g

● Cipher block: if input block repeated, will produce same cipher text:

● Cipher block chaining: XOR i-th input block, m(i),

i h i bl k f

t=1m(1) = “HTTP/1.1” block

cipherc(1) = “k329aM02”

…m(17) = “HTTP/1 1” c(17) “k329 M02”with previous block of

cipher text, c(i-1)● c(0) transmitted to

t=17m(17) = HTTP/1.1 block

cipherc(17) = k329aM02”

( )receiver in clear

●what happens in “HTTP/1.1” scenario from above? +

m(i)

c(i 1)scenario from above? +block

h

c(i-1)

c(i)

cipher

11.23

c(i)

Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 24: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Symmetric Key CryptographySymmetric Key Cryptography

11.24Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 25: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Symmetric Key Cryptography: DESy y yp g p y

● DES: Data Encryption Standard●US encryption standard [NIST 1993]●US encryption standard [NIST 1993]● 56-bit symmetric key, 64-bit plaintext input● Block cipher with cipher block chaining

● How secure is DES?●DES Challenge: 56 bit key encrypted phrase decrypted (brute force) in less than●DES Challenge: 56-bit-key-encrypted phrase decrypted (brute force) in less than

a day●No known good analytic attack

● Making DES more secure:● 3DES: encrypt 3 times with 3 different keys● 3DES: encrypt 3 times with 3 different keys● Actually: encrypt, decrypt, encrypt

11.25Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 26: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Symmetric Key Cryptography: DESy y yp g p y

● Initial permutation ● 16 identical “rounds” of function● 16 identical rounds of function

application● Final permutation

11.26Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 27: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

AES: Advanced Encryption Standardyp

● New (Nov. 2001) symmetric-key NIST standard, replacing DES● Processes data in 128 bit blocks● Processes data in 128 bit blocks● Key length: 128, 192, or 256 bit

● Brute force decryption (try each key) taking 1 sec on DES, takes 149 trillion years for AES

11.27Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 28: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Public Key CryptographyPublic Key Cryptography

11.28Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 29: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Public Key Cryptographyy yp g p y

● Symmetric key cryptography● Requires sender, receiver know shared secret key● Requires sender, receiver know shared secret key●How to agree on key in first place (particularly if never “met”)?

● Public key cryptography● Radically different approach [Diffie-Hellman76, RSA78]● Sender receiver do not share secret key● Sender, receiver do not share secret key● Public encryption key known to all● Private decryption key known only to receiver

11.29Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 30: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Public Key Cryptographyy yp g p y

11.30Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 31: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Public Key Cryptographyy yp g p y

● Requirements:

1) Need: m))((such that )( and )( =•• +−−+ mKKKK BBBB

2) Given public key , it should be impossible to compute private key −BK +

BK

● RSA: Rivest, Shamir, Adleman algorithm

11.31Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 32: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Prerequisite: Modular Arithmeticq

● x mod n = remainder of x when divided by n● Facts:● Facts:● [(a mod n) + (b mod n)] mod n = (a+b) mod n● [(a mod n) - (b mod n)] mod n = (a-b) mod n● [(a mod n) × (b mod n)] mod n = (a×b) mod n

● Thus● Thus(a mod n)d mod n = ad mod n

● Example: x=14, n=10, d=2(x mod n)d mod n = 142 mod 10 = 6

d 2xd = 142 = 196 196 mod 10 = 6

11.32Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 33: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

RSA: Getting Readyg y

● A message is a bit pattern● A bit pattern can be uniquely represented by an integer number● A bit pattern can be uniquely represented by an integer number● Thus encrypting a message is equivalent to encrypting a number

● Example●m=10010001

This message is uniquely represented by the decimal number 145This message is uniquely represented by the decimal number 145● To encrypt m, we encrypt the corresponding number, which gives a new number

(the ciphertext)

11.33Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 34: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

RSA: Creating public/private key pairg p p y p

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

2 C ( 1)( 1)2. Compute n = pq, z = (p-1)(q-1)

3 Choose e (with e<n) that has no common factors3. Choose e (with e<n) that has no common factorswith z. (e, z are “relatively prime”).

4 Ch s d s h th t d 1 is tl di isibl b 4. Choose d such that ed-1 is exactly divisible by z.(in other words: ed mod z = 1 ).

5. Public key is (n,e). Private key is (n,d).

K+ K -

11.34

KB KB

Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 35: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

RSA: Encryption and Decryptionyp yp

Given (n e) and (n d) as computed aboveGiven (n,e) and (n,d) as computed above

1. To encrypt message m (<n), computeyp g ( ) pc = m mod ne

2. To decrypt received bit pattern, c, computem = c mod ndm c mod n

e dMagic m = (m mod n)e mod ndMagichappens!

c

11.35Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 36: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

RSA Examplep

Bob chooses p=5, q=7 n=35, z=24e=5 (so e, z relatively prime)d=29 (so ed-1 exactly divisible by z)

i l e d eEncrypting 8-bit messages:

numeric valueml 12

me248832

c = m mod ne17

encrypt:

c m = c mod ndcddecrypt:17 481968572106

750915091411825223071697

12

11.36Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 37: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Why does RSA work?y

●Must show that cd mod n = mwhere c = me mod nwhere c = me mod n

●Fact: for any x and y: xy mod n = x(y mod z) mod n●Fact: for any x and y: xy mod n = x(y mod z) mod n●where n = pq and z = (p-1)(q-1)

●Thus cd mod n = (me mod n)d mod nc mod n (m mod n) mod n

= med mod n = m(ed mod z) mod n m mod n= m1 mod n= m

11.37

= m

Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 38: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

RSA: An important propertyp p p y

The following property will be very useful later:he follow ng property w ll be very useful later

( )- + ( )+ -K (K (m)) = mBB+

K (K (m))BB+=

use public key first,then private key

use private key first,then public key

Result is the same!

11.38Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 39: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

RSA: An important propertyp p p y

K (K (m)) = mBB

- +K (K (m))BB

+ -=Why ?

F ll di tl f d l ith tiFollows directly from modular arithmetic:

(me mod n)d mod n = med mod n(m mod n) mod n = m mod n= mde mod n= (md mod n)e mod n

11.39Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 40: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Why is RSA Secure?y

● Suppose you know Bob’s public key (n,e). How hard is it to determine d?● Essentially need to find factors of n without knowing the factors p and q● Essentially need to find factors of n without knowing the factors p and q. ● Fact: factoring a big number is hard.

● Generating RSA keys●Have to find big primes p and q

A h k d th l t ti l● Approach: make good guess then apply testing rules

11.40Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 41: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Session keysy

● Exponentiation is computationally intensive● DES is at least 100 times faster than RSA● DES is at least 100 times faster than RSA

● Session key KSS● Bob and Alice use RSA to exchange a symmetric key KS

●Once both have KS, they use symmetric key cryptography

11.41Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 42: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Message IntegrityMessage Integrity

11.42Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 43: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Message Integrityg g y

● Allows communicating parties to verify that received messages are authentic.● Content of message has not been altered● Source of message is who/what you think it is

M h b l d●Message has not been replayed● Sequence of messages is maintained

● Let’s first talk about message digestsLet s first talk about message digests

11.43Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 44: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Message Digestsg g

● Function H() that takes as input an arbitrary length message and

● Desirable properties● Easy to calculatey g g

outputs a fixed-length string: “message signature”

● Note that H() is a many to 1

● Easy to calculate● Irreversibility: Can’t determine m

from H(m)C lli i i t● Note that H() is a many-to-1

function● H() is often called a “hash

● Collision resistance:● Computationally difficult to produce

m and m’ such that H(m) = H(m’)()function” ● Seemingly random output

h=H(m)H: HashFunction

large messagem

11.44Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 45: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Internet checksum: poor message digestp g g

● Internet checksum has some properties of hash functions● Produces fixed length digest (16-bit sum) of input● Produces fixed length digest (16 bit sum) of input● Is many-to-one● But given message with given hash value, it is easy to find another message with

h h lsame hash value● Example: Simplified checksum: add 4-byte chunks at a time:

I O U 9 49 4F 55 39Message ASCII format

I O U 1 49 4F 55 31Message ASCII format

0 0 . 19 B O B

30 30 2E 3139 42 D2 42

B2 C1 D2 AC

0 0 . 99 B O B

30 30 2E 3939 42 D2 42

B2 C1 D2 AC B2 C1 D2 AC

Different messagesb t id ti l h ks ms!

B2 C1 D2 AC

11.45

but identical checksums!

Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 46: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Hash Function Algorithmsg

● MD5 hash function widely used (RFC 1321) ● Computes 128-bit message digest in 4-step process● Computes 128 bit message digest in 4 step process

● SHA-1 is also used●US standard [NIST, FIPS PUB 180-1]● 160-bit message digest

11.46Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 47: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Message Authentication Code (MAC)g ( )

● Process of creating a MAC● Alice creates message m and calculates h=H(m)● Alice creates message m and calculates h H(m)● Alice appends h to m, creating an extended message (m, h) and sends to Bob● Bob receives (m, h) and calculates H(m). If H(m) = h everything is fine!

● Problem● Trudy creates bogus message m‘ and pretends to be Alice● Trudy creates bogus message m and pretends to be Alice● Trudy calculates h‘=H(m‘) and sends (m‘, h‘) to Bob● Bob calculates H(m‘) and verifies to h‘

● Need to authenticate the sender!

11.47Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 48: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Message Authentication Code (MAC)g ( )

● Alice and Bob need to share additional secret: s● Process of creating a MAC● Process of creating a MAC● Alice creates message m, concatenates s and calculates h=H(m+s)● Alice appends h to m, creating an extended message (m, h) and sends to Bob● Bob receives (m, h) and calculates H(m+s). If H(m) = h everything is fine!

● Problem●How do Alice and Bob agree on s?●How do Alice and Bob agree on s?

11.48Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 49: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Message Authentication Code (MAC)g ( )

● HMAC● Popular MAC standard● Popular MAC standard● Addresses some subtle security flaws

● HMAC in process1. Concatenates secret to front of message2 Hashes concatenated message2. Hashes concatenated message3. Concatenates the secret to front of digest4. Hashes the combination again

11.49Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 50: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Example: OSPFp

● Recall that OSPF is an intra-AS routing protocol

● Attacks●Message insertiong p

● Each router creates map of entire AS (or area) and runs shortest path algorithm over map

●Message insertion●Message deletion●Message modification

path algorithm over map.● Router receives link-state

advertisements (LSAs) from all ● How do we know if an OSPF

message is authentic?other routers in AS.

message is authentic?

11.50Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 51: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

OSPF Authentication

● Within an Autonomous System, routers send OSPF messages to

● Cryptographic hash with MD5● 64-bit authentication field includesg

each other.● OSPF provides authentication

choices

● 64 bit authentication field includes 32-bit sequence number

●MD5 is run over a concatenation of the OSPF packet and shared secretchoices

●No authentication● Shared password: inserted in clear

the OSPF packet and shared secret key

●MD5 hash then appended to OSPF packet; encapsulated in IP

pin 64-bit authentication field in OSPF packet

● Cryptographic hash

packet; encapsulated in IP datagram

Cryptographic hash

11.51Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 52: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Message IntegrityDigital Signatures Message Integrity

11.52Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 53: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Digital Signatures g g

● Cryptographic technique analogous to hand-written signatures● Sender (Bob) digitally signs document establishing he is document● Sender (Bob) digitally signs document, establishing he is document

owner/creator● Goal is similar to that of a MAC, except now use public-key cryptography● Verifiable and ●Nonforgeable

Recipient (Alice) can prove to someone that Bob and no one else (includingRecipient (Alice) can prove to someone that Bob, and no one else (including Alice), must have signed document

11.53Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 54: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Digital Signatures g g

● Simple digital signature for message m:● Bob signs m by encrypting with his private key KB creating “signed”-● Bob signs m by encrypting with his private key KB, creating signed

message, KB(m)-

Bob’s message, m Bob’s privatekey

K B-

K B-(m)

Dear AliceOh, how I have missed you. I think of you all the

Public keyti

key B

Bob’s message, m, signed (encrypted)

B( )

y ytime! …(blah blah blah)

Bob

encryptionalgorithm

with his private key

11.54Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 55: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Digital signature = Signed message digestg g g g g

Alice verifies signature and integrity of digitally signed

Bob sends digitally signed message:

message:large

message H: HashH( )

g

encrypted m ssagm function H(m)

digitalBob’s KB(H(m))-

encrypted msg digest

large digitalsignature(encrypt)

Bob s private

key K B-

large message

m digitalsignature

Bob’s public

key K +

+ KB(H(m))-

encrypted msg digest

H: Hashfunction

g(decrypt)key K B

KB(H(m))H(m) H(m)

equal

11.55

q?

Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 56: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Digital signature = Signed message digestg g g g g

● Suppose Alice receives message m, digital signature KB-(m)● Alice verifies m signed by Bob by applying Bob’s public key K to K (m)● Alice verifies m signed by Bob by applying Bob s public key KB+ to KB-(m)

then checks KB+(KB-(m) ) = m● If KB+(KB-(m) ) = m, whoever signed m must have used Bob’s private keyB+( B ( ) ) , g p y

● Alice thus verifies that● Bob signed m● No one else signed m● Bob signed m and not m’● Bob signed m and not m● Non-repudiation● Alice can take m, and signature KB-(m) to court and prove that Bob signed m

11.56Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 57: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Message IntegrityPublic-key CertificationMessage Integrity

11.57Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 58: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Public-key Certificationy

● Motivation: Trudy plays pizza prank on Bobp● Trudy creates e-mail order:

Dear Pizza Store, Please deliver to me four pepperoni pizzas Thankme four pepperoni pizzas. Thank you, Bob

● Trudy signs order with her private keykey

● Trudy sends order to Pizza Store● Trudy sends to Pizza Store her

public key, but says it’s Bob’s public key.

● Pizza Store verifies signature; then gdelivers four pizzas to Bob.

● Bob doesn’t even like Pepperoni

11.58Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 59: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Certification Authorities

● Certification authority (CA)●Binds public key to particular entity E●Binds public key to particular entity E

● E (person, router) registers its public key with CA● E provides “proof of identity” to CA● CA creates certificate binding E to its public key● Certificate containing E’s public key digitally signed by CA, CA says “this is E’s

public key”p y

di it lBob’s public

key K B+

digitalsignature(encrypt)

K B+

Bob’s identifying

i f i

CA private

key K CA- certificate for

Bob’s public key, signed by CA

11.59Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

information signed by CA

Page 60: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Certification Authorities

● When Alice wants Bob’s public key:●Gets Bob’s certificate (Bob or elsewhere)●Gets Bob s certificate (Bob or elsewhere)● Apply CA’s public key to Bob’s certificate, get Bob’s public key

Bob’s public+

digitalsignatureK B

+p

key K B+g

(decrypt)

CA +

B

publickey

K CA+

11.60Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 61: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Certificates: Summaryy

● Primary standard X.509 (RFC 2459)● Certificate contains:● Certificate contains:● Issuer name● Entity name, address, domain name, etc.● Entity’s public key●Digital signature (signed with issuer’s private key)

● Public-Key Infrastructure (PKI)● Public-Key Infrastructure (PKI)● Certificates and certification authorities●Often considered “heavy”

11.61Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 62: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Message IntegrityEnd-point AuthenticationMessage Integrity

11.62Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 63: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

End-point authenticationp

● Want to be sure of the originator of the message – end-point authentication.

● Assuming Alice and Bob have a shared secret, will MAC provide end-point authentication.

W d k th t Ali t d th●We do know that Alice created the message. ● But did she send it?

11.63Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 64: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Playback/reflection attacky

11.64Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 65: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Defending against playback attack: Nonceg g p y

“I am Alice”

MAC = f(msg s R)

R

MAC = f(msg,s,R)

MACTransfer $1M from Bill to Susan

11.65Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 66: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Securing e-mailSecuring e mail

11.66Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 67: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Secure e-mail

● What security features should a secure e-mail system provide?● Confidentiality● Confidentiality● Sender authentication● Receiver authentication●Message integrity

11.67Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 68: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Secure e-mail

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

K

KS( ). KS(m )m

KS

KS( ). mKS(m )

+

+ - KSInternet

KB( ).+KB(KS )+

KB+

KB( ).-

KB-

KS KB(KS )+

● Alice:●Generates random symmetric private key KS

B B

y p y S

● Encrypts message with KS (for efficiency)● Also encrypts KS with Bob’s public key.

S d b th K ( ) d K (K ) t B b

11.68

● Sends both KS(m) and KB(KS) to Bob.

Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 69: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Secure e-mail

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

KS(m )

KS

( )KS(m )

KS( ).+ -

S(m )m

KSInternet

KS( ). mS( )

KB( ).+KB(KS )+

KSInternet

KB( ).-KS KB(KS )+

KB+ KB

-

● Bob:●Uses his private key to decrypt and recover KS

11.69

●Uses KS to decrypt KS(m) to recover m

Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 70: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Secure e-mail

● Alice wants to provide sender authentication message integrity

-KA

- KA+

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

m KA( ).+KA(H(m))-

compare+ -Internet

m mH( ). H(m )

compare

m ( )

• Alice digitally signs message and• sends both message (in the clear) and digital signature

11.70Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 71: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Secure e-mail

● Alice wants to provide secrecy, sender authentication, message integrity.

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

KA-

KH( ). KA( ).+

A( ( ))m

KS( ).KS

m+

+ Internet

KB( ).+KB(KS )+

KB+

KS

● Alice uses three keys: her private key, Bob’s public key, newly created k

B

11.71

symmetric key

Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 72: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Securing TCP Connections: SSLSecuring TCP Connections: SSL

11.72Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 73: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Secure Sockets Layer (SSL)y ( )

● Widely deployed security protocol● Supported by almost all browsers

● Original goals:●Had Web e-commerce transactions● Supported by almost all browsers

and web servers● https

T f billi $ t

●Had Web e commerce transactions in mind

● Encryption (especially credit-card numbers)● Tens of billions $ spent per year

over SSL

● Originally designed by Netscape

numbers)●Web-server authentication●Optional client authentication

in 1993● Number of variations:● TLS: transport layer security RFC

●Minimum hassle in doing business with new merchant

● Available to all TCP applications● TLS: transport layer security, RFC 2246

● Provides

● Available to all TCP applications● Secure socket interface

● Confidentiality● Integrity● Authentication

11.73

● Authentication

Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 74: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

SSL and TCP/IP

• SSL provides application programming interface (API) to applications• C and Java SSL libraries/classes readily available

11.74Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 75: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Could do something like PGPg

- KA(H(m))-KA

-

KH( ). KA( ).-

+

KA(H(m))m

KS( ).KS

m

S

+ Internet

KB( ).+KB(KS )+

KB+

KS

KB

● But want to send byte streams & interactive data● Want a set of secret keys for the entire connection

11.75

● Want certificate exchange part of protocol: handshake phase

Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 76: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Toy SSL: A simple secure channely p

● SSL has three (four) phases1. Handshake1. Handshake2. Key Derivation3. Data Transfer● Connection termination

11.76Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 77: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Toy SSL: A simple secure channely p

1. Handshakea) Bob establishes a TCP connection with Alicea) Bob establishes a TCP connection with Aliceb) Bob verifies that Alice is really Alicec) Bob sends Alice a master secret key

11.77Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

MS = Master SecretEMS = Encrypted Master Secret

Page 78: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Toy SSL: A simple secure channely p

2. Key Derivation●Considered bad to use same key for more than one●Considered bad to use same key for more than one

cryptographic operation●Use different keys for message authentication code (MAC) and●Use different keys for message authentication code (MAC) and

encryption

●Four keys:●Kc = encryption key for data sent from client to server●Mc = MAC key for data sent from client to server●Ks = encryption key for data sent from server to client●Ms = MAC key for data sent from server to client

●Keys derived from key derivation function (KDF)●Keys derived from key derivation function (KDF)●Takes master secret and (possibly) some additional random data and

creates the keys

11.78

a y

Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 79: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Toy: Data Recordsy

● Why not encrypt data in constant stream as we write it to TCP?●Where would we put the MAC? If at end, no message integrity until all data●Where would we put the MAC? If at end, no message integrity until all data

processed.● For example, with instant messaging, how can we do integrity check over all

bytes sent before displaying?bytes sent before displaying?

● Instead, break TCP stream in series of records● Each record carries a MAC● Receiver can act on each record as it arrives

● Issue: in record, receiver needs to distinguish MAC from dataW t t i bl l th d●Want to use variable-length records

length data MAC

11.79Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 80: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Toy: Sequence Numbersy q

● Attacker can capture and replay record or re-order records● Solution: put sequence number into MAC:● Solution: put sequence number into MAC:●MAC = MAC(Mx + sequence + data)●Note: no sequence number field

● Attacker could still replay all of the records●Use random nonce

11.80Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 81: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Toy: Control informationy

● Truncation attack: ● Attacker forges TCP connection close segment● Attacker forges TCP connection close segment●One or both sides thinks there is less data than there actually is.

● Solution: record types, with one type for closure● Type 0 for data; type 1 for closure

● MAC = MAC(Mx + sequence + type + data)

length type data MAC

11.81Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 82: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Toy SSL: Summaryy y

ypte

den

cry

11.82Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 83: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Toy SSL isn’t completey p

● How long are the fields?● What encryption protocols?● What encryption protocols?● No negotiation● Allow client and server to support different encryption algorithms● Allow client and server to choose together specific algorithm before data transfer

● Most common symmetric ciphers in SSL● Most common symmetric ciphers in SSL●DES: Data Encryption Standard: block● 3DES: Triple strength: block● RC2: Rivest Cipher 2: block● RC4: Rivest Cipher 4: stream

● Public key encryption● RSA

11.83

RSA

Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 84: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

SSL Cipher Suitep

● Cipher Suite● Public-key algorithm● Public key algorithm● Symmetric encryption algorithm●MAC algorithm

● SSL supports a variety of cipher suites● Negotiation: client and server must agree on cipher suite● Client offers choice; server picks one● Client offers choice; server picks one

11.84Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 85: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Real SSL: Handshake

● Purpose● Server authentication● Server authentication●Negotiation: agree on crypto algorithms● Establish keys● Client authentication (optional)

● SSL Handshake1 Client sends list of algorithms it supports along with client nonce1. Client sends list of algorithms it supports, along with client nonce2. Server chooses algorithms from list; sends back: choice + certificate + server

nonce3 Cli ifi ifi ’ bli k3. Client verifies certificate, extracts server’s public key, generates

pre_master_secret, encrypts with server’s public key, sends to server4. Client and server independently compute encryption and MAC keys from

pre_master_secret and nonces5. Client sends a MAC of all the handshake messages6 Server sends a MAC of all the handshake messages

11.85

6. Server sends a MAC of all the handshake messages

Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 86: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Real SSL: Handshake

● Last 2 steps protect handshake from tampering● Client typically offers range of algorithms, some strong, some weak● Client typically offers range of algorithms, some strong, some weak●Man-in-the middle could delete the stronger algorithms from list● Last 2 steps prevent this● Last two messages are encrypted

● Why the two random nonces? ● Suppose Trudy sniffs all messages between Alice & Bob. ●Next day Trudy sets up TCP connection with Bob sends the exact same●Next day, Trudy sets up TCP connection with Bob, sends the exact same

sequence of records,.● Bob (Amazon) thinks Alice made two separate orders for the same thing.● Solution: Bob sends different random nonce for each connection. This causes encryption● Solution: Bob sends different random nonce for each connection. This causes encryption

keys to be different on the two days.● Trudy’s messages will fail Bob’s integrity check.

11.86Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 87: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

SSL Record Protocol

data

data fragment

data fragmentMAC MACfragment fragment

encrypted encryptedrecordrecord encrypteddata and MAC

encrypteddata and MAC

recordheader

recordheader

record header: content type; version; length MAC: includes sequence number, MAC key Mx

11.87

Fragment: each SSL fragment 214 bytes (~16 Kbytes)Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 88: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

SSL Record Format

type SSL v rsi n length

1 byte 2 bytes 3 bytes

type SSL version length

Data

MAC

D t d MAC t d ( t i l )

11.88

Data and MAC encrypted (symmetric algo)

Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 89: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Real Connection

Everythingh f hhenceforthis encrypted

11.89

TCP Fin followProf. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 90: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Key derivationy

● Client nonce, server nonce, and pre-master secret input into pseudo random-number generator.g● Produces master secret

● Master secret and new nonces inputed into another random-number t “k bl k”generator: “key block”

● Because of resumption: TBD

● Key block sliced and diced:Key block sliced and diced:● Client MAC key● Server MAC key● Client encryption key● Server encryption key● Client initialization vector (IV)● Client initialization vector (IV)● Server initialization vector (IV)

11.90Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 91: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Network Layer Security: IPsecNetwork Layer Security: IPsec

11.91Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 92: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

What is confidentiality at the network-layer?y y

● Between two network entities:

● Sending entity encrypts the payloads of datagrams. ● Payload could be:● TCP segment ● UDP datagram ● ICMP message C essage● OSPF message, etc.

● All data sent from one entity to the other would be hidden:W b il P2P fil f TCP SYN k d●Web pages, e-mail, P2P file transfers, TCP SYN packets, and so on.

● That is “blanket coverage”● That is, blanket coverage

11.92Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 93: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Virtual Private Networks (VPNs)( )

● Institutions often want private networks for security. ● Costly! Separate routers, links, DNS infrastructure.● Costly! Separate routers, links, DNS infrastructure.

● With a VPN, institution’s inter-office traffic is sent over public Internet instead. ● But inter-office traffic is encrypted before entering public Internet

11.93Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 94: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Virtual Private Network (VPN)( )

Laptop w IPsec

IPheader

IPsecheader

Securepayload

Salespersonin hotel

Router wIPv4 and IPsec

IPheader

IPsecheader

Securepayload

IPheader payload

IPv4 and IPsec

Public Internet

Branch officeRouter w

IPheader

IPsecheader

Securepayload

IPheader payload

Router wIPv4 and IPsec

Headquarters

11.94Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Headquarters

Page 95: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

IPsec services

● IPsec provides●Data integrity●Data integrity●Origin authentication● Replay attack prevention● Confidentiality

11.95Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 96: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

IPsec Transport Modep

● IPsec datagram emitted and received by end-system.● Protects upper level protocols● Protects upper level protocols

IPsecIPsec IPsec

11.96Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 97: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

IPsec Tunneling modeg

● End routers are IPsec aware. Hosts need not be.

IPsecIPsec

● Also tunneling mode.

IPsIPsec

11.97Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

IPsecIPsec

Page 98: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

IPsec: Service Models

● Two protocols providing different service models:● Authentication Header (AH)● Authentication Header (AH)● Encapsulation Security Payload (ESP)

● Authentication Header (AH) protocol● Provides source authentication ●Data integrity●Data integrity

● Encapsulation Security Protocol (ESP)● Provides source authentication●Data integrity

Confidentiality● Confidentiality

● ESP is more widely used than AH

11.98

y

Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 99: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

IPsec: Service Models

● Four combinations are possible!

Host mode Host mode Host mode with AH

Host mode with ESP

Tunnel mode Tunnel modewith AH with ESP

Most common andm st im t t

11.99Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

most important

Page 100: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Security associations (SAs) y ( )

● Before sending data, a virtual connection is established from sending entity to receiving entity. y g y

● Called “security association (SA)”● SAs are simplex: for only one direction

● Both entities maintain state information about the SA● Recall that TCP endpoints also maintain state information.● IP is connectionless but IPsec is connection-oriented!● IP is connectionless, but IPsec is connection oriented!

● How many SAs in VPN w headquarters, branch office, and n traveling salesperson?

11.100Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 101: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Example SA from R1 to R2p

InternetHeadquarters Branch Office

193.68.2.23200.168.1.100SA

172.16.1/24 172.16.2/24R1 R2

● R1 stores for SA● 32-bit identifier for SA: Security Parameter Index (SPI)● the origin interface of the SA (200.168.1.100)● destination interface of the SA (193.68.2.23)● type of encryption to be used (for example 3DES with CBC)● type of encryption to be used (for example, 3DES with CBC)● encryption key● type of integrity check (for example, HMAC with with MD5)

11.101

● authentication key

Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 102: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Security Association Database (SAD)y ( )

● Endpoint holds state of its SAs in a SAD, where it can locate them during processing.p g

● With n salespersons, 2 + 2n SAs in R1’s SAD

● When sending IPsec datagram, R1 accesses SAD to determine how to process datagram.

● When IPsec datagram arrives to R2, R2 examines SPI in IPsec datagram, indexes SAD with SPI and processes datagram accordinglyindexes SAD with SPI, and processes datagram accordingly.

11.102Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 103: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

IPsec datagramg

● Focus for now on tunnel mode with ESP

encrypted

“enchilada” authenticated

new IPheader

ESPhdr

originalIP hdr

Original IPdatagram payload

ESPtrl

ESPauth

padding padlength

nextheaderSPI Seq

# g#

11.103Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 104: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

What happens?pp

200 168 1 100

InternetHeadquarters Branch Office

193.68.2.23200.168.1.100

172.16.1/24 172.16.2/24

SA

R1 R2

encrypted

“enchilada” authenticated

new IPheader

ESPhdr

originalIP hdr

Original IPdatagram payload

ESPtrl

ESPauth

encrypted

padding padl th

nexth dSPI Seq

#

11.104

padding length headerSPI #

Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 105: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

R1 converts original datagraminto IPsec datagramg

● Appends to back of original datagram (which includes original header fields!) an “ESP trailer” field. )

● Encrypts result using algorithm & key specified by SA.● Appends to front of this encrypted quantity the “ESP header, creating

“ hil d ”“enchilada”. ● Creates authentication MAC over the whole enchilada, using algorithm and

key specified in SA;key specified in SA; ● Appends MAC to back of enchilada, forming payload;● Creates brand new IP header, with all the classic IPv4 header fields, which

it appends before payload.

11.105Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 106: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Inside the enchilada:

encrypted

“enchilada” authenticated

new IPheader

ESPhdr

originalIP hdr

Original IPdatagram payload

ESPtrl

ESPauth

encrypted

padding padlength

nextheaderSPI Seq

#

● ESP trailer: Padding for block ciphers

p g length header#

● ESP header: ● SPI, so receiving entity knows what to do● Sequence number to thwart replay attacks● Sequence number, to thwart replay attacks

● MAC in ESP auth field is created with shared secret key

11.106Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 107: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

IPsec sequence numbersq

● For new SA, sender initializes seq. # to 0● Each time datagram is sent on SA:● Each time datagram is sent on SA:● Sender increments seq # counter● Places value in seq # field

● Goal:● Prevent attacker from sniffing and replaying a packet● Receipt of duplicate authenticated IP packets may disrupt service● Receipt of duplicate, authenticated IP packets may disrupt service

● Method: ●Destination checks for duplicates● But doesn’t keep track of ALL received packets; instead uses a window

11.107Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 108: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Security Policy Database (SPD)y y ( )

● Policy: For a given datagram, sending entity needs to know if it should use IPsec.

● Needs also to know which SA to use●May use: source and destination IP address; protocol number.

● Info in SPD indicates “what” to do with arriving datagram; ● Info in the SAD indicates “how” to do it.

11.108Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 109: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Summary: IPsec servicesy

● Suppose Trudy sits somewhere between R1 and R2. She doesn’t know the keys. y●Will Trudy be able to see contents of original datagram? How about source, dest

IP address, transport protocol, application port?● Flip bits without detection?● Flip bits without detection?●Masquerade as R1 using R1’s IP address?● Replay a datagram?

11.109Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 110: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Internet Key Exchange y g

● In previous examples, we manually established IPsec SAs in IPsec endpoints:p

● Example SA● SPI: 12345● Source IP: 200.168.1.100●Dest IP: 193.68.2.23 ● Protocol: ESP● Protocol: ESP● Encryption algorithm: 3DES-cbc●HMAC algorithm: MD5● Encryption key: 0x7aeaca…●HMAC key:0xc0291f…

● Such manually keying is impractical for large VPN with say hundreds of● Such manually keying is impractical for large VPN with, say, hundreds of sales people.

● Instead use IPsec IKE (Internet Key Exchange)

11.110Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 111: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

IKE: PSK and PKI

● Authentication (proof who you are) with either● pre-shared secret (PSK) or● pre shared secret (PSK) or ●with PKI (pubic/private keys and certificates).

● With PSK, both sides start with secret:● then run IKE to authenticate each other and to generate IPsec SAs (one in each

direction), including encryption and authentication keys

● With PKI, both sides start with public/private key pair and certificate.With PKI, both sides start with public/private key pair and certificate.● run IKE to authenticate each other and obtain IPsec SAs (one in each direction).● Similar with handshake in SSL.

11.111Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 112: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

IKE Phases

● IKE has two phases● Phase 1: Establish bi-directional IKE SA● Phase 1: Establish bi directional IKE SA● Note: IKE SA different from IPsec SA● Also called ISAKMP security association

Ph 2 ISAKMP i d t l ti t th IP i f SA● Phase 2: ISAKMP is used to securely negotiate the IPsec pair of SAs

● Phase 1 has two modes: aggressive mode and main mode● Aggressive mode uses fewer messagesgg g●Main mode provides identity protection and is more flexible

11.112Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 113: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Summary of IPsecy

● IKE message exchange for algorithms, secret keys, SPI numbers● Either the AH or the ESP protocol (or both)● Either the AH or the ESP protocol (or both)● The AH protocol provides integrity and source authentication● The ESP protocol (with AH) additionally provides encryption● IPsec peers can be two end systems, two routers/firewalls, or a

router/firewall and an end system

11.113Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security

Page 114: 11 Network Security - mi.fu-berlin.de · Telematics Chapter 11: Network Security Beispielbild py User watching video clip Server with video clips Prof. Dr. Mesut Güneş Computer

Summaryy

● Basic techniques…...● cryptography (symmetric and public)● cryptography (symmetric and public)●message integrity● end-point authentication

● …. used in many different security scenarios● secure email● secure transport (SSL)● secure transport (SSL)● IP sec● 802.11

● Operational Security: firewalls and IDS

11.114Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 11: Network Security