Presentation is loading. Please wait.

Presentation is loading. Please wait.

8: Network Security8-1 Chapter 8: Network Security Chapter goals: r understand principles of network security: m cryptography and its many uses beyond.

Similar presentations


Presentation on theme: "8: Network Security8-1 Chapter 8: Network Security Chapter goals: r understand principles of network security: m cryptography and its many uses beyond."— Presentation transcript:

1 8: Network Security8-1 Chapter 8: Network Security Chapter goals: r understand principles of network security: m cryptography and its many uses beyond “confidentiality” m authentication m message integrity r security in practice: Secure Socket Layer m firewalls and intrusion detection systems m security in application, transport, network, link layers

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

3 8: Network Security8-3 There are bad guys (and girls) out there! Q: What can a “bad guy” do? A: a lot! 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)

4 8: Network Security8-4 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

5 8: Network Security8-5 The language of cryptography symmetric key crypto: sender, receiver keys identical public-key crypto: encryption key public, decryption key secret (private) plaintext ciphertext K A encryption algorithm decryption algorithm Alice’s encryption key Bob’s decryption key K B

6 8: Network Security8-6 Symmetric key cryptography substitution cipher: substituting one thing for another m monoalphabetic cipher: substitute one letter for another plaintext: abcdefghijklmnopqrstuvwxyz ciphertext: mnbvcxzasdfghjklpoiuytrewq Plaintext: bob. i love you. alice ciphertext: nkn. s gktc wky. mgsbc E.g.: Q: How hard to break this simple cipher?:  brute force (how hard?) or other? Key: the mapping from the set of 26 letters to the set of 26 letters

7 7 Polyalphabetic encryption r n monoalphabetic cyphers, M 1,M 2,…,M n r Cycling pattern: m e.g., n=5, M 1,M 3,M 4,M 3,M 2 ; 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

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

9 9 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

10 10 Stream Ciphers r Combine each bit of keystream with bit of plaintext to get bit of ciphertext r m(i) = ith bit of message r ks(i) = ith bit of keystream r c(i) = ith bit of ciphertext r c(i) = ks(i)  m(i) (  = exclusive or) r m(i) = ks(i)  c(i) keystream generator key keystream pseudo random

11 11 RC4 Stream Cipher r RC4 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

12 12 64-bit Block Cipher 64-bit input S1S1 8bits S2S2 S3S3 S4S4 S7S7 S6S6 S5S5 S8S8 64-bit intermediate 64-bit output Loop for n rounds 8-bit to 8-bit mapping From Kaufman et al

13 13 Why multiple rounds? 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

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

15 8: Network Security8-15 Symmetric key crypto: DES DES: Data Encryption Standard r US encryption standard [NIST 1993] r 56-bit symmetric key, 64-bit plaintext input r How secure is DES? m DES Challenge: 56-bit-key-encrypted phrase (“Strong cryptography makes the world a safer place”) decrypted (brute force) in 4 months m no known “backdoor” decryption approach r making DES more secure: m use three keys sequentially (3-DES) on each datum m use cipher-block chaining

16 8: Network Security8-16 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

17 8: Network Security8-17 Public key cryptography symmetric key crypto r requires sender, receiver know shared secret key r Q: how to agree on key in first place (particularly if never “met”)? public key cryptography r radically different approach [Diffie- Hellman76, RSA78] r sender, receiver do not share secret key r public encryption key known to all r private decryption key known only to receiver

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

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

20 8: Network Security8-20 RSA: Choosing keys 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<n) that has no common factors with z. (e, z are “relatively prime”). 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 B + K B -

21 8: Network Security8-21 RSA: Encryption, decryption 0. Given (n,e) and (n,d) as computed above 1. To encrypt bit pattern, m, compute c = m mod n e (i.e., remainder when m is divided by n) e 2. To decrypt received bit pattern, c, compute m = c mod n d (i.e., remainder when c is divided by n) d m = (m mod n) e mod n d Magic happens! c

22 8: Network Security8-22 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. letter m m e c = m mod n e l 12 1524832 17 c m = c mod n d 17 481968572106750915091411825223071697 12 c d letter l encrypt: decrypt:

23 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 = a d mod n r Example: x=14, n=10, d=2: (x mod n) d mod n = 4 2 mod 10 = 6 x d = 14 2 = 196 x d mod 10 = 6 8: Network Security8-23

