Скачать презентацию Chapter 8 Network Security A note on the Скачать презентацию Chapter 8 Network Security A note on the

28c0632c6a29f62a546e29c77cc259dd.ppt

  • Количество слайдов: 136

Chapter 8 Network Security A note on the use of these ppt slides: We’re Chapter 8 Network Security A note on the use of these ppt slides: We’re making these slides freely available to all (faculty, students, readers). They’re in Power. Point form so you can add, modify, and delete slides (including this one) and slide content to suit your needs. They obviously represent a lot of work on our part. In return for use, we only ask the following: v If you use these slides (e. g. , in a class) in substantially unaltered form, that you mention their source (after all, we’d like people to use our book!) v If you post any slides in substantially unaltered form on a www site, that you note that they are adapted from (or perhaps identical to) our slides, and note our copyright of this material. Computer Networking: A Top Down Approach , 5 th edition. Jim Kurose, Keith Ross Addison-Wesley, April 2009. Thanks and enjoy! JFK/KWR All material copyright 1996 -2010 J. F Kurose and K. W. Ross, All Rights Reserved Network Security 8 -1

Chapter 8: Network Security Chapter goals: v understand principles of network security: § cryptography Chapter 8: Network Security Chapter goals: v understand principles of network security: § cryptography and its many uses beyond “confidentiality” § authentication § message integrity v security in practice: § firewalls and intrusion detection systems § security in application, transport, network, link layers Network Security 8 -2

Chapter 8 roadmap 8. 1 What is network security? 8. 2 Principles of cryptography Chapter 8 roadmap 8. 1 What is network security? 8. 2 Principles of cryptography 8. 3 Message integrity 8. 4 Securing e-mail 8. 5 Securing TCP connections: SSL 8. 6 Network layer security: IPsec 8. 7 Securing wireless LANs 8. 8 Operational security: firewalls and IDS Network Security 8 -3

What is network security? Confidentiality: only sender, intended receiver should “understand” message contents m What is network security? Confidentiality: only sender, intended receiver should “understand” message contents m sender encrypts message m receiver decrypts message Authentication: sender, receiver want to confirm identity of each other Message integrity: sender, receiver want to ensure message not altered (in transit, or afterwards) without detection Access and availability: services must be accessible and available to users Network Security 8 -4

Friends and enemies: Alice, Bob, Trudy v v v well-known in network security world Friends and enemies: Alice, Bob, Trudy v v v well-known in network security world Bob, Alice (lovers!) want to communicate “securely” Trudy (intruder) may intercept, delete, add messages Alice channel data secure sender Bob data, control messages secure receiver data Trudy Network Security 8 -5

Who might Bob, Alice be? r … well, real-life Bobs and Alices! r Web Who might Bob, Alice be? r … well, real-life Bobs and Alices! r Web browser/server for electronic transactions (e. g. , on-line purchases) r on-line banking client/server r DNS servers r routers exchanging routing table updates r other examples? Network Security 8 -6

There are bad guys (and girls) out there! Q: What can a “bad guy” There are bad guys (and girls) out there! Q: What can a “bad guy” do? A: A lot! See section 1. 6 m eavesdrop: intercept messages m actively insert messages into connection m impersonation: can fake (spoof) source address in packet (or any field in packet) m hijacking: “take over” ongoing connection by removing sender or receiver, inserting himself in place m denial of service: prevent service from being used by others (e. g. , by overloading resources) Network Security 8 -7

Chapter 8 roadmap 8. 1 What is network security? 8. 2 Principles of cryptography Chapter 8 roadmap 8. 1 What is network security? 8. 2 Principles of cryptography 8. 3 Message integrity 8. 4 Securing e-mail 8. 5 Securing TCP connections: SSL 8. 6 Network layer security: IPsec 8. 7 Securing wireless LANs 8. 8 Operational security: firewalls and IDS Network Security 8 -8

The language of cryptography Alice’s K encryption A key plaintext encryption algorithm Bob’s K The language of cryptography Alice’s K encryption A key plaintext encryption algorithm Bob’s K decryption B key ciphertext decryption plaintext algorithm m plaintext message KA(m) ciphertext, encrypted with key KA m = KB(KA(m)) Network Security 8 -9

Simple encryption scheme substitution cipher: substituting one thing for another m monoalphabetic cipher: substitute Simple encryption scheme substitution cipher: substituting one thing for another m monoalphabetic cipher: substitute one letter for another plaintext: abcdefghijklmnopqrstuvwxyz ciphertext: mnbvcxzasdfghjklpoiuytrewq E. g. : Plaintext: bob. i love you. alice ciphertext: nkn. s gktc wky. mgsbc Key: the mapping from the set of 26 letters to the set of 26 letters Network Security 8 -10

Polyalphabetic encryption r n monoalphabetic ciphers, M 1, M 2, …, Mn r Cycling Polyalphabetic encryption r n monoalphabetic ciphers, M 1, M 2, …, Mn r Cycling pattern: m e. g. , n=4, M 1, M 3, M 4, M 3, M 2; r For each new plaintext symbol, use subsequent monoalphabetic pattern in cyclic pattern m dog: d from M 1, o from M 3, g from M 4 r Key: the n ciphers and the cyclic pattern Network Security 8 -11

Breaking an encryption scheme v v Cipher-text only attack: Trudy has ciphertext that she Breaking an encryption scheme v v Cipher-text only attack: Trudy has ciphertext that she can analyze Two approaches: § Search through all keys: must be able to differentiate resulting plaintext from gibberish § Statistical analysis v Known-plaintext attack: Trudy has some plaintext corresponding to some ciphertext § e. g. , in monoalphabetic cipher, Trudy determines pairings for a, l, i, c, e, b, o, v Chosen-plaintext attack: Trudy can get the ciphertext for some chosen plaintext Network Security 8 -12

Types of Cryptography r Crypto often uses keys: m Algorithm is known to everyone Types of Cryptography r Crypto often uses keys: m Algorithm is known to everyone m Only “keys” are secret r Public key cryptography m Involves the use of two keys r Symmetric key cryptography m Involves the use one key r Hash functions m Involves the use of no keys m Nothing secret: How can this be useful? Network Security 8 -13

Symmetric key cryptography KS KS plaintext message, m encryption ciphertext algorithm K (m) S Symmetric key cryptography KS KS plaintext message, m encryption ciphertext algorithm K (m) S decryption plaintext algorithm m = KS(KS(m)) symmetric key crypto: Bob and Alice share same (symmetric) key: K S r e. g. , key is knowing substitution pattern in mono alphabetic substitution cipher Q: how do Bob and Alice agree on key value? Network Security 8 -14

Two types of symmetric ciphers r Stream ciphers m encrypt one bit at time Two types of symmetric ciphers r Stream ciphers m encrypt one bit at time r Block ciphers m Break plaintext message in equal-size blocks m Encrypt each block as a unit Network Security 8 -15

Stream Ciphers pseudo random keystream generator keystream r Combine each bit of keystream with Stream Ciphers pseudo random keystream generator keystream r Combine each bit of keystream with bit of r r r plaintext to get bit of ciphertext m(i) = ith bit of message ks(i) = ith bit of keystream c(i) = ith bit of ciphertext c(i) = ks(i) m(i) ( = exclusive or) m(i) = ks(i) c(i) Network Security 8 -16

RC 4 Stream Cipher r RC 4 is a popular stream cipher m Extensively RC 4 Stream Cipher r RC 4 is a popular stream cipher m Extensively analyzed and considered good m Key can be from 1 to 256 bytes m Used in WEP for 802. 11 m Can be used in SSL Network Security 8 -17

Block ciphers r Message to be encrypted is processed in blocks of k bits Block ciphers r Message to be encrypted is processed in blocks of k bits (e. g. , 64 -bit blocks). r 1 -to-1 mapping is used to map k-bit block of plaintext to k-bit block of ciphertext Example with k=3: input output 000 110 001 111 010 101 011 100 input output 100 011 101 010 110 000 111 001 What is the ciphertext for 010110001111 ? Network Security 8 -18

Block ciphers r How many possible mappings are there for k=3? m How many Block ciphers r How many possible mappings are there for k=3? m How many 3 -bit inputs? m How many permutations of the 3 -bit inputs? m Answer: 40, 320 ; not very many! r In general, 2 k! mappings; huge for k=64 r Problem: m Table approach requires table with 264 entries, each entry with 64 bits r Table too big: instead use function that simulates a randomly permuted table Network Security 8 -19

From Kaufman et al Prototype function 64 -bit input 8 bits 8 bits S From Kaufman et al Prototype function 64 -bit input 8 bits 8 bits S 1 S 2 S 3 S 4 S 5 S 6 S 7 S 8 8 bits 8 bits 64 -bit intermediate Loop for n rounds 8 -bit to 8 -bit mapping 64 -bit output Network Security 8 -20

Why rounds in prototype? r If only a single round, then one bit of Why rounds in prototype? r If only a single round, then one bit of input affects at most 8 bits of output. r In 2 nd round, the 8 affected bits get scattered and inputted into multiple substitution boxes. r How many rounds? m How many times do you need to shuffle cards m Becomes less efficient as n increases Network Security 8 -21

Encrypting a large message r Why not just break message in 64 -bit blocks, Encrypting a large message r Why not just break message in 64 -bit blocks, encrypt each block separately? m If same block of plaintext appears twice, will give same ciphertext. r How about: m Generate random 64 -bit number r(i) for each plaintext block m(i) m Calculate c(i) = KS( m(i) r(i) ) m Transmit c(i), r(i), i=1, 2, … m At receiver: m(i) = KS(c(i)) r(i) m Problem: inefficient, need to send c(i) and r(i) Network Security 8 -22

Cipher Block Chaining (CBC) r CBC generates its own random numbers m Have encryption Cipher Block Chaining (CBC) r CBC generates its own random numbers m Have encryption of current block depend on result of previous block m c(i) = KS( m(i) c(i-1) ) m m(i) = KS( c(i)) c(i-1) r How do we encrypt first block? m Initialization vector (IV): random block = c(0) m IV does not have to be secret r Change IV for each message (or session) m Guarantees that even if the same message is sent repeatedly, the ciphertext will be completely different each time Network Security 8 -23

Cipher Block Chaining r cipher block: if input block repeated, will produce same cipher Cipher Block Chaining r cipher block: if input block repeated, will produce same cipher text: v cipher block chaining: XOR ith input block, m(i), with previous block of cipher text, c(i-1) § c(0) transmitted to receiver in clear § what happens in “HTTP/1. 1” scenario from above? t=1 … t=17 m(1) = “HTTP/1. 1” block cipher c(1) m(17) = “HTTP/1. 1” block cipher c(17) = “k 329 a. M 02” m(i) c(i-1) + block cipher c(i) Network Security 8 -24

Symmetric key crypto: DES: Data Encryption Standard r US encryption standard [NIST 1993] r Symmetric key crypto: DES: Data Encryption Standard r US encryption standard [NIST 1993] r 56 -bit symmetric key, 64 -bit plaintext input r Block cipher with cipher block chaining r How secure is DES? m DES Challenge: 56 -bit-key-encrypted phrase decrypted (brute force) in less than a day m No known good analytic attack r making DES more secure: m 3 DES: encrypt 3 times with 3 different keys (actually encrypt, decrypt, encrypt) Network Security 8 -25

Symmetric key crypto: DES operation initial permutation 16 identical “rounds” of function application, each Symmetric key crypto: DES operation initial permutation 16 identical “rounds” of function application, each using different 48 bits of key final permutation Network Security 8 -26

AES: Advanced Encryption Standard r new (Nov. 2001) symmetric-key NIST standard, replacing DES r AES: Advanced Encryption Standard r new (Nov. 2001) symmetric-key NIST standard, replacing DES r processes data in 128 bit blocks r 128, 192, or 256 bit keys r brute force decryption (try each key) taking 1 sec on DES, takes 149 trillion years for AES Network Security 8 -27

Public Key Cryptography symmetric key crypto v requires sender, receiver know shared secret key Public Key Cryptography symmetric key crypto v requires sender, receiver know shared secret key v Q: how to agree on key in first place (particularly if never “met”)? public key cryptography v radically different approach [Diffie. Hellman 76, RSA 78] v sender, receiver do not share secret key v public encryption key known to all v private decryption key known only to receiver Network Security 8 -28

Public key cryptography + Bob’s public B key K K plaintext message, m encryption Public key cryptography + Bob’s public B key K K plaintext message, m encryption ciphertext algorithm + K (m) B - Bob’s private B key decryption plaintext algorithm message + m = K B(K (m)) B Network Security 8 -29

Public key encryption algorithms Requirements: 1 . . + need K B( ) and Public key encryption algorithms Requirements: 1 . . + need K B( ) and K - ( ) such that B - + K (K (m)) = m B B 2 given public key K + , it should be B impossible to compute private key K B RSA: Rivest, Shamir, Adelson algorithm Network Security 8 -30

Prerequisite: modular arithmetic r x mod n = remainder of x when divide by Prerequisite: modular arithmetic r x mod n = remainder of x when divide by n r 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 r Thus (a mod n)d mod n = ad mod n r Example: x=14, n=10, d=2: (x mod n)d mod n = 42 mod 10 = 6 xd = 142 = 196 xd mod 10 = 6 Network Security 8 -31

RSA: getting ready r A message is a bit pattern. r A bit pattern RSA: getting ready r A message is a bit pattern. r A bit pattern can be uniquely represented by an integer number. r Thus encrypting a message is equivalent to encrypting a number. Example r m= 10010001. This message is uniquely represented by the decimal number 145. r To encrypt m, we encrypt the corresponding number, which gives a new number (the ciphertext). Network Security 8 -32