24 8: Network Security8-24 RSA: Why is that m = (m mod n) e mod n d (m mod n) e mod n = m mod n d ed Useful number theory result: If p,q prime and n = pq, then: x mod n = x mod n yy mod (p-1)(q-1) = m mod n ed mod (p-1)(q-1) = m mod n 1 = m (using number theory result above) (since we chose ed to be divisible by (p-1)(q-1) with remainder 1 )

25 8: Network Security8-25 RSA: another important property The following property will be very useful later: K ( K (m) ) = m B B - + 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!

26 26 Follows directly from modular arithmetic: (m e mod n) d mod n = m ed mod n = m de mod n = (m d mod n) e mod n K ( K (m) ) = m B B - + K ( K (m) ) B B + - = Why ? 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.

27 Still Need Secret Session keys r Exponentiation is computationally intensive r DES is at least 100 times faster than RSA Session key, K S r Bob and Alice use RSA to exchange a symmetric key K S r Once both have K S, they use symmetric key cryptography 8: Network Security8-27

28 8: Network Security8-28 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

29 8: Network Security8-29 Message Integrity Bob receives msg from Alice, wants to ensure: r message originally came from Alice r message not changed since sent by Alice Cryptographic Hash: r takes input m, produces fixed length value, H(m) m e.g., as in Internet checksum r computationally infeasible to find two different messages, x, y such that H(x) = H(y) m equivalently: given m = H(x), (x unknown), can not determine x.

30 Ch8 -30 Message Digests Computationally expensive to public-key-encrypt long messages Goal: fixed-length, easy- to- compute digital “fingerprint” r apply hash function H to m, get fixed size message digest, H(m). Hash function properties: r many-to-1 r But given message digest x = H(m), it’s infeasible to find m’ that H(m’) = H(m) r Data integrity: cannot replace m with m’ large message m H: Hash Function H(m)

31 8: Network Security8-31 Message Authentication Code m s (shared secret) (message) H(. ) H(m+s) public Internet append m H(m+s) s compare m H(m+s) H(. ) H(m+s) (shared secret)

32 8: Network Security8-32 MACs in practice r MD5 hash function widely used (RFC 1321) m computes 128-bit MAC in 4-step process. m arbitrary 128-bit string x, appears difficult to construct msg m whose MD5 hash is equal to x recent (2005) attacks on MD5 r SHA-1 is also used m US standard [ NIST, FIPS PUB 180-1] m 160-bit MAC Partial attack

33 8: Network Security8-33 Digital Signatures cryptographic technique analogous to hand- written signatures. r sender (Bob) digitally signs document, establishing he is document owner/creator. r verifiable, nonforgeable: recipient (Alice) can prove to someone that Bob, and no one else (including Alice), must have signed document

34 8: Network Security8-34 Digital Signatures simple digital signature for message m: r Bob “signs” m by encrypting with his private key K B, creating “signed” message, K B (m) - - Dear Alice Oh, how I have missed you. I think of you all the time! …(blah blah blah) Bob Bob’s message, m public key encryption algorithm Bob’s private key K B - Bob’s message, m, signed (encrypted) with his private key K B - (m) In addition, Bob needs to send message “m” in plaintext or using shared/public key of Alice !