RSA: Creating public/private key pair 1. Choose two large prime numbers p, q. (e. RSA: Creating public/private key pair 1. Choose two large prime numbers p, q. (e. g. , 1024 bits each) 2. Compute n = pq, z = (p-1)(q-1) 3. Choose e (with e

RSA: Encryption, decryption 0. Given (n, e) and (n, d) as computed above 1. RSA: Encryption, decryption 0. Given (n, e) and (n, d) as computed above 1. To encrypt message m (

RSA example: Bob chooses p=5, q=7. Then n=35, z=24. e=5 (so e, z relatively RSA example: Bob chooses p=5, q=7. Then n=35, z=24. e=5 (so e, z relatively prime). d=29 (so ed-1 exactly divisible by z). Encrypting 8 -bit messages. encrypt: decrypt: bit pattern m me 0000 l 000 12 24832 c 17 d c 48196857210675091411825223071697 c = me mod n 17 m = cd mod n 12 Network Security 8 -35

Why does RSA work? r Must show that cd mod n = m where Why does RSA work? r Must show that cd mod n = m where c = me mod n r Fact: for any x and y: xy mod n = x(y mod z) mod n m where n= pq and z = (p-1)(q-1) r Thus, cd mod n = (me mod n)d mod n = med mod n = m(ed mod z) mod n = m 1 mod n =m Network Security 8 -36

RSA: another important property The following property will be very useful later: - + RSA: another important property The following property will be very useful later: - + B B K (K (m)) + = m = K (K (m)) B B use public key first, followed by private key use private key first, followed by public key Result is the same! Network Security 8 -37

Why - + B B K (K (m)) + = m = K (K Why - + B B K (K (m)) + = m = K (K (m)) B B ? Follows directly from modular arithmetic: (me mod n)d mod n = med mod n = mde mod n = (md mod n)e mod n Network Security 8 -38

Why is RSA Secure? r suppose you know Bob’s public key (n, e). How Why is RSA Secure? r suppose you know Bob’s public key (n, e). How hard is it to determine d? r essentially need to find factors of n without knowing the two factors p and q. r fact: factoring a big number is hard. Generating RSA keys have to find big primes p and q v approach: make good guess then apply testing rules (see Kaufman) v Network Security 8 -39

Session keys r Exponentiation is computationally intensive r DES is at least 100 times Session keys r Exponentiation is computationally intensive r DES is at least 100 times faster than RSA Session key, KS r Bob and Alice use RSA to exchange a symmetric key KS r Once both have KS, they use symmetric key cryptography Network Security 8 -40

Chapter 8 roadmap 8. 1 What is network security? 8. 2 Principles of cryptography Chapter 8 roadmap 8. 1 What is network security? 8. 2 Principles of cryptography 8. 3 Message integrity 8. 4 Securing e-mail 8. 5 Securing TCP connections: SSL 8. 6 Network layer security: IPsec 8. 7 Securing wireless LANs 8. 8 Operational security: firewalls and IDS Network Security 8 -41

Message Integrity r allows communicating parties to verify that received messages are authentic. m Message Integrity r allows communicating parties to verify that received messages are authentic. m Content of message has not been altered m Source of message is who/what you think it is m Message has not been replayed m Sequence of messages is maintained r let’s first talk about message digests Network Security 8 -42

Message Digests v v v function H( ) that takes as input an arbitrary Message Digests v v v function H( ) that takes as input an arbitrary length message and outputs a fixed-length string: “message signature” note that H( ) is a many-to-1 function H( ) is often called a “hash function” large message m H: Hash Function H(m) desirable properties: § easy to calculate § irreversibility: Can’t determine m from H(m) § collision resistance: computationally difficult to produce m and m’ such that H(m) = H(m’) § seemingly random output Network Security 8 -43

Internet checksum: poor message digest Internet checksum has some properties of hash function: ü Internet checksum: poor message digest Internet checksum has some properties of hash function: ü produces fixed length digest (16 -bit sum) of input ü is many-to-one v but given message with given hash value, it is easy to find another message with same hash value. § e. g. , : simplified checksum: add 4 -byte chunks at a time: message I O U 1 0 0. 9 9 B O B ASCII format 49 4 F 55 31 30 30 2 E 39 39 42 D 2 42 B 2 C 1 D 2 AC message I O U 9 0 0. 1 9 B O B ASCII format 49 4 F 55 39 30 30 2 E 31 39 42 D 2 42 B 2 C 1 D 2 AC different messages but identical checksums! Network Security 8 -44

Hash Function Algorithms v v MD 5 hash function widely used (RFC 1321) § Hash Function Algorithms v v MD 5 hash function widely used (RFC 1321) § 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 Network Security 8 -45

Message Authentication Code (MAC) s = shared secret message s H( ) compare r Message Authentication Code (MAC) s = shared secret message s H( ) compare r Authenticates sender r Verifies message integrity r No encryption ! r Also called “keyed hash” r Notation: MDm = H(s||m) ; send m||MDm Network Security 8 -46

HMAC r popular MAC standard r addresses some subtle security flaws r operation: m HMAC r popular MAC standard r addresses some subtle security flaws r operation: m concatenates secret to front of message. m hashes concatenated message m concatenates secret to front of digest m hashes combination again Network Security 8 -47

Example: OSPF v v v Recall that OSPF is an intra-AS routing protocol Each Example: OSPF v v v Recall that OSPF is an intra-AS routing protocol Each router creates map of entire AS (or area) and runs shortest path algorithm over map. Router receives linkstate advertisements (LSAs) from all other routers in AS. Attacks: v Message insertion v Message deletion v Message modification v How do we know if an OSPF message is authentic? Network Security 8 -48

OSPF Authentication v v within an Autonomous System, routers send OSPF messages to each OSPF Authentication v v within an Autonomous System, routers send OSPF messages to each other. OSPF provides authentication choices § no authentication § shared password: inserted in clear in 64 bit authentication field in OSPF packet § cryptographic hash v cryptographic hash with MD 5 § 64 -bit authentication field includes 32 -bit sequence number § MD 5 is run over a concatenation of the OSPF packet and shared secret key § MD 5 hash then appended to OSPF packet; encapsulated in IP datagram Network Security 8 -49

End-point authentication r want to be sure of the originator of the message – End-point authentication r want to be sure of the originator of the message – end-point authentication r assuming Alice and Bob have a shared secret, will MAC provide end-point authentication? m we do know that Alice created message. m … but did she send it? Network Security 8 -50

Playback attack MAC = f(msg, s) Transfer $1 M from Bill to Trudy MAC Playback attack MAC = f(msg, s) Transfer $1 M from Bill to Trudy MAC Transfer $1 M from MAC Bill to Trudy Network Security 8 -51

Defending against playback attack: nonce “I am Alice” R MAC = f(msg, s, R) Defending against playback attack: nonce “I am Alice” R MAC = f(msg, s, R) Transfer $1 M from Bill to Susan MAC Network Security 8 -52

Digital Signatures cryptographic technique analogous to handwritten signatures. v v v sender (Bob) digitally Digital Signatures cryptographic technique analogous to handwritten signatures. v v v sender (Bob) digitally signs document, establishing he is document owner/creator. goal is similar to that of MAC, except now use public-key cryptography verifiable, nonforgeable: recipient (Alice) can prove to someone that Bob, and no one else (including Alice), must have signed document Network Security 8 -53

Digital Signatures simple digital signature for message m: v Bob signs m by encrypting Digital Signatures simple digital signature for message m: v Bob signs m by encrypting with his private key KB, creating “signed” message, KB(m) Bob’s message, m Dear Alice Oh, how I have missed you. I think of you all the time! …(blah) Bob K B Bob’s private key Public key encryption algorithm K B(m) Bob’s message, m, signed (encrypted) with his private key Network Security 8 -54

Digital signature = signed message digest Alice verifies signature and integrity of digitally signed Digital signature = signed message digest Alice verifies signature and integrity of digitally signed message: Bob sends digitally signed message: large message m H: Hash function Bob’s private key + - KB encrypted msg digest H(m) digital signature (encrypt) encrypted msg digest KB(H(m)) large message m H: Hash function KB(H(m)) Bob’s public key + KB digital signature (decrypt) H(m) equal ? Network Security 8 -55

Digital Signatures (more) v v v - suppose Alice receives msg m, digital signature Digital Signatures (more) v v v - suppose Alice receives msg m, digital signature K B(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 key. Alice thus verifies that: ü Bob signed m. ü no one else signed 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. Network Security 8 -56

Public-key certification r motivation: Trudy plays pizza prank on Bob m Trudy creates e-mail Public-key certification r motivation: Trudy plays pizza prank on Bob m Trudy creates e-mail order: Dear Pizza Store, Please deliver to me four pepperoni pizzas. Thank you, Bob m Trudy signs order with her private key m Trudy sends order to Pizza Store m Trudy sends to Pizza Store her public key, but says it’s Bob’s public key. m Pizza Store verifies signature; then delivers four pizzas to Bob. m Bob doesn’t even like Pepperoni Network Security 8 -57

Certification Authorities v v Certification authority (CA): binds public key to particular entity, E. Certification Authorities v v Certification authority (CA): 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” Bob’s public key Bob’s identifying information + KB digital signature (encrypt) CA private key K- CA + KB certificate for Bob’s public key, signed by CA Network Security 8 -58

Certification Authorities v when Alice wants Bob’s public key: § gets Bob’s certificate (Bob Certification Authorities v 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 + KB digital signature (decrypt) CA public key Bob’s public + key KB + K CA Network Security 8 -59

Certificates: summary r primary standard X. 509 (RFC 2459) r certificate contains: m issuer Certificates: summary r primary standard X. 509 (RFC 2459) r certificate contains: m issuer name m entity name, address, domain name, etc. m entity’s public key m digital signature (signed with issuer’s private key) r Public-Key Infrastructure (PKI) m certificates, certification authorities m often considered “heavy” Network Security 8 -60

Chapter 8 roadmap 8. 1 What is network security? 8. 2 Principles of cryptography Chapter 8 roadmap 8. 1 What is network security? 8. 2 Principles of cryptography 8. 3 Message integrity 8. 4 Securing e-mail 8. 5 Securing TCP connections: SSL 8. 6 Network layer security: IPsec 8. 7 Securing wireless LANs 8. 8 Operational security: firewalls and IDS Network Security 8 -61

Secure e-mail v Alice wants to send confidential e-mail, m, to Bob. KS m Secure e-mail v Alice wants to send confidential e-mail, m, to Bob. KS m KS K (. ) S + . KB ( ) K+ B KS(m ) + + KB(KS ) Internet . KS( ) - KS + m KB ( ) KB(KS ) - . KB Alice: v generates random symmetric private key, KS v encrypts message with KS (for efficiency) v also encrypts KS with Bob’s public key v sends both KS(m) and KB(KS) to Bob Network Security 8 -62

Secure e-mail v Alice wants to send confidential e-mail, m, to Bob. KS m Secure e-mail v Alice wants to send confidential e-mail, m, to Bob. KS m KS K (. ) S + . KB ( ) K+ B KS(m ) + + KB(KS ) Internet . KS( ) - KS + m KB ( ) KB(KS ) - . KB Bob: v uses his private key to decrypt and recover K S v uses KS to decrypt KS(m) to recover m Network Security 8 -63

Secure e-mail (continued) v Alice wants to provide sender authentication message integrity . m Secure e-mail (continued) v Alice wants to provide sender authentication message integrity . m H( ) KA - . + m v v - - KA(H(m)) KA( ) + KA Internet - + . KA( ) H(m ) compare m . H( ) H(m ) Alice digitally signs message sends both message (in the clear) and digital signature Network Security 8 -64

Secure e-mail (continued) v Alice wants to provide secrecy, sender authentication, message integrity. KA Secure e-mail (continued) v Alice wants to provide secrecy, sender authentication, message integrity. KA KA(H(m)) KS m KA( ) H( ) . . + . KS( ) m KS + . KB ( ) K+ B + Internet + KB(KS ) Alice uses three keys: her private key, Bob’s public key, newly created symmetric key Network Security 8 -65

Chapter 8 roadmap 8. 1 What is network security? 8. 2 Principles of cryptography Chapter 8 roadmap 8. 1 What is network security? 8. 2 Principles of cryptography 8. 3 Message integrity 8. 4 Securing e-mail 8. 5 Securing TCP connections: SSL 8. 6 Network layer security: IPsec 8. 7 Securing wireless LANs 8. 8 Operational security: firewalls and IDS Network Security 8 -66

SSL: Secure Sockets Layer v widely deployed security protocol § supported by almost all SSL: Secure Sockets Layer v widely deployed security protocol § supported by almost all browsers, web servers § https § billions $/year over SSL v original design: § Netscape, 1993 v variation -TLS: transport layer security, RFC 2246 v provides v original goals: § Web e-commerce transactions § encryption (especially credit -card numbers) § Web-server authentication § optional client authentication § minimum hassle in doing business with new merchant v available to all TCP applications § secure socket interface § confidentiality § integrity § authentication Network Security 8 -67

SSL and TCP/IP Application TCP Application SSL TCP IP IP Normal Application with SSL SSL and TCP/IP Application TCP Application SSL TCP IP IP Normal Application with SSL • SSL provides application programming interface (API) to applications • C and Java SSL libraries/classes readily available Network Security 8 -68

Could do something like PGP: m . H( ) KA - . K A( Could do something like PGP: m . H( ) KA - . K A( ) - KA(H(m)) + . K S( ) m KS KS + . K B( ) K+ B + Internet + KB(KS ) v but want to send byte streams & interactive data v want set of secret keys for entire connection v want certificate exchange as part of protocol: handshake phase Network Security 8 -69

Toy SSL: a simple secure channel r handshake: Alice and Bob use their certificates, Toy SSL: a simple secure channel r handshake: Alice and Bob use their certificates, private keys to authenticate each other and exchange shared secret r key derivation: Alice and Bob use shared secret to derive set of keys r data transfer: data to be transferred is broken up into series of records r connection closure: special messages to securely close connection Network Security 8 -70

Toy: A simple handshake hello certificate KB +(MS) = EMS r MS = master Toy: A simple handshake hello certificate KB +(MS) = EMS r MS = master secret r EMS = encrypted master secret Network Security 8 -71

Toy: Key derivation r Considered bad to use same key for more than one Toy: Key derivation r Considered bad to use same key for more than one cryptographic operation m use different keys for message authentication code (MAC) and encryption r four keys: m Kc = encryption key for data sent from client to server m Mc = MAC key for data sent from client to server m Ks = encryption key for data sent from server to client m Ms = MAC key for data sent from server to client r keys derived from key derivation function (KDF) m takes master secret and (possibly) some additional random data and creates the keys Network Security 8 -72

Toy: Data Records r why not encrypt data in constant stream as we write Toy: Data Records r why not encrypt data in constant stream as we write it to TCP? m m where would we put the MAC? If at end, no message integrity until all data processed. E. g. , with instant messaging, how can we do integrity check over all bytes sent before displaying? r instead, break stream in series of records m Each record carries a MAC m Receiver can act on each record as it arrives r issue: in record, receiver needs to distinguish MAC from data m want to use variable-length records length data MAC Network Security 8 -73

Toy: Sequence Numbers r attacker can capture and replay record or re-order records r Toy: Sequence Numbers r attacker can capture and replay record or re-order records r solution: put sequence number into MAC: m MAC = MAC(Mx, sequence||data) m Note: no sequence number field r attacker could still replay all of the records m use random nonce Network Security 8 -74

Toy: Control information r truncation attack: m attacker forges TCP connection close segment m Toy: Control information r truncation attack: m attacker forges TCP connection close segment m One or both sides thinks there is less data than there actually is. r solution: record types, with one type for closure m type 0 for data; type 1 for closure r MAC = MAC(Mx, sequence||type||data) length type data MAC Network Security 8 -75

Toy SSL: summary hello ce certificate, non KB +(MS) = EMS type 0, seq Toy SSL: summary hello ce certificate, non KB +(MS) = EMS type 0, seq 1, data encrypted type 0, seq 2, data bob. com ta , seq 1, da type 0, seq 3, data type 1, seq 4, close type 1, seq 2 Network Security 8 -76

Toy SSL isn’t complete r how long are fields? r which encryption protocols? r Toy SSL isn’t complete r how long are fields? r which encryption protocols? r want negotiation? m allow client and server to support different encryption algorithms m allow client and server to choose together specific algorithm before data transfer Network Security 8 -77

SSL Cipher Suite r cipher suite m m m public-key algorithm symmetric encryption algorithm SSL Cipher Suite r cipher suite m m m public-key algorithm symmetric encryption algorithm MAC algorithm r SSL supports several cipher suites r negotiation: client, server agree on cipher suite Common SSL symmetric ciphers m DES – Data Encryption Standard: block m 3 DES – Triple strength: block m RC 2 – Rivest Cipher 2: block m RC 4 – Rivest Cipher 4: stream SSL Public key encryption m RSA m client offers choice m server picks one Network Security 8 -78

Real SSL: Handshake (1) Purpose 1. server authentication 2. negotiation: agree on crypto algorithms Real SSL: Handshake (1) Purpose 1. server authentication 2. negotiation: agree on crypto algorithms 3. establish keys 4. client authentication (optional) Network Security 8 -79

Real SSL: Handshake (2) 1. 2. 3. 4. 5. 6. client sends list of Real SSL: Handshake (2) 1. 2. 3. 4. 5. 6. client sends list of algorithms it supports, along with client nonce server chooses algorithms from list; sends back: choice + certificate + server nonce client verifies certificate, extracts server’s public key, generates pre_master_secret, encrypts with server’s public key, sends to server client and server independently compute encryption and MAC keys from pre_master_secret and nonces client sends a MAC of all the handshake messages server sends a MAC of all the handshake messages Network Security 8 -80

Real SSL: Handshaking (3) last 2 steps protect handshake from tampering r client typically Real SSL: Handshaking (3) last 2 steps protect handshake from tampering r client typically offers range of algorithms, some strong, some weak r man-in-the middle could delete stronger algorithms from list r last 2 steps prevent this m Last two messages are encrypted Network Security 8 -81

Real SSL: Handshaking (4) r why two random nonces? r suppose Trudy sniffs all Real SSL: Handshaking (4) r why two random nonces? r suppose Trudy sniffs all messages between Alice & Bob r next day, Trudy sets up TCP connection with Bob, sends exact same sequence of records m Bob (Amazon) thinks Alice made two separate orders for the same thing m solution: Bob sends different random nonce for each connection. This causes encryption keys to be different on the two days m Trudy’s messages will fail Bob’s integrity check Network Security 8 -82

SSL Record Protocol data fragment record header data fragment MAC encrypted data and MAC SSL Record Protocol data fragment record header data fragment MAC encrypted data and MAC record header: content type; version; length MAC: includes sequence number, MAC key Mx fragment: each SSL fragment 214 bytes (~16 Kbytes) Network Security 8 -83

SSL Record Format 1 byte content type 2 bytes 3 bytes SSL version length SSL Record Format 1 byte content type 2 bytes 3 bytes SSL version length data MAC data and MAC encrypted (symmetric algorithm) Network Security 8 -84

Real Connection handshake: Client. Hel lo er. Hello hake: Serv hands rtificate dshake: Ce Real Connection handshake: Client. Hel lo er. Hello hake: Serv hands rtificate dshake: Ce han ello. Done e: Server. H handshake: Client. Key Exchange Change. Cipher. Sp ec handshake: Finished Everything henceforth is encrypted r. Spec Change. Ciphe inished dshake: F han application_data application_d TCP Fin follow Alert: warning, close_ notify Network Security 8 -85

Key derivation r client nonce, server nonce, and pre-master secret input into pseudo random-number Key derivation r client nonce, server nonce, and pre-master secret input into pseudo random-number generator. m produces master secret r master secret and new nonces input into another random-number generator: “key block” m Because of resumption: TBD r key block sliced and diced: m client MAC key m server MAC key m client encryption key m server encryption key m client initialization vector (IV) m server initialization vector (IV) Network Security 8 -86

Chapter 8 roadmap 8. 1 What is network security? 8. 2 Principles of cryptography Chapter 8 roadmap 8. 1 What is network security? 8. 2 Principles of cryptography 8. 3 Message integrity 8. 4 Securing e-mail 8. 5 Securing TCP connections: SSL 8. 6 Network layer security: IPsec 8. 7 Securing wireless LANs 8. 8 Operational security: firewalls and IDS Network Security 8 -87

What is network-layer confidentiality ? between two network entities: r sending entity encrypts datagram What is network-layer confidentiality ? between two network entities: r sending entity encrypts datagram payload, payload could be: m TCP or UDP segment, ICMP message, OSPF message …. r all data sent from one entity to other would be hidden: m web pages, e-mail, P 2 P file transfers, TCP SYN packets … r “blanket coverage” Network Security 8 -88

Virtual Private Networks (VPNs) r institutions often want private networks for security. m costly: Virtual Private Networks (VPNs) r institutions often want private networks for security. m costly: separate routers, links, DNS infrastructure. r VPN: institution’s inter-office traffic is sent over public Internet instead m encrypted before entering public Internet m logically separate from other traffic Network Security 8 -89

Virtual Private Network (VPN) IP header IPsec header Secure payload IP er ad ec Virtual Private Network (VPN) IP header IPsec header Secure payload IP er ad ec IPs der a he IPsec heade r laptop w/ IPsec salesperson in hotel he Secur e payloa d Public Internet IP heade r re cu Se load y pa IP er ad pay Router w/ IPv 4 and IPsec he loa d Router w/ IPv 4 and IPsec ylo IP hea der pa ad headquarters branch office Network Security 8 -90

IPsec services r data integrity r origin authentication r replay attack prevention r confidentiality IPsec services r data integrity r origin authentication r replay attack prevention r confidentiality r two protocols providing different service models: m AH m ESP Network Security 8 -91

IPsec Transport Mode IPsec r IPsec datagram emitted and received by end-system r protects IPsec Transport Mode IPsec r IPsec datagram emitted and received by end-system r protects upper level protocols Network Security 8 -92

IPsec – tunneling mode IPsec r edge routers IPsec- aware IPsec r hosts IPsec-aware IPsec – tunneling mode IPsec r edge routers IPsec- aware IPsec r hosts IPsec-aware Network Security 8 -93

Two protocols r Authentication Header (AH) protocol m provides source authentication & data integrity Two protocols r Authentication Header (AH) protocol m provides source authentication & data integrity but not confidentiality r Encapsulation Security Protocol (ESP) m provides source authentication, data integrity, and confidentiality m more widely used than AH Network Security 8 -94

Four combinations are possible! Host mode with AH Host mode with ESP Tunnel mode Four combinations are possible! Host mode with AH Host mode with ESP Tunnel mode with AH Tunnel mode with ESP most common and most important Network Security 8 -95

Security associations (SAs) r before sending data, “security association (SA)” established from sending to Security associations (SAs) r before sending data, “security association (SA)” established from sending to receiving entity m SAs are simplex: for only one direction r Ending, receiving entitles maintain state information about SA m Recall: TCP endpoints also maintain state info m IP is connectionless; IPsec is connection-oriented! r how many SAs in VPN w/ headquarters, branch office, and n traveling salespeople? Network Security 8 -96

Example SA from R 1 to R 2 Internet Headquarters 200. 168. 1. 100 Example SA from R 1 to R 2 Internet Headquarters 200. 168. 1. 100 SA Branch Office 193. 68. 2. 23 R 1 172. 16. 1/24 R 2 172. 16. 2/24 R 1 stores for SA r 32 -bit SA identifier: Security Parameter Index (SPI) r origin SA interface (200. 168. 1. 100) r destination SA interface (193. 68. 2. 23) r type of encryption used (e. g. , 3 DES with CBC) r encryption key r type of integrity check used (e. g. , HMAC with MD 5) r authentication key Network Security 8 -97

Security Association Database (SAD) v v endpoint holds SA state in SAD, where it Security Association Database (SAD) v v endpoint holds SA state in SAD, where it can locate them during processing. with n salespersons, 2 + 2 n SAs in R 1’s SAD when sending IPsec datagram, R 1 accesses SAD to determine how to process datagram. when IPsec datagram arrives to R 2, R 2 examines SPI in IPsec datagram, indexes SAD with SPI, and processes datagram accordingly. Network Security 8 -98

IPsec datagram focus for now on tunnel mode with ESP “enchilada” authenticated encrypted new IPsec datagram focus for now on tunnel mode with ESP “enchilada” authenticated encrypted new IP header ESP hdr SPI original IP hdr Seq # Original IP datagram payload padding ESP trl ESP auth pad next length header Network Security 8 -99

What happens? Internet Headquarters 200. 168. 1. 100 SA Branch Office 193. 68. 2. What happens? Internet Headquarters 200. 168. 1. 100 SA Branch Office 193. 68. 2. 23 R 1 R 2 172. 16. 1/24 172. 16. 2/24 “enchilada” authenticated encrypted new IP header ESP hdr SPI original IP hdr Seq # Original IP datagram payload padding ESP trl ESP auth pad next length header Network Security 8 -100

R 1 converts original datagram into IPsec datagram r appends to back of original R 1 converts original datagram into IPsec datagram r appends to back of original datagram (which includes r r r 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 “enchilada”. creates authentication MAC over the whole enchilada, using algorithm and key specified in SA; appends MAC to back of enchilada, forming payload; creates brand new IP header, with all the classic IPv 4 header fields, which it appends before payload. Network Security 8 -101

Inside the enchilada: “enchilada” authenticated encrypted new IP header ESP hdr SPI original IP Inside the enchilada: “enchilada” authenticated encrypted new IP header ESP hdr SPI original IP hdr Seq # Original IP datagram payload padding ESP trl ESP auth pad next length header r ESP trailer: Padding for block ciphers r ESP header: m SPI, so receiving entity knows what to do m Sequence number, to thwart replay attacks r MAC in ESP auth field is created with shared secret key Network Security 8 -102

IPsec sequence numbers r for new SA, sender initializes seq. # to 0 r IPsec sequence numbers r for new SA, sender initializes seq. # to 0 r each time datagram is sent on SA: m sender increments seq # counter m places value in seq # field r goal: m prevent attacker from sniffing and replaying a packet m receipt of duplicate, authenticated IP packets may disrupt service r method: m destination checks for duplicates m but doesn’t keep track of ALL received packets; instead uses a window Network Security 8 -103

Security Policy Database (SPD) r policy: For a given datagram, sending entity needs to Security Policy Database (SPD) r policy: For a given datagram, sending entity needs to know if it should use IPsec r needs also to know which SA to use m may use: source and destination IP address; protocol number r info in SPD indicates “what” to do with arriving datagram r info in SAD indicates “how” to do it Network Security 8 -104

Summary: IPsec services r suppose Trudy sits somewhere between R 1 and R 2. Summary: IPsec services r suppose Trudy sits somewhere between R 1 and R 2. she doesn’t know the keys. m will Trudy be able to see original contents of datagram? How about source, dest IP address, transport protocol, application port? m flip bits without detection? m masquerade as R 1 using R 1’s IP address? m replay a datagram? Network Security 8 -105

Internet Key Exchange r previous examples: manual establishment of IPsec SAs in IPsec endpoints: Internet Key Exchange r previous examples: manual establishment of IPsec SAs in IPsec endpoints: Example SA SPI: 12345 Source IP: 200. 168. 1. 100 Dest IP: 193. 68. 2. 23 Protocol: ESP Encryption algorithm: 3 DES-cbc HMAC algorithm: MD 5 Encryption key: 0 x 7 aeaca… HMAC key: 0 xc 0291 f… r manual keying is impractical for VPN with 100 s of endpoints r instead use IPsec IKE (Internet Key Exchange) Network Security 8 -106

IKE: PSK and PKI r authentication (prove who you are) with either m pre-shared IKE: PSK and PKI r authentication (prove who you are) with either m pre-shared secret (PSK) or m with PKI (pubic/private keys and certificates). r PSK: both sides start with secret m run IKE to authenticate each other and to generate IPsec SAs (one in each direction), including encryption, authentication keys r PKI: both sides start with public/private key pair, certificate m run IKE to authenticate each other, obtain IPsec SAs (one in each direction). m similar with handshake in SSL. Network Security 8 -107

IKE Phases r IKE has two phases m phase 1: establish bi-directional IKE SA IKE Phases r IKE has two phases m phase 1: establish bi-directional IKE SA • note: IKE SA different from IPsec SA • aka ISAKMP security association m phase 2: ISAKMP is used to securely negotiate IPsec pair of SAs r phase 1 has two modes: aggressive mode and main mode m aggressive mode uses fewer messages m main mode provides identity protection and is more flexible Network Security 8 -108

Summary of IPsec r IKE message exchange for algorithms, secret keys, SPI numbers r Summary of IPsec r IKE message exchange for algorithms, secret keys, SPI numbers r either AH or ESP protocol (or both) m AH provides integrity, source authentication m ESP protocol (with AH) additionally provides encryption r IPsec peers can be two end systems, two routers/firewalls, or a router/firewall and an end system Network Security 8 -109

Chapter 8 roadmap 8. 1 What is network security? 8. 2 Principles of cryptography Chapter 8 roadmap 8. 1 What is network security? 8. 2 Principles of cryptography 8. 3 Message integrity 8. 4 Securing e-mail 8. 5 Securing TCP connections: SSL 8. 6 Network layer security: IPsec 8. 7 Securing wireless LANs 8. 8 Operational security: firewalls and IDS Network Security 8 -110

WEP Design Goals r symmetric key crypto m confidentiality m end host authorization m WEP Design Goals r symmetric key crypto m confidentiality m end host authorization m data integrity r self-synchronizing: each packet separately encrypted m given encrypted packet and key, can decrypt; can continue to decrypt packets when preceding packet was lost (unlike Cipher Block Chaining (CBC) in block ciphers) r efficient m can be implemented in hardware or software Network Security 8 -111

Review: Symmetric Stream Ciphers keystream generator keystream r combine each byte of keystream with Review: Symmetric Stream Ciphers keystream generator keystream r combine each byte of keystream with byte of plaintext to get ciphertext m m(i) = ith unit of message m ks(i) = ith unit of keystream m c(i) = ith unit of ciphertext m c(i) = ks(i) m(i) ( = exclusive or) m m(i) = ks(i) c(i) r WEP uses RC 4 Network Security 8 -112

Stream cipher and packet independence r recall design goal: each packet separately encrypted r Stream cipher and packet independence r recall design goal: each packet separately encrypted r if for frame n+1, use keystream from where we left off for frame n, then each frame is not separately encrypted m need to know where we left off for packet n r WEP approach: initialize keystream with key + new IV for each packet: Key+IVpacket keystream generator keystreampacket Network Security 8 -113

WEP encryption (1) r sender calculates Integrity Check Value (ICV) over data m four-byte WEP encryption (1) r sender calculates Integrity Check Value (ICV) over data m four-byte hash/CRC for data integrity r each side has 104 -bit shared key r sender creates 24 -bit initialization vector (IV), appends to key: gives 128 -bit key r sender also appends key. ID (in 8 -bit field) r 128 -bit key inputted into pseudo random number generator to get keystream r data in frame + ICV is encrypted with RC 4: m m m Bytes of keystream are XORed with bytes of data & ICV IV & key. ID are appended to encrypted data to create payload Payload inserted into 802. 11 frame encrypted IV Key data ID ICV MAC payload Network Security 8 -114

WEP encryption (2) New IV for each frame Network Security 8 -115 WEP encryption (2) New IV for each frame Network Security 8 -115

WEP decryption overview encrypted IV Key data ID ICV MAC payload r receiver extracts WEP decryption overview encrypted IV Key data ID ICV MAC payload r receiver extracts IV r inputs IV, shared secret key into pseudo random generator, gets keystream r XORs keystream with encrypted data to decrypt data + ICV r verifies integrity of data with ICV m note: message integrity approach used here is different from MAC (message authentication code) and signatures (using PKI). Network Security 8 -116

End-point authentication w/ nonce Nonce: number (R) used only once –in-a-lifetime How: to prove End-point authentication w/ nonce Nonce: number (R) used only once –in-a-lifetime How: to prove Alice “live”, Bob sends Alice nonce, R. Alice must return R, encrypted with shared secret key “I am Alice” R KA-B(R) Alice is live, and only Alice knows key to encrypt nonce, so it must be Alice! Network Security 8 -117

WEP Authentication Not all APs do it, even if WEP is being used. AP WEP Authentication Not all APs do it, even if WEP is being used. AP indicates if authentication is necessary in beacon frame. Done before association. authentication request AP nonce (128 bytes) nonce encrypted shared key success if decrypted value equals nonce Network Security 8 -118

Breaking 802. 11 WEP encryption security hole: r 24 -bit IV, one IV per Breaking 802. 11 WEP encryption security hole: r 24 -bit IV, one IV per frame, -> IV’s eventually reused r IV transmitted in plaintext -> IV reuse detected r attack: m Trudy causes Alice to encrypt known plaintext d 1 d 2 d 3 d 4 … IV m Trudy sees: ci = di XOR ki knows ci di, so can compute ki. IV IV m Trudy knows encrypting key sequence k 1 k 2 k 3 … m Next time IV is used, Trudy can decrypt! m Trudy Network Security 8 -119

802. 11 i: improved security r numerous (stronger) forms of encryption possible r provides 802. 11 i: improved security r numerous (stronger) forms of encryption possible r provides key distribution r uses authentication server separate from access point Network Security 8 -120

802. 11 i: four phases of operation STA: client station AP: access point AS: 802. 11 i: four phases of operation STA: client station AP: access point AS: Authentication server wired network 1 Discovery of security capabilities STA 2 and AS mutually authenticate, together generate Master Key (MK). AP servers as “pass through” STA derives 3 Pairwise Master Key (PMK) STA, AP use PMK to derive 4 Temporal Key (TK) used for message encryption, integrity 3 AS derives same PMK, sends to AP Network Security 8 -121

EAP: extensible authentication protocol r EAP: end-end client (mobile) to authentication server protocol r EAP: extensible authentication protocol r EAP: end-end client (mobile) to authentication server protocol r EAP sent over separate “links” m mobile-to-AP (EAP over LAN) m AP to authentication server (RADIUS over UDP) wired network EAP TLS EAP over LAN (EAPo. L) IEEE 802. 11 RADIUS UDP/IP Network Security 8 -122

Chapter 8 roadmap 8. 1 What is network security? 8. 2 Principles of cryptography Chapter 8 roadmap 8. 1 What is network security? 8. 2 Principles of cryptography 8. 3 Message integrity 8. 4 Securing e-mail 8. 5 Securing TCP connections: SSL 8. 6 Network layer security: IPsec 8. 7 Securing wireless LANs 8. 8 Operational security: firewalls and IDS Network Security 8 -123

Firewalls firewall isolates organization’s internal net from larger Internet, allowing some packets to pass, Firewalls firewall isolates organization’s internal net from larger Internet, allowing some packets to pass, blocking others public Internet administered network firewall Network Security 8 -124

Firewalls: Why prevent denial of service attacks: v SYN flooding: attacker establishes many bogus Firewalls: Why prevent denial of service attacks: v SYN flooding: attacker establishes many bogus TCP connections, no resources left for “real” connections prevent illegal modification/access of internal data. v e. g. , attacker replaces CIA’s homepage with something else allow only authorized access to inside network (set of authenticated users/hosts) three types of firewalls: v stateless packet filters v stateful packet filters v application gateways Network Security 8 -125

Stateless packet filtering Should arriving packet be allowed in? Departing packet let out? v Stateless packet filtering Should arriving packet be allowed in? Departing packet let out? v v internal network connected to Internet via router firewall router filters packet-by-packet, decision to forward/drop packet based on: § § source IP address, destination IP address TCP/UDP source and destination port numbers ICMP message type TCP SYN and ACK bits Network Security 8 -126

Stateless packet filtering: example v v example 1: block incoming and outgoing datagrams with Stateless packet filtering: example v v example 1: block incoming and outgoing datagrams with IP protocol field = 17 and with either source or dest port = 23. § all incoming, 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. Network Security 8 -127

Stateless packet filtering: more examples Policy Firewall Setting No outside Web access. Drop all Stateless packet filtering: more examples Policy Firewall Setting No outside Web access. Drop all outgoing packets to any IP address, port 80 No incoming TCP connections, except those for institution’s public Web server only. Drop all incoming TCP SYN packets to any IP except 130. 207. 244. 203, port 80 Prevent Web-radios from eating up Drop all incoming UDP packets - except DNS and router broadcasts. the available bandwidth. Prevent your network from being used for a smurf Do. S attack. Drop all ICMP packets going to a “broadcast” address (e. g. 130. 207. 255). Prevent your network from being tracerouted Drop all outgoing ICMP TTL expired traffic Network Security 8 -128

Access Control Lists v ACL: table of rules, applied top to bottom to incoming Access Control Lists v ACL: table of rules, applied top to bottom to incoming packets: (action, condition) pairs action source address dest address protocol source port dest port allow 222. 22/16 outside of 222. 22/16 TCP > 1023 80 allow outside of 222. 22/16 TCP 80 > 1023 ACK allow 222. 22/16 UDP > 1023 53 --- allow outside of 222. 22/16 UDP 53 > 1023 ---- deny all all all 222. 22/16 outside of 222. 22/16 flag bit any Network Security 8 -129

Stateful packet filtering v stateless packet filter: heavy handed tool § admits packets that Stateful packet filtering v stateless packet filter: heavy handed tool § admits packets that “make no sense, ” e. g. , dest port = 80, ACK bit set, even though no TCP connection established: action allow v source address dest address outside of 222. 22/16 protocol source port dest port flag bit TCP 80 > 1023 ACK stateful packet filter: track status of every TCP connection § track connection setup (SYN), teardown (FIN): can determine whether incoming, outgoing packets “makes sense” § timeout inactive connections at firewall: no longer admit packets Network Security 8 -130

Stateful packet filtering v ACL augmented to indicate need to check connection state table Stateful packet filtering v ACL augmented to indicate need to check connection state table before admitting packet action source address dest address proto source port dest port allow 222. 22/16 outside of 222. 22/16 TCP > 1023 80 allow outside of 222. 22/16 TCP 80 > 1023 ACK allow 222. 22/16 UDP > 1023 53 --- allow outside of 222. 22/16 deny all 222. 22/16 outside of 222. 22/16 flag bit check conxion any UDP 53 > 1023 ---- all all x x all Network Security 8 -131

Application gateways v v filters packets on application data as well as on IP/TCP/UDP Application gateways v v filters packets on application data as well as on IP/TCP/UDP fields. example: allow select internal users to telnet outside. host-to-gateway telnet session application gateway-to-remote host telnet session router and filter 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 connections 3. router filter blocks all telnet connections not originating from gateway. Network Security 8 -132

Limitations of firewalls and gateways v v v IP spoofing: router can’t know if Limitations of firewalls and gateways v v v 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. v v v 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. § e. g. , must set IP address of proxy in Web browser Network Security 8 -133

Intrusion detection systems r packet filtering: m operates on TCP/IP headers only m no Intrusion detection systems r packet filtering: m operates on TCP/IP headers only m no correlation check among sessions r IDS: intrusion detection system m deep packet inspection: look at packet contents (e. g. , check character strings in packet against database of known virus, attack strings) m examine correlation among multiple packets • port scanning • network mapping • Do. S attack Network Security 8 -134

Intrusion detection systems r multiple IDSs: different types of checking at different locations application Intrusion detection systems r multiple IDSs: different types of checking at different locations application gateway firewall Internet internal network IDS sensors Web server FTP server DNS server demilitarized zone Network Security 8 -135

Network Security (summary) basic techniques…. . . m cryptography (symmetric and public) m message Network Security (summary) basic techniques…. . . m cryptography (symmetric and public) m message integrity m end-point authentication …. used in many different security scenarios m secure email m secure transport (SSL) m IP sec m 802. 11 operational security: firewalls and IDS Network Security 8 -136