35 8: Network Security8-35 Digital Signatures (more) r suppose Alice receives msg m, digital signature K B (m) r Alice verifies m signed by Bob by applying Bob’s public key K B to K B (m) then checks K B (K B (m) ) = m. r if K B (K B (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 K B (m) to court and prove that Bob signed m. -

36 8: Network Security8-36 large message m H: hash function H(m) digital signature (encrypt) Bob’s private key K B - + Bob sends digitally signed message: Alice verifies signature and integrity of digitally signed message: K B (H(m)) - encrypted msg digest K B (H(m)) - encrypted msg digest large message m H: hash function H(m) digital signature (decrypt) H(m) Bob’s public key K B + equal ? Digital signature = signed MAC

37 8: Network Security8-37 Authentication Goal: Bob wants Alice to “prove” her identity to him Protocol ap1.0: Alice says “I am Alice” Failure scenario?? “I am Alice”

38 8: Network Security8-38 Authentication Goal: Bob wants Alice to “prove” her identity to him Protocol ap1.0: Alice says “I am Alice” in a network, Bob can not “see” Alice, so Trudy simply declares herself to be Alice “I am Alice”

39 8: Network Security8-39 Authentication: another try Protocol ap2.0: Alice says “I am Alice” in an IP packet containing her source IP address Failure scenario?? “I am Alice” Alice’s IP address

40 8: Network Security8-40 Authentication: another try Protocol ap2.0: Alice says “I am Alice” in an IP packet containing her source IP address Trudy can create a packet “spoofing” Alice’s address “I am Alice” Alice’s IP address

41 8: Network Security8-41 Authentication: another try Protocol ap3.0: Alice says “I am Alice” and sends her (encrypted) secret password to “prove” it. Failure scenario?? “I’m Alice” Alice’s IP addr Alice’s password OK Alice’s IP addr

42 8: Network Security8-42 Authentication: another try Protocol ap3.0: Alice says “I am Alice” and sends her (encrypted) secret password to “prove” it. playback attack: Trudy records Alice’s packet and later plays it back to Bob “I’m Alice” Alice’s IP addr Alice’s password OK Alice’s IP addr “I’m Alice” Alice’s IP addr Alice’s password

43 8: Network Security8-43 Authentication: yet another try Goal: avoid playback attack Failures? Nonce: number (R) used only once –in-a-lifetime ap4.0: to prove Alice “live”, Bob sends Alice nonce, R. Alice must return R, encrypted with shared secret key “I am Alice” R K (R) A-B Alice is live, and only Alice knows key to encrypt nonce, so it must be Alice!

44 Ch8 -44 Two-way Authentication 1 Request from Alice 2 & 4 Challege (a nonce) from Bob & Alice, resp 3 & 5 Response from Alice & Bob, resp (authenticated afterwards)

45 Ch8-45 What if we do it in three steps? r Alice request and challenges Bob first r Bob responses (and get authenticated) and challenges Alice next r Alice responses (is she authenticated?)

46 Ch8-46 Reflection Attack r Trudy gets challenged (steps 1 and 2) in session one. r Trudy fools Bob to answer his own challenge (in steps 3 and 4) in session two. r Trudy can now proceed with the first session.

47 8: Network Security8-47 Authentication: ap5.0 ap4.0 requires shared symmetric key r can we authenticate using public key techniques? ap5.0: use nonce, public key cryptography “I am Alice” R Bob computes K (R) A - “send me your public key” K A + (K (R)) = R A - K A + and knows only Alice could have the private key, that encrypted R such that (K (R)) = R A - K A +

48 48 Ap5.0 Security Hole r 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

49 8: Network Security8-49 ap5.0: security hole Man (woman) in the middle attack: Trudy poses as Alice (to Bob) and as Bob (to Alice) I am Alice R T K (R) - Send me your public key T K + A K (R) - Send me your public key A K + T K (m) + T m = K (K (m)) + T - Trudy gets sends m to Alice encrypted with Alice’s public key A K (m) + A m = K (K (m)) + A - R

50 8: Network Security8-50 ap5.0: security hole Man (woman) in the middle attack: Trudy poses as Alice (to Bob) and as Bob (to Alice) Difficult to detect:  Bob receives everything that Alice sends, and vice versa. (e.g., so Bob, Alice can meet one week later and recall conversation)  problem is that Trudy receives all messages as well!

51 8: Network Security8-51 Public Key Certification public key problem: r When Alice obtains Bob’s public key (from web site, e-mail, diskette), how does she know it is Bob’s public key, not Trudy’s? solution: r trusted certification authority (CA)

52 8: Network Security8-52 Certification Authorities r Certification Authority (CA): binds public key to particular entity, E. r E registers its public key with CA. m E provides “proof of identity” to CA. m CA creates certificate binding E to its public key. m certificate containing E’s public key digitally signed by CA: CA says “This is E’s public key.” Bob’s public key K B + Bob’s identifying information digital signature (encrypt) CA private key K CA - K B + certificate for Bob’s public key, signed by CA - K CA (K ) B +

53 8: Network Security8-53 Certification Authorities r when Alice wants Bob’s public key: m gets Bob’s certificate (Bob or elsewhere). m apply CA’s public key to Bob’s certificate, get Bob’s public key Bob’s public key K B + digital signature (decrypt) CA public key K CA + K B + - K (K ) B +

54 Ch8 -54 Trusted Intermediaries Symmetric key problem: r How do two entities establish shared secret key over network? Solution: r trusted key distribution center (KDC) acting as intermediary between entities Public key problem: r When Alice obtains Bob’s public key (from web site, e- mail, diskette), how does she know it is Bob’s public key, not Trudy’s? Solution: r trusted certification authority (CA)

55 8: Network Security8-55 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

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

57 8: Network Security8-57 Secure e-mail Bob:  uses his private key to decrypt and recover K S  uses K S to decrypt K S (m) to recover m  Alice wants to send confidential e-mail, m, to Bob. K S ( ). K B ( ). + + - K S (m ) K B (K S ) + m KSKS KSKS KBKB + Internet K S ( ). K B ( ). - KBKB - KSKS m K S (m ) K B (K S ) + Any security hole?

58 8: Network Security8-58 Secure e-mail (continued) Alice wants to provide sender authentication message integrity. Alice digitally signs message. sends both message (in the clear) and digital signature. H( ). K A ( ). - + - H(m ) K A (H(m)) - m KAKA - Internet m K A ( ). + KAKA + K A (H(m)) - m H( ). H(m ) compare

59 8: Network Security8-59 Secure e-mail (Put it all together) PGP – Phil Zimmerman Alice wants to provide secrecy, sender authentication, message integrity. Alice uses three keys: her private key, Bob’s public key, newly created symmetric key Q: What does Bob have to do”? H( ). K A ( ). - + K A (H(m)) - m KAKA - m K S ( ). K B ( ). + + K B (K S ) + KSKS KBKB + Internet KSKS

60 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

61 61 SSL: Secure Sockets Layer r Widely deployed security protocol m Supported by almost all browsers and web servers m https m Tens of billions $ spent per year over SSL r Originally designed by Netscape in 1993 r Number of variations: m TLS: transport layer security, RFC 2246 r Provides m Confidentiality m Integrity m Authentication r Original goals: m Had Web e-commerce transactions in mind m Encryption (especially credit-card numbers) m Web-server authentication m Optional client authentication m Minimum hassle in doing business with new merchant r Available to all TCP applications m Secure socket interface

62 62 SSL and TCP/IP Application TCP IP Normal Application Application SSL TCP IP Application with SSL SSL provides application programming interface (API) to applications C and Java SSL libraries/classes readily available

63 63 Could do something like PGP: But want to send byte streams & interactive data Want a set of secret keys for the entire connection Want certificate exchange part of protocol: handshake phase H( ). K A ( ). - + K A (H(m)) - m KAKA - m K S ( ). K B ( ). + + K B (K S ) + KSKS KBKB + Internet KSKS

64 64 Toy SSL: a simple secure channel r Handshake: Alice and Bob use their certificates and private keys to authenticate each other and exchange a shared Master secret r Key Derivation: Alice and Bob use shared secret to derive s set of keys r Data Transfer: Data to be transferred is broken up into a series of records r Connection Closure: Special messages to securely close connection

65 65 Toy: A simple handshake r MS = master secret r EMS = encrypted master secret hello certificate K B + (MS) = EMS

66 66 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 K c = encryption key for data sent from client to server m M c = MAC key for data sent from client to server m K s = encryption key for data sent from server to client m M s = 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

67 67 Toy: Data Records r Why not encrypt data as we write it to TCP? m Where would we put the MAC? If at end, no message integrity until all data processed. m For example, 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 lengthdataMAC

68 68 Toy: Sequence Numbers r Attacker can capture and replay record or re-order records r Solution: put sequence number into MAC: m MAC = MAC(M x, sequence||data) m Note: no sequence number field r Attacker could still replay all of the records m Use random nonce

69 69 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(M x, sequence||type||data) lengthtypedataMAC

70 70 Toy SSL: summary hello certificate, nonce K B + (MS) = EMS type 0, seq 1, data type 0, seq 2, data type 0, seq 1, data type 0, seq 3, data type 1, seq 4, close type 1, seq 2, close encrypted bob.com

71 71 Toy SSL isn’t complete r How long are the fields? r What encryption protocols? r No negotiation m Allow client and server to support different encryption algorithms m Allow client and server to choose together specific algorithm before data transfer

72 8: Network Security 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

73 8: Network Security 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


Download ppt "8: Network Security8-1 Chapter 8: Network Security Chapter goals: r understand principles of network security: m cryptography and its many uses beyond."

Similar presentations


Ads by Google